lightninglabs / lightninglabs/lndclient

Router SendPayment does not parse Amount when Invoice with dynamic value is set.

Open
#174 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
57
Forks
50
PR merge metrics
No merged PRs in 30d

Description

https://github.com/lightninglabs/lndclient/blob/67d851af8b541c231dd9bd1abb1842eba05a4dfe/router_client.go#L425

When sending a payment with the parameters request.Invoice set to a 0 amount invoice as well as request.Amount set it will still submit it without the amount as opposed to what is expected for a dynamic value invoice.

I tried it with [this](https://lndecode.com/?invoice=lnbcrt1pjmspe8pp5kq8kqv62c59cmaku5zwvruhnelm9824h0kwktukcswa8qq32767qdqjwfskuer0d5sxumm5v5cqzzsxqyz5vqsp50mn0lqkhuxk37mdatlsuc8e85s8dcs0ktwzm348k9edslj50evqq9qyyssq4jnwf003rzc7p4vpnq7vr668vf65lnzrepzc55m4lvrfmgzg3hdz9nx2qhsx4k9xjrms5e0mgnmfglehrlztv2ca9kzgevhjuw6wuacqwpr477) invoice. This will result in `rpc error: code = Unknown desc = amount must be specified when paying a zero amount invoice`

Or is this expected and I have to replace the 0 amount invoice myself first?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at router_client.go around line 425 and reproduce the request using a zero-amount invoice with request.Amount set. Confirm how SendPayment handles the invoice and amount, then add coverage showing that the requested amount is passed for dynamic-value invoices and that the reported RPC error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.