Skip to content

Commit b76189f

Browse files
committed
tapdb: refactor randProof such that it optionally uses a provided asset
1 parent 078cdb6 commit b76189f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tapdb/universe_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ func randLeafKey(t *testing.T) universe.LeafKey {
129129
}
130130
}
131131

132-
func randProof(t *testing.T) *proof.Proof {
132+
func randProof(t *testing.T, argAsset *asset.Asset) *proof.Proof {
133+
proofAsset := *asset.RandAsset(t, asset.Normal)
134+
if argAsset != nil {
135+
proofAsset = *argAsset
136+
}
137+
133138
return &proof.Proof{
134139
PrevOut: wire.OutPoint{},
135140
BlockHeader: wire.BlockHeader{
@@ -142,7 +147,7 @@ func randProof(t *testing.T) *proof.Proof {
142147
}},
143148
},
144149
TxMerkleProof: proof.TxMerkleProof{},
145-
Asset: *asset.RandAsset(t, asset.Normal),
150+
Asset: proofAsset,
146151
InclusionProof: proof.TaprootProof{
147152
InternalKey: test.RandPubKey(t),
148153
},
@@ -152,7 +157,7 @@ func randProof(t *testing.T) *proof.Proof {
152157
func randMintingLeaf(t *testing.T, assetGen asset.Genesis,
153158
groupKey *btcec.PublicKey) universe.Leaf {
154159

155-
randProof := randProof(t)
160+
randProof := randProof(t, nil)
156161

157162
leaf := universe.Leaf{
158163
GenesisWithGroup: universe.GenesisWithGroup{
@@ -320,7 +325,7 @@ func TestUniverseIssuanceProofs(t *testing.T) {
320325
testLeaf := &testLeaves[idx]
321326

322327
var proofBuf bytes.Buffer
323-
randProof := randProof(t)
328+
randProof := randProof(t, nil)
324329
require.NoError(t, randProof.Encode(&proofBuf))
325330

326331
testLeaf.Leaf.RawProof = proofBuf.Bytes()

0 commit comments

Comments
 (0)