Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions itest/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2093,9 +2093,13 @@ func AssertAssetsMinted(t *testing.T, tapClient commands.RpcClientsBundle,
assetList []*taprpc.Asset
)

// List only the assets that were minted in the anchor transaction.
listRespConfirmed, err := tapClient.ListAssets(
ctxt, &taprpc.ListAssetRequest{
ScriptKeyType: allScriptKeysQuery,
AnchorOutpoint: &taprpc.OutPoint{
Txid: mintTXID[:],
},
Comment on lines +2100 to +2102

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The AnchorOutpoint field is being initialized with only a Txid, which means the OutputIndex will default to 0. If the ListAssets RPC handler performs a strict outpoint match, this will fail to find assets if they are anchored in an output other than index 0. While this might work for current test cases, it could lead to flaky tests in the future if minting transactions start using different output indices. It would be more robust to explicitly specify the output index if it's known, or confirm that the RPC handler correctly interprets a zero-value OutputIndex as a wildcard for any output within the transaction. If the output index is not available here, perhaps the ListAssets RPC should be enhanced to filter by txid directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally included an explicit 0 index, but removed it, deeming it superfluous.

},
)
require.NoError(t, err)
Expand Down
3 changes: 3 additions & 0 deletions itest/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ func FinalizeBatchUnconfirmed(t *testing.T, minerClient *rpcclient.Client,
ctxt, &taprpc.ListAssetRequest{
IncludeUnconfirmedMints: true,
ScriptKeyType: allScriptKeysQuery,
AnchorOutpoint: &taprpc.OutPoint{
Txid: hashes[0][:],
},
Comment on lines +456 to +458

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the change in AssertAssetsMinted, this ListAssets call only specifies the Txid for the AnchorOutpoint, causing OutputIndex to default to 0. This could lead to issues if the asset minting output is not at index 0. To make this more robust, it would be better to retrieve and use the correct output index from the batch finalization response, or ensure the ListAssets RPC can filter by transaction ID alone when OutputIndex is zero.

},
)
require.NoError(t, err)
Expand Down
Loading