Skip to content

Commit

Permalink
itest: add test for duplicate address send
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guggero committed Nov 8, 2024
1 parent 162a8e1 commit a5b8c98
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions itest/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/lightninglabs/taproot-assets/taprpc/mintrpc"
"github.com/lightninglabs/taproot-assets/taprpc/tapdevrpc"
unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc"
"github.com/lightninglabs/taproot-assets/tapsend"
"github.com/lightningnetwork/lnd/lntest/wait"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -102,6 +103,16 @@ func testBasicSendUnidirectional(t *harnessTest) {
})
require.NoError(t.t, err)

// Before we start sending, we test that we aren't allowed to send to
// the same address more than once within the same transfer.
_, err = t.tapd.SendAsset(ctxb, &taprpc.SendAssetRequest{
TapAddrs: []string{
bobAddr.Encoded,
bobAddr.Encoded,
},
})
require.ErrorContains(t.t, err, tapsend.ErrDuplicateScriptKeys.Error())

for i := 0; i < numSends; i++ {
t.t.Logf("Performing send procedure: %d", i)

Expand Down

0 comments on commit a5b8c98

Please sign in to comment.