Skip to content

Commit c8ba79f

Browse files
committed
itest: skip preliminary proof courier check in multiple instances
Several integration tests target the repeated proof transfer stage of the asset send process. To facilitate this, the proof courier is intentionally kept down until the anchor transaction is broadcast. To support this behavior, this commit disables (in some instances) the preliminary proof courier connection check introduced in a previous commit.
1 parent 25b2df7 commit c8ba79f

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-8
lines changed

itest/addrs_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,9 @@ func transferProofNormalExportUniInsert(t *harnessTest, src, dst *tapdHarness,
912912
// sendOptions is a struct that holds a SendAssetRequest and an
913913
// optional error string that should be tested against.
914914
type sendOptions struct {
915-
sendAssetRequest taprpc.SendAssetRequest
916-
errText string
915+
sendAssetRequest taprpc.SendAssetRequest
916+
skipProofCourierPingCheck bool
917+
errText string
917918
}
918919

919920
// sendOption is a functional option for configuring the sendAssets call.
@@ -931,6 +932,14 @@ func withReceiverAddresses(addrs ...*taprpc.Addr) sendOption {
931932
}
932933
}
933934

935+
// withSkipProofCourierPingCheck is an option to skip the proof courier ping
936+
// check. This is useful for testing purposes.
937+
func withSkipProofCourierPingCheck() sendOption {
938+
return func(options *sendOptions) {
939+
options.skipProofCourierPingCheck = true
940+
}
941+
}
942+
934943
// withFeeRate is an option to specify the fee rate for the send.
935944
func withFeeRate(feeRate uint32) sendOption {
936945
return func(options *sendOptions) {
@@ -999,6 +1008,11 @@ func sendAsset(t *harnessTest, sender *tapdHarness,
9991008
},
10001009
}
10011010

1011+
// Apply the skip proof courier ping check option if set.
1012+
if options.skipProofCourierPingCheck {
1013+
options.sendAssetRequest.SkipProofCourierPingCheck = true
1014+
}
1015+
10021016
// Kick off the send asset request.
10031017
resp, err := sender.SendAsset(ctxt, &options.sendAssetRequest)
10041018
if options.errText != "" {

itest/send_test.go

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,13 @@ func testReattemptFailedSendHashmailCourier(t *harnessTest) {
738738
require.NoError(t.t, t.tapd.stop(false))
739739

740740
// Send asset and then mine to confirm the associated on-chain tx.
741-
sendAssetsToAddr(t, sendTapd, recvAddr)
741+
//
742+
// We skip the proof courier ping check so that we can ensure that proof
743+
// transfer is reattempted.
744+
sendAsset(
745+
t, sendTapd, withReceiverAddresses(recvAddr),
746+
withSkipProofCourierPingCheck(),
747+
)
742748
_ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)
743749

744750
// Define a target event selector to match the backoff wait
@@ -842,7 +848,10 @@ func testReattemptProofTransferOnTapdRestart(t *harnessTest) {
842848
// Start asset transfer and then mine to confirm the associated on-chain
843849
// tx. The on-chain tx should be mined successfully, but we expect the
844850
// asset proof transfer to be unsuccessful.
845-
sendResp, _ := sendAssetsToAddr(t, sendTapd, recvAddr)
851+
sendResp, _ := sendAsset(
852+
t, sendTapd, withReceiverAddresses(recvAddr),
853+
withSkipProofCourierPingCheck(),
854+
)
846855
MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)
847856

848857
// Define a target event selector to match the backoff wait
@@ -997,7 +1006,13 @@ func testReattemptFailedSendUniCourier(t *harnessTest) {
9971006
require.NoError(t.t, t.proofCourier.Stop())
9981007

9991008
// Send asset and then mine to confirm the associated on-chain tx.
1000-
sendAssetsToAddr(t, sendTapd, recvAddr)
1009+
//
1010+
// We skip the proof courier ping check so that we can ensure that proof
1011+
// transfer is reattempted.
1012+
sendAsset(
1013+
t, sendTapd, withReceiverAddresses(recvAddr),
1014+
withSkipProofCourierPingCheck(),
1015+
)
10011016
_ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)
10021017

10031018
// Define a target event selector to match the backoff wait
@@ -1009,7 +1024,7 @@ func testReattemptFailedSendUniCourier(t *harnessTest) {
10091024
// Expected number of events is one less than the number of
10101025
// tries because the first attempt does not count as a backoff
10111026
// event.
1012-
nodeBackoffCfg := sendTapd.clientCfg.HashMailCourier.BackoffCfg
1027+
nodeBackoffCfg := sendTapd.clientCfg.UniverseRpcCourier.BackoffCfg
10131028
expectedEventCount := nodeBackoffCfg.NumTries - 1
10141029

10151030
// Context timeout scales with expected number of events.
@@ -1104,7 +1119,10 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) {
11041119
// Start asset transfer and then mine to confirm the associated on-chain
11051120
// tx. The on-chain tx should be mined successfully, but we expect the
11061121
// asset proof transfer to be unsuccessful.
1107-
sendAssetsToAddr(t, sendTapd, recvAddr)
1122+
sendAsset(
1123+
t, sendTapd, withReceiverAddresses(recvAddr),
1124+
withSkipProofCourierPingCheck(),
1125+
)
11081126
MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)
11091127

11101128
// There may be a delay between mining the anchoring transaction and
@@ -1178,7 +1196,10 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) {
11781196
require.NoError(t.t, err)
11791197
AssertAddrCreated(t.t, recvTapd, rpcAssets[0], recvAddr)
11801198

1181-
sendAssetsToAddr(t, sendTapd, recvAddr)
1199+
sendAsset(
1200+
t, sendTapd, withReceiverAddresses(recvAddr),
1201+
withSkipProofCourierPingCheck(),
1202+
)
11821203
MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)
11831204

11841205
// There may be a delay between mining the anchoring transaction and

0 commit comments

Comments
 (0)