Skip to content

Commit c5b211e

Browse files
committed
loadtest+itest: add sync mode option to SyncUniverses
1 parent 3a0556c commit c5b211e

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

itest/loadtest/mint_batch_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ func mintTest(t *testing.T, ctx context.Context, cfg *Config) {
167167
})
168168
require.True(t, correctOp)
169169

170-
itest.SyncUniverses(ctx, t, bob, alice, aliceHost, cfg.TestTimeout)
170+
itest.SyncUniverses(
171+
ctx, t, bob, alice, aliceHost, itest.SyncModeIssuance,
172+
cfg.TestTimeout,
173+
)
171174
}
172175

173176
// mintTestV2 checks that we can mint a batch of assets. It is a more

itest/mint_fund_seal_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/lightninglabs/taproot-assets/asset"
2020
"github.com/lightninglabs/taproot-assets/fn"
2121
"github.com/lightninglabs/taproot-assets/internal/test"
22+
"github.com/lightninglabs/taproot-assets/itest"
2223
"github.com/lightninglabs/taproot-assets/proof"
2324
"github.com/lightninglabs/taproot-assets/tappsbt"
2425
"github.com/lightninglabs/taproot-assets/taprpc"
@@ -343,7 +344,7 @@ func testMintFundSealAssets(t *harnessTest) {
343344
// verify that he syncs the assets correctly.
344345
SyncUniverses(
345346
ctxt, t.t, bobTapd, aliceTapd, aliceTapd.rpcHost(),
346-
defaultTimeout,
347+
itest.SyncModeIssuance, defaultTimeout,
347348
)
348349

349350
// If we fetch issuance leaves for the collectible asset group, we

itest/multisig.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ func MultiSigTest(t *testing.T, ctx context.Context, aliceTapd,
7575

7676
var firstBatchGenesis = firstBatch.AssetGenesis
7777

78-
SyncUniverses(ctx, t, bobTapd, aliceTapd, universeHostPort, testTimeout)
78+
SyncUniverses(
79+
ctx, t, bobTapd, aliceTapd, universeHostPort, SyncModeIssuance,
80+
testTimeout,
81+
)
7982

8083
// And now we prepare the multisig addresses for both levels. On the
8184
// BTC level we are going to do a Tapscript based 2-of-2 multisig using

itest/utils.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ var (
4242
regtestParams = &chaincfg.RegressionNetParams
4343
)
4444

45+
const (
46+
SyncModeIssuance = universerpc.UniverseSyncMode_SYNC_ISSUANCE_ONLY
47+
SyncModeFull = universerpc.UniverseSyncMode_SYNC_FULL
48+
)
49+
4550
// ClientEventStream is a generic interface for a client stream that allows us
4651
// to receive events from a server.
4752
type ClientEventStream[T any] interface {
@@ -838,7 +843,7 @@ func MintAssetExternalSigner(t *harnessTest, tapNode *tapdHarness,
838843
// are in sync.
839844
func SyncUniverses(ctx context.Context, t *testing.T, clientTapd,
840845
universeTapd commands.RpcClientsBundle, universeHost string,
841-
timeout time.Duration) {
846+
syncMode universerpc.UniverseSyncMode, timeout time.Duration) {
842847

843848
ctxt, cancel := context.WithTimeout(ctx, timeout)
844849
defer cancel()
@@ -863,10 +868,9 @@ func SyncUniverses(ctx context.Context, t *testing.T, clientTapd,
863868
// If we've already added the server in a previous run, we'll
864869
// just need to kick off a sync (as that would otherwise be done
865870
// by adding the server request already).
866-
mode := universerpc.UniverseSyncMode_SYNC_ISSUANCE_ONLY
867871
_, err := clientTapd.SyncUniverse(ctxt, &universerpc.SyncRequest{
868872
UniverseHost: universeHost,
869-
SyncMode: mode,
873+
SyncMode: syncMode,
870874
})
871875
require.NoError(t, err)
872876
}

0 commit comments

Comments
 (0)