Skip to content

Commit 19d9072

Browse files
committed
tapdb: only select confirmed assets when funding
To avoid attempting to spend freshly minted assets that haven't been confirmed yet, we set the minimum anchor height to 1 to avoid selecting them when funding any transaction.
1 parent 500f80d commit 19d9072

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tapdb/assets_store.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,11 @@ func (a *AssetStore) ListEligibleCoins(ctx context.Context,
18231823
assetFilter.Spent = sqlBool(false)
18241824
assetFilter.Leased = sqlBool(false)
18251825

1826+
// We also only want to select confirmed commitments (freshly minted
1827+
// unconfirmed assets would otherwise be included). Unconfirmed assets
1828+
// have a block height of 0, so we set the minimum block height to 1.
1829+
assetFilter.MinAnchorHeight = sqlInt32(1)
1830+
18261831
return a.queryCommitments(ctx, assetFilter)
18271832
}
18281833

0 commit comments

Comments
 (0)