Skip to content

Commit 0198a10

Browse files
committed
itest: add test for duplicate address send
This test demonstrates that we get the correct error when we attempt to send to the same address twice in the same transaction. This also shows that we can re-try normally if a send fails before it was written to disk.
1 parent 75e8264 commit 0198a10

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

itest/send_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/lightninglabs/taproot-assets/taprpc/mintrpc"
1818
"github.com/lightninglabs/taproot-assets/taprpc/tapdevrpc"
1919
unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc"
20+
"github.com/lightninglabs/taproot-assets/tapsend"
2021
"github.com/lightningnetwork/lnd/lntest/wait"
2122
"github.com/stretchr/testify/require"
2223
)
@@ -102,6 +103,16 @@ func testBasicSendUnidirectional(t *harnessTest) {
102103
})
103104
require.NoError(t.t, err)
104105

106+
// Before we start sending, we test that we aren't allowed to send to
107+
// the same address more than once within the same transfer.
108+
_, err = t.tapd.SendAsset(ctxb, &taprpc.SendAssetRequest{
109+
TapAddrs: []string{
110+
bobAddr.Encoded,
111+
bobAddr.Encoded,
112+
},
113+
})
114+
require.ErrorContains(t.t, err, tapsend.ErrDuplicateScriptKeys.Error())
115+
105116
for i := 0; i < numSends; i++ {
106117
t.t.Logf("Performing send procedure: %d", i)
107118

0 commit comments

Comments
 (0)