@@ -66,9 +66,11 @@ func testFeeEstimation(t *harnessTest) {
6666 rpcAssets := MintAssetsConfirmBatch (
6767 t .t , t .lndHarness .Miner ().Client , t .tapd , simpleAssets ,
6868 )
69+ normalAsset := rpcAssets [0 ]
70+ normalAssetId := normalAsset .AssetGenesis .AssetId
6971
7072 // Check the final fee rate of the mint TX.
71- rpcMintOutpoint := rpcAssets [ 0 ] .ChainAnchor .AnchorOutpoint
73+ rpcMintOutpoint := normalAsset .ChainAnchor .AnchorOutpoint
7274 mintOutpoint , err := wire .NewOutPointFromString (rpcMintOutpoint )
7375 require .NoError (t .t , err )
7476
@@ -81,16 +83,15 @@ func testFeeEstimation(t *harnessTest) {
8183 )
8284
8385 // Split the normal asset to create a transfer with two anchor outputs.
84- normalAssetId := rpcAssets [0 ].AssetGenesis .AssetId
85- splitAmount := rpcAssets [0 ].Amount / 2
86+ splitAmount := normalAsset .Amount / 2
8687 addr , stream := NewAddrWithEventStream (
8788 t .t , t .tapd , & taprpc.NewAddrRequest {
8889 AssetId : normalAssetId ,
8990 Amt : splitAmount ,
9091 },
9192 )
9293
93- AssertAddrCreated (t .t , t .tapd , rpcAssets [ 0 ] , addr )
94+ AssertAddrCreated (t .t , t .tapd , normalAsset , addr )
9495 sendResp , sendEvents := sendAssetsToAddr (t , t .tapd , addr )
9596
9697 transferIdx := 0
@@ -121,7 +122,7 @@ func testFeeEstimation(t *harnessTest) {
121122 },
122123 )
123124
124- AssertAddrCreated (t .t , t .tapd , rpcAssets [ 0 ] , addr2 )
125+ AssertAddrCreated (t .t , t .tapd , normalAsset , addr2 )
125126 sendResp , sendEvents = sendAssetsToAddr (t , t .tapd , addr2 )
126127
127128 ConfirmAndAssertOutboundTransfer (
@@ -157,7 +158,7 @@ func testFeeEstimation(t *harnessTest) {
157158 []* UTXORequest {initialUTXOs [3 ]},
158159 )
159160
160- AssertAddrCreated (t .t , t .tapd , rpcAssets [ 0 ] , addr3 )
161+ AssertAddrCreated (t .t , t .tapd , normalAsset , addr3 )
161162 _ , err = t .tapd .SendAsset (ctxt , & taprpc.SendAssetRequest {
162163 TapAddrs : []string {addr3 .Encoded },
163164 })
@@ -166,23 +167,24 @@ func testFeeEstimation(t *harnessTest) {
166167 )
167168
168169 // The transfer should also be rejected if the manually-specified
169- // feerate fails the sanity check against the fee estimator's fee floor
170+ // fee rate fails the sanity check against the fee estimator's fee floor
170171 // of 253 sat/kw, or 1.012 sat/vB.
171172 _ , err = t .tapd .SendAsset (ctxt , & taprpc.SendAssetRequest {
172173 TapAddrs : []string {addr3 .Encoded },
173174 FeeRate : uint32 (chainfee .FeePerKwFloor ) - 1 ,
174175 })
175176 require .ErrorContains (t .t , err , "manual fee rate below floor" )
176177
177- // After failure at the high feerate , we should still be able to make a
178- // transfer at a very low feerate .
178+ // After failure at the high fee rate , we should still be able to make a
179+ // transfer at a very low fee rate .
179180 t .lndHarness .SetFeeEstimateWithConf (lowFeeRate , 6 )
180181 sendResp , sendEvents = sendAssetsToAddr (t , t .tapd , addr3 )
181182
182183 ConfirmAndAssertOutboundTransfer (
183184 t .t , t .lndHarness .Miner ().Client , t .tapd , sendResp ,
184- normalAssetId , []uint64 {thirdSplitAmount , thirdSplitAmount },
185- transferIdx , transferIdx + 1 ,
185+ normalAssetId , []uint64 {
186+ splitAmount - thirdSplitAmount , thirdSplitAmount ,
187+ }, transferIdx , transferIdx + 1 ,
186188 )
187189 transferIdx += 1
188190 AssertNonInteractiveRecvComplete (t .t , t .tapd , transferIdx )
0 commit comments