Skip to content

Commit 6b27746

Browse files
committed
mod+itest: reproduce and fix reverse direction invoice payment
Fixes a bug that when an invoice is paid, the full invoice amount is checked when validating the local channel balance and reserve. But for custom channels the actual HTLC amount might be just above dust and shouldn't validate the channel reserve. We update our itest to reproduce the issue and then update to the lnd commit that fixes it.
1 parent 2f0f95d commit 6b27746

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/lightninglabs/pool v0.6.5-beta.0.20240604070222-e121aadb3289
2222
github.com/lightninglabs/pool/auctioneerrpc v1.1.2
2323
github.com/lightninglabs/taproot-assets v0.4.0-alpha.rc3
24-
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240709210732-0cd11ad84792
24+
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240712025014-90f997c908d0
2525
github.com/lightningnetwork/lnd/cert v1.2.2
2626
github.com/lightningnetwork/lnd/fn v1.1.0
2727
github.com/lightningnetwork/lnd/kvdb v1.4.8

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,8 +1179,8 @@ github.com/lightninglabs/taproot-assets v0.4.0-alpha.rc3 h1:Ovt4wMhCIqdw+uNwJaSf
11791179
github.com/lightninglabs/taproot-assets v0.4.0-alpha.rc3/go.mod h1:oAiEnRj2sCbPHAURot+tmKbyDhIoxnvkmag0JqlF1bs=
11801180
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f h1:Pua7+5TcFEJXIIZ1I2YAUapmbcttmLj4TTi786bIi3s=
11811181
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
1182-
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240709210732-0cd11ad84792 h1:bM4UmjVTvhqwDCMzLZIDMecfo/mei4OS/BFLUzHiDNc=
1183-
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240709210732-0cd11ad84792/go.mod h1:L3IArArdRrWtuw+wNsUlibuGmf/08Odsm/zo3+bPXuM=
1182+
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240712025014-90f997c908d0 h1:V+PoltFSxN5oijkErYe+QbnVz5WJjBsAzaMNRrhmz3Q=
1183+
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240712025014-90f997c908d0/go.mod h1:L3IArArdRrWtuw+wNsUlibuGmf/08Odsm/zo3+bPXuM=
11841184
github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI=
11851185
github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U=
11861186
github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0=

itest/litd_custom_channels_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func testCustomChannels(_ context.Context, net *NetworkHarness,
218218
// ------------
219219
// Test case 1: Send a direct keysend payment from Charlie to Dave.
220220
// ------------
221-
const keySendAmount = 100
221+
const keySendAmount = 1000
222222
sendAssetKeySendPayment(
223223
t.t, charlie, dave, keySendAmount, assetID, fn.None[int64](),
224224
)
@@ -227,13 +227,13 @@ func testCustomChannels(_ context.Context, net *NetworkHarness,
227227
charlieAssetBalance -= keySendAmount
228228
daveAssetBalance += keySendAmount
229229

230-
// We should be able to send the 100 assets back immediately, because
230+
// We should be able to send the 1000 assets back immediately, because
231231
// there is enough on-chain balance on Dave's side to be able to create
232-
// an HTLC.
233-
sendAssetKeySendPayment(
234-
t.t, dave, charlie, keySendAmount, assetID, fn.None[int64](),
232+
// an HTLC. We use an invoice to execute another code path.
233+
invoiceResp := createAssetInvoice(
234+
t.t, dave, charlie, keySendAmount, assetID,
235235
)
236-
logBalance(t.t, nodes, assetID, "after keysend back")
236+
payInvoiceWithAssets(t.t, dave, charlie, invoiceResp, assetID)
237237

238238
charlieAssetBalance += keySendAmount
239239
daveAssetBalance -= keySendAmount
@@ -266,7 +266,7 @@ func testCustomChannels(_ context.Context, net *NetworkHarness,
266266
// invoice.
267267
// ------------
268268
const daveInvoiceAssetAmount = 2_000
269-
invoiceResp := createAssetInvoice(
269+
invoiceResp = createAssetInvoice(
270270
t.t, charlie, dave, daveInvoiceAssetAmount, assetID,
271271
)
272272
payInvoiceWithAssets(t.t, charlie, dave, invoiceResp, assetID)

0 commit comments

Comments
 (0)