Skip to content

Commit 4e9fec1

Browse files
guggeroRoasbeef
authored andcommitted
itest: spend assets after sweeping from force close
1 parent 5f05f2d commit 4e9fec1

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/lightninglabs/loop/swapserverrpc v1.0.8
2121
github.com/lightninglabs/pool v0.6.5-beta.0.20240604070222-e121aadb3289
2222
github.com/lightninglabs/pool/auctioneerrpc v1.1.2
23-
github.com/lightninglabs/taproot-assets v0.4.2-0.20240815180811-2110839696cb
23+
github.com/lightninglabs/taproot-assets v0.4.2-0.20240823230436-0302f74ce93a
2424
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240730143253-1b353b0bfd58
2525
github.com/lightningnetwork/lnd/cert v1.2.2
2626
github.com/lightningnetwork/lnd/fn v1.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,8 @@ github.com/lightninglabs/pool/auctioneerrpc v1.1.2 h1:Dbg+9Z9jXnhimR27EN37foc4aB
11751175
github.com/lightninglabs/pool/auctioneerrpc v1.1.2/go.mod h1:1wKDzN2zEP8srOi0B9iySlEsPdoPhw6oo3Vbm1v4Mhw=
11761176
github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display h1:pRdza2wleRN1L2fJXd6ZoQ9ZegVFTAb2bOQfruJPKcY=
11771177
github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
1178-
github.com/lightninglabs/taproot-assets v0.4.2-0.20240815180811-2110839696cb h1:0MPIRVvk7ExBV35xEfAS2gDzQyGfufPYVhCAp2S6jwo=
1179-
github.com/lightninglabs/taproot-assets v0.4.2-0.20240815180811-2110839696cb/go.mod h1:PMlRq9aKXaxs6PMeLnj3y3YnofrylNvEOTxvegTbhSc=
1178+
github.com/lightninglabs/taproot-assets v0.4.2-0.20240823230436-0302f74ce93a h1:0cZ1zVAmmcxN5Zi1ZB3fyGGwtZ9QOABRwvZxKE1tfRs=
1179+
github.com/lightninglabs/taproot-assets v0.4.2-0.20240823230436-0302f74ce93a/go.mod h1:PMlRq9aKXaxs6PMeLnj3y3YnofrylNvEOTxvegTbhSc=
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=
11821182
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240730143253-1b353b0bfd58 h1:qmJAHLGfpeYIl1qUKyQViOjNAVRqF4afKuORzeIAwjA=

itest/litd_custom_channels_test.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,61 @@ func testCustomChannelsForceClose(_ context.Context, net *NetworkHarness,
14031403
// UTXO he can use.
14041404
assertNumAssetUTXOs(t.t, daveTap, 1)
14051405
assertNumAssetUTXOs(t.t, charlieTap, 2)
1406+
1407+
// We'll make sure Dave can spend his asset UTXO by sending it all but
1408+
// one unit to Zane (the universe).
1409+
assetSendAmount := daveBalance - 1
1410+
zaneAddr, err := universeTap.NewAddr(ctxb, &taprpc.NewAddrRequest{
1411+
Amt: assetSendAmount,
1412+
AssetId: assetID,
1413+
ProofCourierAddr: fmt.Sprintf(
1414+
"%s://%s", proof.UniverseRpcCourierType,
1415+
charlieTap.node.Cfg.LitAddr(),
1416+
),
1417+
})
1418+
require.NoError(t.t, err)
1419+
1420+
t.Logf("Sending %v asset from Dave units to Zane...", assetSendAmount)
1421+
1422+
// Send the assets to Zane. We expect Dave to have 3 transfers: the
1423+
// funding txn, their force close sweep, and now this new send.
1424+
itest.AssertAddrCreated(t.t, universeTap, cents, zaneAddr)
1425+
sendResp, err := daveTap.SendAsset(ctxb, &taprpc.SendAssetRequest{
1426+
TapAddrs: []string{zaneAddr.Encoded},
1427+
})
1428+
require.NoError(t.t, err)
1429+
itest.ConfirmAndAssertOutboundTransfer(
1430+
t.t, t.lndHarness.Miner.Client, daveTap, sendResp, assetID,
1431+
[]uint64{1, assetSendAmount}, 2, 3,
1432+
)
1433+
itest.AssertNonInteractiveRecvComplete(t.t, universeTap, 1)
1434+
1435+
// And now we also send all assets but one from Charlie to the universe
1436+
// to make sure the time lock sweep output can also be spent correctly.
1437+
assetSendAmount = charlieBalance - 1
1438+
zaneAddr2, err := universeTap.NewAddr(ctxb, &taprpc.NewAddrRequest{
1439+
Amt: assetSendAmount,
1440+
AssetId: assetID,
1441+
ProofCourierAddr: fmt.Sprintf(
1442+
"%s://%s", proof.UniverseRpcCourierType,
1443+
charlieTap.node.Cfg.LitAddr(),
1444+
),
1445+
})
1446+
require.NoError(t.t, err)
1447+
1448+
t.Logf("Sending %v asset from Charlie units to Zane...",
1449+
assetSendAmount)
1450+
1451+
itest.AssertAddrCreated(t.t, universeTap, cents, zaneAddr2)
1452+
sendResp2, err := charlieTap.SendAsset(ctxb, &taprpc.SendAssetRequest{
1453+
TapAddrs: []string{zaneAddr2.Encoded},
1454+
})
1455+
require.NoError(t.t, err)
1456+
itest.ConfirmAndAssertOutboundTransfer(
1457+
t.t, t.lndHarness.Miner.Client, charlieTap, sendResp2, assetID,
1458+
[]uint64{1, assetSendAmount}, 3, 4,
1459+
)
1460+
itest.AssertNonInteractiveRecvComplete(t.t, universeTap, 2)
14061461
}
14071462

14081463
// testCustomChannelsBreach tests a force close scenario that breaches an old

0 commit comments

Comments
 (0)