Skip to content

Commit 8f40c64

Browse files
committed
multi: remove unusedparams found with gopls
1 parent 1a22a35 commit 8f40c64

File tree

4 files changed

+29
-34
lines changed

4 files changed

+29
-34
lines changed

itest/mint_batch_stress_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func mintBatchStressTest(
202202
// outpoints matching the chain anchor of the group anchor.
203203
mintOutpoint := collectibleAnchor.ChainAnchor.AnchorOutpoint
204204

205-
leafKeys, err := fetchAllLeafKeys(t, alice, &collectUniID)
205+
leafKeys, err := fetchAllLeafKeys(alice, &collectUniID)
206206
require.NoError(t, err)
207207

208208
require.Len(t, leafKeys, batchSize)

itest/universe_pagination_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func mintBatchAssetsTest(
180180
// all outpoints matching the chain anchor of the group anchor.
181181
mintOutpoint := collectibleAnchor.ChainAnchor.AnchorOutpoint
182182

183-
leafKeys, err := fetchAllLeafKeys(t, alice, &collectUniID)
183+
leafKeys, err := fetchAllLeafKeys(alice, &collectUniID)
184184
require.NoError(t, err)
185185

186186
require.Len(t, leafKeys, len(mintBatch))
@@ -218,8 +218,8 @@ func mintBatchAssetsTest(
218218
}
219219

220220
// fetchAllLeafKeys fetches all leaf keys for a given universe ID.
221-
func fetchAllLeafKeys(t *testing.T, alice TapdClient,
222-
id *unirpc.ID) ([]*unirpc.AssetKey, error) {
221+
func fetchAllLeafKeys(alice TapdClient, id *unirpc.ID) ([]*unirpc.AssetKey,
222+
error) {
223223

224224
keys := make([]*unirpc.AssetKey, 0)
225225
offset := int32(0)

tapdb/asset_minting_test.go

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func treeFromBranch(t *testing.T, children [][]byte) (chainhash.Hash,
193193

194194
// storeTapscriptTreeWrapper wraps a DB transaction that stores a tapscript
195195
// tree.
196-
func storeTapscriptTreeWrapper(t *testing.T, ctx context.Context, isBranch bool,
196+
func storeTapscriptTreeWrapper(ctx context.Context, isBranch bool,
197197
store *AssetMintingStore, rootHash []byte, nodes [][]byte) error {
198198

199199
var writeTxOpts AssetStoreTxOptions
@@ -207,9 +207,8 @@ func storeTapscriptTreeWrapper(t *testing.T, ctx context.Context, isBranch bool,
207207

208208
// fetchTapscriptTreeWrapper wraps a DB transaction that fetches a tapscript
209209
// tree.
210-
func fetchTapscriptTreeWrapper(t *testing.T, ctx context.Context,
211-
rootHash []byte, store *AssetMintingStore) ([]TapscriptTreeNode,
212-
error) {
210+
func fetchTapscriptTreeWrapper(ctx context.Context, rootHash []byte,
211+
store *AssetMintingStore) ([]TapscriptTreeNode, error) {
213212

214213
var (
215214
dbTreeNodes []TapscriptTreeNode
@@ -228,8 +227,8 @@ func fetchTapscriptTreeWrapper(t *testing.T, ctx context.Context,
228227

229228
// deleteTapscriptTreeWrapper wraps a DB transaction that deletes a tapscript
230229
// tree.
231-
func deleteTapscriptTreeWrapper(t *testing.T, ctx context.Context,
232-
rootHash []byte, store *AssetMintingStore) error {
230+
func deleteTapscriptTreeWrapper(ctx context.Context, rootHash []byte,
231+
store *AssetMintingStore) error {
233232

234233
var writeTxOpts AssetStoreTxOptions
235234
return store.db.ExecTx(ctx, &writeTxOpts,
@@ -242,7 +241,7 @@ func deleteTapscriptTreeWrapper(t *testing.T, ctx context.Context,
242241
func assertTreeDeletion(t *testing.T, ctx context.Context, rootHash []byte,
243242
store *AssetMintingStore) {
244243

245-
dbTree, err := fetchTapscriptTreeWrapper(t, ctx, rootHash, store)
244+
dbTree, err := fetchTapscriptTreeWrapper(ctx, rootHash, store)
246245
require.NoError(t, err)
247246
require.Empty(t, dbTree)
248247
}
@@ -252,7 +251,7 @@ func assertTreeDeletion(t *testing.T, ctx context.Context, rootHash []byte,
252251
func assertStoredTreeEqual(t *testing.T, ctx context.Context, isBranch bool,
253252
store *AssetMintingStore, rootHash []byte, expected [][]byte) {
254253

255-
dbTree, err := fetchTapscriptTreeWrapper(t, ctx, rootHash, store)
254+
dbTree, err := fetchTapscriptTreeWrapper(ctx, rootHash, store)
256255
require.NoError(t, err)
257256

258257
require.True(t, fn.All(dbTree, func(node TapscriptTreeNode) bool {
@@ -356,8 +355,8 @@ func addRandSiblingToBatch(t *testing.T, batch *tapgarden.MintingBatch) (
356355
// seedling is being issued into an existing group, and creates a multi-asset
357356
// group. Specifically, one seedling will have emission enabled, and the other
358357
// seedling will reference the first seedling as its group anchor.
359-
func addMultiAssetGroupToBatch(t *testing.T,
360-
seedlings map[string]*tapgarden.Seedling) (string, string) {
358+
func addMultiAssetGroupToBatch(seedlings map[string]*tapgarden.Seedling) (string,
359+
string) {
361360

362361
seedlingNames := maps.Keys(seedlings)
363362
seedlingCount := len(seedlingNames)
@@ -1268,7 +1267,7 @@ func TestGroupAnchors(t *testing.T) {
12681267
_, seedlingGroups, _ := addRandGroupToBatch(
12691268
t, assetStore, ctx, mintingBatch.Seedlings,
12701269
)
1271-
addMultiAssetGroupToBatch(t, mintingBatch.Seedlings)
1270+
addMultiAssetGroupToBatch(mintingBatch.Seedlings)
12721271
err := assetStore.CommitMintingBatch(ctx, mintingBatch)
12731272
require.NoError(t, err)
12741273

@@ -1283,9 +1282,7 @@ func TestGroupAnchors(t *testing.T) {
12831282
// Now we'll add an additional set of seedlings with
12841283
// another multi-asset group.
12851284
seedlings := tapgarden.RandSeedlings(t, numSeedlings)
1286-
secondAnchor, secondGrouped := addMultiAssetGroupToBatch(
1287-
t, seedlings,
1288-
)
1285+
secondAnchor, secondGrouped := addMultiAssetGroupToBatch(seedlings)
12891286

12901287
// We add seedlings one at a time, in order, as the planter does.
12911288
mintingBatch.Seedlings = mergeMap(mintingBatch.Seedlings, seedlings)
@@ -1424,44 +1421,42 @@ func TestTapscriptTreeStore(t *testing.T) {
14241421

14251422
// Start with the cases where tree insertion should fail.
14261423
badRootHashErr := storeTapscriptTreeWrapper(
1427-
t, ctx, false, assetStore, tree1Hash[1:], tree1,
1424+
ctx, false, assetStore, tree1Hash[1:], tree1,
14281425
)
14291426
require.ErrorContains(t, badRootHashErr, "must be 32 bytes")
14301427

14311428
emptyTreeErr := storeTapscriptTreeWrapper(
1432-
t, ctx, false, assetStore, tree1Hash[:], nil,
1429+
ctx, false, assetStore, tree1Hash[:], nil,
14331430
)
14341431
require.ErrorContains(t, emptyTreeErr, "no tapscript tree nodes")
14351432

14361433
invalidBranchErr := storeTapscriptTreeWrapper(
1437-
t, ctx, true, assetStore, tree4Hash[:], tree3,
1434+
ctx, true, assetStore, tree4Hash[:], tree3,
14381435
)
14391436
require.ErrorContains(t, invalidBranchErr, "must be 2 nodes")
14401437

14411438
// Now, let's insert the first tree, and then assert that we can fetch
14421439
// and decode an identical tree.
14431440
err := storeTapscriptTreeWrapper(
1444-
t, ctx, false, assetStore, tree1Hash[:], tree1,
1441+
ctx, false, assetStore, tree1Hash[:], tree1,
14451442
)
14461443
require.NoError(t, err)
14471444

14481445
assertStoredTreeEqual(t, ctx, false, assetStore, tree1Hash[:], tree1)
14491446

14501447
// If we try to fetch a tree with a different root hash, that will not
14511448
// return an error, but the results should be empty.
1452-
dbTree2, err := fetchTapscriptTreeWrapper(
1453-
t, ctx, tree2Hash[:], assetStore,
1454-
)
1449+
dbTree2, err := fetchTapscriptTreeWrapper(ctx, tree2Hash[:], assetStore)
14551450
require.Empty(t, dbTree2)
14561451
require.Nil(t, err)
14571452

14581453
// Trying to delete a tree we haven't inserted yet will not err.
1459-
err = deleteTapscriptTreeWrapper(t, ctx, tree2Hash[:], assetStore)
1454+
err = deleteTapscriptTreeWrapper(ctx, tree2Hash[:], assetStore)
14601455
require.Nil(t, err)
14611456

14621457
// Insert the second tree, which has one node already inserted.
14631458
err = storeTapscriptTreeWrapper(
1464-
t, ctx, false, assetStore, tree2Hash[:], tree2,
1459+
ctx, false, assetStore, tree2Hash[:], tree2,
14651460
)
14661461
require.NoError(t, err)
14671462

@@ -1471,7 +1466,7 @@ func TestTapscriptTreeStore(t *testing.T) {
14711466

14721467
// If we delete the first tree, we should still be able to fetch the
14731468
// second tree intact.
1474-
err = deleteTapscriptTreeWrapper(t, ctx, tree1Hash[:], assetStore)
1469+
err = deleteTapscriptTreeWrapper(ctx, tree1Hash[:], assetStore)
14751470
require.NoError(t, err)
14761471
assertTreeDeletion(t, ctx, tree1Hash[:], assetStore)
14771472

@@ -1480,7 +1475,7 @@ func TestTapscriptTreeStore(t *testing.T) {
14801475
// Let's insert the third tree, which contains a node that's a duplicate
14811476
// of an already-inserted node.
14821477
err = storeTapscriptTreeWrapper(
1483-
t, ctx, false, assetStore, tree3Hash[:], tree3,
1478+
ctx, false, assetStore, tree3Hash[:], tree3,
14841479
)
14851480
require.NoError(t, err)
14861481

@@ -1489,31 +1484,31 @@ func TestTapscriptTreeStore(t *testing.T) {
14891484
assertStoredTreeEqual(t, ctx, false, assetStore, tree3Hash[:], tree3)
14901485

14911486
// Deleting the third tree should not affect the second tree.
1492-
err = deleteTapscriptTreeWrapper(t, ctx, tree3Hash[:], assetStore)
1487+
err = deleteTapscriptTreeWrapper(ctx, tree3Hash[:], assetStore)
14931488
require.NoError(t, err)
14941489
assertTreeDeletion(t, ctx, tree1Hash[:], assetStore)
14951490

14961491
assertStoredTreeEqual(t, ctx, false, assetStore, tree2Hash[:], tree2)
14971492

14981493
// Let's also test handling of tapscript branches.
14991494
err = storeTapscriptTreeWrapper(
1500-
t, ctx, true, assetStore, tree4Hash[:], tree4,
1495+
ctx, true, assetStore, tree4Hash[:], tree4,
15011496
)
15021497
require.NoError(t, err)
15031498

15041499
assertStoredTreeEqual(t, ctx, true, assetStore, tree4Hash[:], tree4)
15051500

15061501
// The second tapscript branch shares a node with the first.
15071502
err = storeTapscriptTreeWrapper(
1508-
t, ctx, true, assetStore, tree5Hash[:], tree5,
1503+
ctx, true, assetStore, tree5Hash[:], tree5,
15091504
)
15101505
require.NoError(t, err)
15111506

15121507
assertStoredTreeEqual(t, ctx, true, assetStore, tree4Hash[:], tree4)
15131508
assertStoredTreeEqual(t, ctx, true, assetStore, tree5Hash[:], tree5)
15141509

15151510
// Deleting the first set of branches should not affect the second.
1516-
err = deleteTapscriptTreeWrapper(t, ctx, tree4Hash[:], assetStore)
1511+
err = deleteTapscriptTreeWrapper(ctx, tree4Hash[:], assetStore)
15171512
require.NoError(t, err)
15181513
assertTreeDeletion(t, ctx, tree4Hash[:], assetStore)
15191514

tapdb/sqlutils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func extractSqlInt32[T constraints.Integer](num sql.NullInt32) T {
101101
// NOTE: This function is intended to be used along with the wire.WriteOutPoint
102102
// function. Once the ReadOutPoint function is exported, then it can be used in
103103
// place of this.
104-
func readOutPoint(r io.Reader, pver uint32, version int32, op *wire.OutPoint) error {
104+
func readOutPoint(r io.Reader, _ uint32, _ uint32, op *wire.OutPoint) error {
105105
_, err := io.ReadFull(r, op.Hash[:])
106106
if err != nil {
107107
return err

0 commit comments

Comments
 (0)