Skip to content

Commit 23ddf52

Browse files
ffranrjtobin
authored andcommitted
tapdb+tapgarden: replace RandSeedlingMintingBatch with RandMintingBatch
RandSeedlingMintingBatch retires.
1 parent b579cb4 commit 23ddf52

File tree

2 files changed

+15
-28
lines changed

2 files changed

+15
-28
lines changed

tapdb/asset_minting_test.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,9 @@ func TestCommitMintingBatchSeedlings(t *testing.T) {
504504
// First, we'll write a new minting batch to disk, including an
505505
// internal key and a set of seedlings. One random seedling will
506506
// be a reissuance into a specific group.
507-
mintingBatch := tapgarden.RandSeedlingMintingBatch(t, numSeedlings)
507+
mintingBatch := tapgarden.RandMintingBatch(
508+
t, tapgarden.WithTotalSeedlings(numSeedlings),
509+
)
508510
_, randGroup, _ := addRandGroupToBatch(
509511
t, assetStore, ctx, mintingBatch.Seedlings,
510512
)
@@ -605,7 +607,9 @@ func TestCommitMintingBatchSeedlings(t *testing.T) {
605607

606608
// Insert another normal batch into the database. We should get this
607609
// batch back if we query for the set of non-final batches.
608-
mintingBatch = tapgarden.RandSeedlingMintingBatch(t, numSeedlings)
610+
mintingBatch = tapgarden.RandMintingBatch(
611+
t, tapgarden.WithTotalSeedlings(numSeedlings),
612+
)
609613
err = assetStore.CommitMintingBatch(ctx, mintingBatch)
610614
require.NoError(t, err)
611615
mintingBatches = noError1(t, assetStore.FetchNonFinalBatches, ctx)
@@ -852,7 +856,9 @@ func TestAddSproutsToBatch(t *testing.T) {
852856

853857
// First, we'll create a new batch, then add some sample seedlings.
854858
// One random seedling will be a reissuance into a specific group.
855-
mintingBatch := tapgarden.RandSeedlingMintingBatch(t, numSeedlings)
859+
mintingBatch := tapgarden.RandMintingBatch(
860+
t, tapgarden.WithTotalSeedlings(numSeedlings),
861+
)
856862
_, seedlingGroups, _ := addRandGroupToBatch(
857863
t, assetStore, ctx, mintingBatch.Seedlings,
858864
)
@@ -950,7 +956,9 @@ type randAssetCtx struct {
950956
func addRandAssets(t *testing.T, ctx context.Context,
951957
assetStore *AssetMintingStore, numAssets int) randAssetCtx {
952958

953-
mintingBatch := tapgarden.RandSeedlingMintingBatch(t, numAssets)
959+
mintingBatch := tapgarden.RandMintingBatch(
960+
t, tapgarden.WithTotalSeedlings(numAssets),
961+
)
954962
genAmt, seedlingGroups, group := addRandGroupToBatch(
955963
t, assetStore, ctx, mintingBatch.Seedlings,
956964
)
@@ -1464,7 +1472,9 @@ func TestGroupAnchors(t *testing.T) {
14641472
// internal key and a set of seedlings. One random seedling will
14651473
// be a reissuance into a specific group. Two other seedlings will form
14661474
// a multi-asset group.
1467-
mintingBatch := tapgarden.RandSeedlingMintingBatch(t, numSeedlings)
1475+
mintingBatch := tapgarden.RandMintingBatch(
1476+
t, tapgarden.WithTotalSeedlings(numSeedlings),
1477+
)
14681478
_, seedlingGroups, _ := addRandGroupToBatch(
14691479
t, assetStore, ctx, mintingBatch.Seedlings,
14701480
)

tapgarden/mock.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -323,29 +323,6 @@ func RandSeedlings(t testing.TB, numSeedlings int) map[string]*Seedling {
323323
return seedlings
324324
}
325325

326-
// RandSeedlingMintingBatch creates a new minting batch with only random
327-
// seedlings populated for testing.
328-
//
329-
// TODO(ffranr): Replace this function with RandMintingBatch. Note also function
330-
// addRandGroupToBatch.
331-
func RandSeedlingMintingBatch(t testing.TB, numSeedlings int) *MintingBatch {
332-
genesisTx := NewGenesisTx(t, chainfee.FeePerKwFloor)
333-
BatchKey, _ := test.RandKeyDesc(t)
334-
return &MintingBatch{
335-
BatchKey: BatchKey,
336-
Seedlings: RandSeedlings(t, numSeedlings),
337-
HeightHint: test.RandInt[uint32](),
338-
CreationTime: time.Now(),
339-
GenesisPacket: &FundedMintAnchorPsbt{
340-
FundedPsbt: tapsend.FundedPsbt{
341-
Pkt: &genesisTx,
342-
ChangeOutputIndex: 1,
343-
},
344-
AssetAnchorOutIdx: 0,
345-
},
346-
}
347-
}
348-
349326
type MockWalletAnchor struct {
350327
FundPsbtSignal chan *tapsend.FundedPsbt
351328
SignPsbtSignal chan struct{}

0 commit comments

Comments
 (0)