66
77 "github.com/btcsuite/btcd/btcec/v2"
88 "github.com/btcsuite/btcd/chaincfg/chainhash"
9+ "github.com/btcsuite/btcd/wire"
910 taprootassets "github.com/lightninglabs/taproot-assets"
1011 "github.com/lightninglabs/taproot-assets/fn"
1112 "github.com/lightninglabs/taproot-assets/taprpc"
@@ -48,18 +49,19 @@ func testSupplyCommitMintBurn(t *harnessTest) {
4849 // Update the on-chain supply commitment for the asset group.
4950 //
5051 // TODO(roasbeef): still rely on the time based ticker here?
51- t .Log ("Updating and mining supply commitment for asset group" )
52+ t .Log ("Create first supply commitment tx for asset group" )
5253 UpdateAndMineSupplyCommit (
5354 t .t , ctxb , t .tapd , t .lndHarness .Miner ().Client ,
5455 groupKeyBytes , 1 ,
5556 )
5657
5758 // Fetch the latest supply commitment for the asset group.
58- t .Log ("Fetching supply commitment to verify mint leaves" )
59- fetchResp := WaitForSupplyCommit (
60- t .t , ctxb , t .tapd , groupKeyBytes ,
59+ t .Log ("Fetching first supply commitment to verify mint leaves" )
60+ fetchResp , supplyOutpoint := WaitForSupplyCommit (
61+ t .t , ctxb , t .tapd , groupKeyBytes , fn . None [wire. OutPoint ](),
6162 func (resp * unirpc.FetchSupplyCommitResponse ) bool {
62- return resp .BlockHeight > 0 && len (resp .BlockHash ) > 0
63+ return resp .ChainData .BlockHeight > 0 &&
64+ len (resp .ChainData .BlockHash ) > 0
6365 },
6466 )
6567
@@ -72,7 +74,7 @@ func testSupplyCommitMintBurn(t *harnessTest) {
7274
7375 // Verify the issuance leaf inclusion in the supply tree.
7476 AssertSubtreeInclusionProof (
75- t , fetchResp .SupplyCommitmentRoot . RootHash ,
77+ t , fetchResp .ChainData . SupplyRootHash ,
7678 fetchResp .IssuanceSubtreeRoot ,
7779 )
7880
@@ -106,8 +108,6 @@ func testSupplyCommitMintBurn(t *harnessTest) {
106108 )
107109
108110 t .Log ("Updating supply commitment after second mint" )
109-
110- // Update and mine the supply commitment after second mint.
111111 UpdateAndMineSupplyCommit (
112112 t .t , ctxb , t .tapd , t .lndHarness .Miner ().Client ,
113113 groupKeyBytes , 1 ,
@@ -119,8 +119,8 @@ func testSupplyCommitMintBurn(t *harnessTest) {
119119 expectedTotal := int64 (
120120 mintReq .Asset .Amount + secondMintReq .Asset .Amount ,
121121 )
122- fetchResp = WaitForSupplyCommit (
123- t .t , ctxb , t .tapd , groupKeyBytes ,
122+ fetchResp , supplyOutpoint = WaitForSupplyCommit (
123+ t .t , ctxb , t .tapd , groupKeyBytes , fn . Some ( supplyOutpoint ),
124124 func (resp * unirpc.FetchSupplyCommitResponse ) bool {
125125 return resp .IssuanceSubtreeRoot != nil &&
126126 resp .IssuanceSubtreeRoot .RootNode .RootSum == expectedTotal //nolint:lll
@@ -175,7 +175,8 @@ func testSupplyCommitMintBurn(t *harnessTest) {
175175 t .Log ("Verifying supply tree includes burn leaves" )
176176
177177 // Fetch and verify the supply tree now includes burn leaves.
178- fetchResp = WaitForSupplyCommit (t .t , ctxb , t .tapd , groupKeyBytes ,
178+ fetchResp , _ = WaitForSupplyCommit (
179+ t .t , ctxb , t .tapd , groupKeyBytes , fn .Some (supplyOutpoint ),
179180 func (resp * unirpc.FetchSupplyCommitResponse ) bool {
180181 return resp .BurnSubtreeRoot != nil &&
181182 resp .BurnSubtreeRoot .RootNode .RootSum == int64 (burnAmt ) //nolint:lll
@@ -184,7 +185,7 @@ func testSupplyCommitMintBurn(t *harnessTest) {
184185
185186 // Verify the burn subtree inclusion in the supply tree.
186187 AssertSubtreeInclusionProof (
187- t , fetchResp .SupplyCommitmentRoot . RootHash ,
188+ t , fetchResp .ChainData . SupplyRootHash ,
188189 fetchResp .BurnSubtreeRoot ,
189190 )
190191
@@ -234,16 +235,16 @@ func testSupplyCommitMintBurn(t *harnessTest) {
234235 block := finalMinedBlocks [0 ]
235236 blockHash , _ := t .lndHarness .Miner ().GetBestBlock ()
236237
237- fetchBlockHash , err := chainhash .NewHash (fetchResp .BlockHash )
238+ fetchBlockHash , err := chainhash .NewHash (fetchResp .ChainData . BlockHash )
238239 require .NoError (t .t , err )
239240 require .True (t .t , fetchBlockHash .IsEqual (blockHash ))
240241
241242 // Re-compute the supply commitment root hash from the latest fetch,
242243 // then use that to derive the expected commitment output.
243244 supplyCommitRootHash := fn.ToArray [[32 ]byte ](
244- fetchResp .SupplyCommitmentRoot . RootHash ,
245+ fetchResp .ChainData . SupplyRootHash ,
245246 )
246- internalKey , err := btcec .ParsePubKey (fetchResp .AnchorTxOutInternalKey )
247+ internalKey , err := btcec .ParsePubKey (fetchResp .ChainData . InternalKey )
247248 require .NoError (t .t , err )
248249 expectedTxOut , _ , err := supplycommit .RootCommitTxOut (
249250 internalKey , nil , supplyCommitRootHash ,
0 commit comments