Skip to content

Commit 40cec8c

Browse files
committed
itest: remove manual proof transfer for addr sends
With this commit we remove all instances of the manual proof transfer from call sites that do an actual non-interactive (address based) transfer, for which a proof courier should now handle the proof transmission.
1 parent d24c029 commit 40cec8c

File tree

8 files changed

+31
-70
lines changed

8 files changed

+31
-70
lines changed

itest/addrs_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ func testAddresses(t *harnessTest) {
7979
// Eventually the event should be marked as confirmed.
8080
AssertAddrEvent(t.t, secondTapd, addr, 1, statusConfirmed)
8181

82-
// To complete the transfer, we'll export the proof from the
83-
// sender and import it into the receiver for each asset set.
84-
sendProof(
85-
t, t.tapd, secondTapd, addr.ScriptKey, a.AssetGenesis,
86-
)
87-
8882
// Make sure we have imported and finalized all proofs.
8983
AssertNonInteractiveRecvComplete(t.t, secondTapd, idx+1)
9084

@@ -436,21 +430,18 @@ func runMultiSendTest(ctxt context.Context, t *harnessTest, alice,
436430

437431
// In order to force a split, we don't try to send the full asset.
438432
const sendAmt = 100
439-
var bobAddresses []*taprpc.Addr
440433
bobAddr1, err := bob.NewAddr(ctxt, &taprpc.NewAddrRequest{
441434
AssetId: genInfo.AssetId,
442435
Amt: sendAmt,
443436
})
444437
require.NoError(t.t, err)
445-
bobAddresses = append(bobAddresses, bobAddr1)
446438
AssertAddrCreated(t.t, bob, mintedAsset, bobAddr1)
447439

448440
bobAddr2, err := bob.NewAddr(ctxt, &taprpc.NewAddrRequest{
449441
AssetId: genInfo.AssetId,
450442
Amt: sendAmt,
451443
})
452444
require.NoError(t.t, err)
453-
bobAddresses = append(bobAddresses, bobAddr2)
454445
AssertAddrCreated(t.t, bob, mintedAsset, bobAddr2)
455446

456447
// To test that Alice can also receive to multiple addresses in a single
@@ -492,14 +483,6 @@ func runMultiSendTest(ctxt context.Context, t *harnessTest, alice,
492483
// this point, so the status should go to completed directly.
493484
AssertAddrEventByStatus(t.t, alice, statusCompleted, numRuns*2)
494485

495-
// To complete the transfer, we'll export the proof from the sender and
496-
// import it into the receiver for each asset set. This should not be
497-
// necessary for the sends to Alice, as she is both the sender and
498-
// receiver and should detect the local proof once it's written to disk.
499-
for i := range bobAddresses {
500-
sendProof(t, alice, bob, bobAddresses[i].ScriptKey, genInfo)
501-
}
502-
503486
// Make sure we have imported and finalized all proofs.
504487
AssertNonInteractiveRecvComplete(t.t, bob, numRuns*2)
505488
AssertNonInteractiveRecvComplete(t.t, alice, numRuns*2)

itest/full_value_split_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ func runFullValueSendTests(ctxt context.Context, t *harnessTest, alice,
8888
[]uint64{0, fullAmount}, senderTransferIdx,
8989
senderTransferIdx+1,
9090
)
91-
_ = sendProof(
92-
t, alice, bob, receiverAddr.ScriptKey, genInfo,
91+
AssertNonInteractiveRecvComplete(
92+
t.t, bob, senderTransferIdx+1,
9393
)
9494
senderTransferIdx++
9595
} else {
@@ -108,8 +108,8 @@ func runFullValueSendTests(ctxt context.Context, t *harnessTest, alice,
108108
genInfo.AssetId, []uint64{0, fullAmount},
109109
receiverTransferIdx, receiverTransferIdx+1,
110110
)
111-
_ = sendProof(
112-
t, bob, alice, receiverAddr.ScriptKey, genInfo,
111+
AssertNonInteractiveRecvComplete(
112+
t.t, alice, receiverTransferIdx+1,
113113
)
114114
receiverTransferIdx++
115115
}

itest/multi_asset_group_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ func testMintMultiAssetGroups(t *harnessTest) {
129129
normalMember.AssetGenesis.AssetId,
130130
[]uint64{0, normalMember.Amount}, 0, 1,
131131
)
132-
_ = sendProof(
133-
t, t.tapd, secondTapd, bobNormalAddr.ScriptKey,
134-
normalMemberGenInfo,
135-
)
136132
AssertNonInteractiveRecvComplete(t.t, secondTapd, 1)
137133

138134
AssertBalanceByGroup(
@@ -170,10 +166,6 @@ func testMintMultiAssetGroups(t *harnessTest) {
170166
collectMember.AssetGenesis.AssetId,
171167
[]uint64{0, collectMember.Amount}, 1, 2,
172168
)
173-
sendProof(
174-
t, t.tapd, secondTapd, bobCollectAddr.ScriptKey,
175-
collectMemberGenInfo,
176-
)
177169
AssertNonInteractiveRecvComplete(t.t, secondTapd, 2)
178170

179171
AssertBalanceByGroup(

itest/psbt_test.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func testPsbtScriptHashLockSend(t *harnessTest) {
132132
t.t, t.lndHarness.Miner.Client, bob, sendResp,
133133
genInfo.AssetId, []uint64{numUnits / 2, numUnits / 2}, 0, 1,
134134
)
135+
136+
// This is an interactive/PSBT based transfer, so we do need to manually
137+
// send the proof from the sender to the receiver because the proof
138+
// courier address gets lost in the address->PSBT conversion.
135139
_ = sendProof(t, bob, alice, aliceAddr.ScriptKey, genInfo)
136140
AssertNonInteractiveRecvComplete(t.t, alice, 1)
137141

@@ -258,6 +262,10 @@ func testPsbtScriptCheckSigSend(t *harnessTest) {
258262
t.t, t.lndHarness.Miner.Client, bob, sendResp,
259263
genInfo.AssetId, []uint64{numUnits / 2, numUnits / 2}, 0, 1,
260264
)
265+
266+
// This is an interactive/PSBT based transfer, so we do need to manually
267+
// send the proof from the sender to the receiver because the proof
268+
// courier address gets lost in the address->PSBT conversion.
261269
_ = sendProof(t, bob, alice, aliceAddr.ScriptKey, genInfo)
262270
AssertNonInteractiveRecvComplete(t.t, alice, 1)
263271

@@ -438,6 +446,9 @@ func runPsbtInteractiveFullValueSendTest(ctxt context.Context, t *harnessTest,
438446
sendResp, genInfo.AssetId, amounts, i/2, (i/2)+1,
439447
numOutputs,
440448
)
449+
450+
// This is an interactive transfer, so we do need to manually
451+
// send the proof from the sender to the receiver.
441452
_ = sendProof(
442453
t, sender, receiver,
443454
receiverScriptKey.PubKey.SerializeCompressed(), genInfo,
@@ -656,6 +667,9 @@ func runPsbtInteractiveSplitSendTest(ctxt context.Context, t *harnessTest,
656667
[]uint64{sendAmt, changeAmt}, i/2, (i/2)+1,
657668
numOutputs,
658669
)
670+
671+
// This is an interactive transfer, so we do need to manually
672+
// send the proof from the sender to the receiver.
659673
_ = sendProof(
660674
t, sender, receiver,
661675
receiverScriptKey.PubKey.SerializeCompressed(), genInfo,
@@ -779,6 +793,9 @@ func testPsbtInteractiveTapscriptSibling(t *harnessTest) {
779793
t.t, t.lndHarness.Miner.Client, alice, sendResp,
780794
genInfo.AssetId, []uint64{sendAmt, changeAmt}, 0, 1, 2,
781795
)
796+
797+
// This is an interactive transfer, so we do need to manually send the
798+
// proof from the sender to the receiver.
782799
_ = sendProof(
783800
t, alice, bob,
784801
receiverScriptKey.PubKey.SerializeCompressed(), genInfo,
@@ -927,6 +944,9 @@ func testPsbtMultiSend(t *harnessTest) {
927944
t.t, t.lndHarness.Miner.Client, sender, sendResp,
928945
genInfo.AssetId, outputAmounts, 0, 1, numOutputs,
929946
)
947+
948+
// This is an interactive transfer, so we do need to manually send the
949+
// proof from the sender to the receiver.
930950
_ = sendProof(
931951
t, sender, receiver,
932952
receiverScriptKey1.PubKey.SerializeCompressed(), genInfo,
@@ -1034,7 +1054,6 @@ func sendToTapscriptAddr(ctx context.Context, t *harnessTest, alice,
10341054
t.t, t.lndHarness.Miner.Client, alice, sendResp,
10351055
genInfo.AssetId, []uint64{changeUnits, numUnits}, 0, 1,
10361056
)
1037-
_ = sendProof(t, alice, bob, bobAddr.ScriptKey, genInfo)
10381057
AssertNonInteractiveRecvComplete(t.t, bob, 1)
10391058
}
10401059

@@ -1059,7 +1078,6 @@ func sendAssetAndAssert(ctx context.Context, t *harnessTest, alice,
10591078
genInfo.AssetId, []uint64{change, numUnits}, outTransferIdx,
10601079
numOutTransfers,
10611080
)
1062-
_ = sendProof(t, alice, bob, bobAddr.ScriptKey, genInfo)
10631081

10641082
// There are now two receive events (since only non-interactive sends
10651083
// appear in that RPC output).

itest/re-issuance_test.go

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ func testReIssuance(t *harnessTest) {
7878
t.t, t.lndHarness.Miner.Client, t.tapd, firstCollectSend,
7979
collectGenInfo.AssetId, []uint64{0, 1}, 0, 1,
8080
)
81-
sendProof(
82-
t, t.tapd, secondTapd, collectGroupAddr.ScriptKey,
83-
collectGenInfo,
84-
)
81+
AssertNonInteractiveRecvComplete(t.t, secondTapd, 1)
8582

8683
// Check the state of both nodes. The first node should show one
8784
// zero-value transfer representing the send of the collectible.
@@ -107,10 +104,7 @@ func testReIssuance(t *harnessTest) {
107104
normalGenInfo.AssetId,
108105
[]uint64{normalGroupMintHalf, normalGroupMintHalf}, 1, 2,
109106
)
110-
sendProof(
111-
t, t.tapd, secondTapd, normalGroupAddr.ScriptKey,
112-
normalGenInfo,
113-
)
107+
AssertNonInteractiveRecvComplete(t.t, secondTapd, 2)
114108

115109
// Reissue one more collectible and half the original mint amount for
116110
// the normal asset.
@@ -186,10 +180,7 @@ func testReIssuance(t *harnessTest) {
186180
t.t, t.lndHarness.Miner.Client, t.tapd, secondCollectSend,
187181
collectReissueInfo.AssetId, []uint64{0, 1}, 2, 3,
188182
)
189-
sendProof(
190-
t, t.tapd, secondTapd, collectReissueAddr.ScriptKey,
191-
collectReissueInfo,
192-
)
183+
AssertNonInteractiveRecvComplete(t.t, secondTapd, 3)
193184

194185
// The second node should show two groups, with two assets in
195186
// the collectible group and a total balance of 2 for that group.
@@ -220,10 +211,7 @@ func testReIssuance(t *harnessTest) {
220211
t.t, secondTapd.ht.lndHarness.Miner.Client, secondTapd,
221212
thirdCollectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1,
222213
)
223-
sendProof(
224-
t, secondTapd, t.tapd, collectReissueAddr.ScriptKey,
225-
collectReissueInfo,
226-
)
214+
AssertNonInteractiveRecvComplete(t.t, t.tapd, 1)
227215

228216
// The collectible balance on the minting node should be 1, and there
229217
// should still be only two groups.
@@ -382,12 +370,8 @@ func testMintWithGroupKeyErrors(t *harnessTest) {
382370
t.t, t.lndHarness.Miner.Client, t.tapd, collectSend,
383371
collectGenInfo.AssetId, []uint64{0, 1}, 0, 1,
384372
)
385-
sendProof(
386-
t, t.tapd, secondTapd, collectGroupAddr.ScriptKey,
387-
collectGenInfo,
388-
)
389373

390-
// A reissuance with the second node should still fail because the
374+
// A re-issuance with the second node should still fail because the
391375
// group key was not created by that node.
392376
_, err = secondTapd.MintAsset(ctxb, reissueRequest)
393377
require.ErrorContains(t.t, err, "can't sign with group key")

itest/re-org_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ func testReOrgSend(t *harnessTest) {
170170
sendAssetGen.AssetId,
171171
[]uint64{sendAsset.Amount - sendAmount, sendAmount}, 0, 1,
172172
)
173-
_ = sendProof(
174-
t, t.tapd, secondTapd, bobAddr.ScriptKey, sendAssetGen,
175-
)
176173
AssertNonInteractiveRecvComplete(t.t, secondTapd, 1)
177174
initialBlockHash := initialBlock.BlockHash()
178175

@@ -291,9 +288,6 @@ func testReOrgMintAndSend(t *harnessTest) {
291288
sendAssetGen.AssetId,
292289
[]uint64{sendAsset.Amount - sendAmount, sendAmount}, 0, 1,
293290
)
294-
_ = sendProof(
295-
t, t.tapd, secondTapd, bobAddr.ScriptKey, sendAssetGen,
296-
)
297291
AssertNonInteractiveRecvComplete(t.t, secondTapd, 1)
298292
initialBlockHash := initialBlock.BlockHash()
299293

itest/round_trip_send_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"context"
66
"encoding/hex"
7-
"time"
87

98
"github.com/btcsuite/btcd/btcec/v2"
109
"github.com/btcsuite/btcd/btcutil"
@@ -81,7 +80,7 @@ func testRoundTripSend(t *harnessTest) {
8180
t.t, t.lndHarness.Miner.Client, t.tapd, sendResp,
8281
genInfo.AssetId, []uint64{bobAmt, bobAmt}, 0, 1,
8382
)
84-
_ = sendProof(t, t.tapd, secondTapd, bobAddr.ScriptKey, genInfo)
83+
AssertNonInteractiveRecvComplete(t.t, secondTapd, 1)
8584

8685
// Now, Alice will request half of the assets she sent to Bob.
8786
aliceAddr, err := t.tapd.NewAddr(ctxb, &taprpc.NewAddrRequest{
@@ -101,10 +100,7 @@ func testRoundTripSend(t *harnessTest) {
101100
t.t, t.lndHarness.Miner.Client, secondTapd,
102101
sendResp, genInfo.AssetId, []uint64{aliceAmt, aliceAmt}, 0, 1,
103102
)
104-
_ = sendProof(t, secondTapd, t.tapd, aliceAddr.ScriptKey, genInfo)
105-
106-
// Give both nodes some time to process the final transfer.
107-
time.Sleep(time.Second * 1)
103+
AssertNonInteractiveRecvComplete(t.t, t.tapd, 1)
108104

109105
// Check the final state of both nodes. Each node should list
110106
// one transfer, and Alice should have 3/4 of the total units.

itest/send_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,6 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) {
12401240
genInfo.AssetId, []uint64{4000, 1000}, 0, 1,
12411241
)
12421242

1243-
_ = sendProof(t, t.tapd, bobTapd, addr.ScriptKey, genInfo)
12441243
AssertNonInteractiveRecvComplete(t.t, bobTapd, 1)
12451244

12461245
// Second of two send events from minting node to the secondary node.
@@ -1261,7 +1260,6 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) {
12611260
genInfo.AssetId, []uint64{0, 4000}, 1, 2,
12621261
)
12631262

1264-
_ = sendProof(t, t.tapd, bobTapd, addr.ScriptKey, genInfo)
12651263
AssertNonInteractiveRecvComplete(t.t, bobTapd, 2)
12661264

12671265
t.Logf("Two separate send events complete, now attempting to send " +
@@ -1285,7 +1283,6 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) {
12851283
genInfo.AssetId, []uint64{0, 5000}, 0, 1,
12861284
)
12871285

1288-
_ = sendProof(t, bobTapd, t.tapd, addr.ScriptKey, genInfo)
12891286
AssertNonInteractiveRecvComplete(t.t, t.tapd, 1)
12901287
}
12911288

@@ -1388,9 +1385,6 @@ func testSendMultipleCoins(t *harnessTest) {
13881385
// Now we confirm the 5 transfers and make sure they complete as
13891386
// expected.
13901387
_ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 5)
1391-
for _, addr := range bobAddrs {
1392-
_ = sendProof(t, t.tapd, secondTapd, addr.ScriptKey, genInfo)
1393-
}
13941388
AssertNonInteractiveRecvComplete(t.t, secondTapd, 5)
13951389
}
13961390

0 commit comments

Comments
 (0)