Skip to content

Commit 8d99137

Browse files
committed
multi: fix conversions + unneeded lambdas
1 parent 3f3dcab commit 8d99137

File tree

15 files changed

+24
-32
lines changed

15 files changed

+24
-32
lines changed

asset/asset.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -778,11 +778,7 @@ func (g *GroupKey) IsEqual(otherGroupKey *GroupKey) bool {
778778
return false
779779
}
780780

781-
return slices.EqualFunc(
782-
g.Witness, otherGroupKey.Witness, func(a, b []byte) bool {
783-
return bytes.Equal(a, b)
784-
},
785-
)
781+
return slices.EqualFunc(g.Witness, otherGroupKey.Witness, bytes.Equal)
786782
}
787783

788784
// IsEqualGroup returns true if this group key describes the same asset group

cmd/tapcli/addrs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func queryAddr(ctx *cli.Context) error {
162162

163163
addrs, err := client.QueryAddrs(ctxc, &taprpc.QueryAddrRequest{
164164
CreatedAfter: start,
165-
CreatedBefore: int64(end),
165+
CreatedBefore: end,
166166
Limit: int32(ctx.Int64(limitName)),
167167
Offset: int32(ctx.Int64(offsetName)),
168168
})

commitment/taproot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func (t *TapscriptPreimage) IsEmpty() bool {
233233

234234
// Type returns the preimage type.
235235
func (t *TapscriptPreimage) Type() TapscriptPreimageType {
236-
return TapscriptPreimageType(t.siblingType)
236+
return t.siblingType
237237
}
238238

239239
// TapHash returns the tap hash of this preimage according to its type.

itest/mint_batch_stress_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func mintBatchStressTest(
121121

122122
// Update the asset name and metadata to match an index.
123123
incrementMintAsset := func(asset *mintrpc.MintAsset, ind int) {
124-
asset.Name = asset.Name + strconv.Itoa(ind)
124+
asset.Name += strconv.Itoa(ind)
125125
binary.PutUvarint(metadataPrefix, uint64(ind))
126126
copy(asset.AssetMeta.Data[0:metaPrefixSize], metadataPrefix)
127127
}

itest/psbt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ func runPsbtInteractiveSplitSendTest(ctxt context.Context, t *harnessTest,
602602
// Swap the sender and receiver nodes starting at the second
603603
// iteration.
604604
if i > 0 {
605-
sendAmt = sendAmt / 2
605+
sendAmt /= 2
606606
changeAmt = sendAmt
607607
sender, receiver = receiver, sender
608608
senderSum, receiverSum = receiverSum, senderSum

itest/universe_pagination_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func mintBatchAssetsTest(
8888

8989
// Update the asset name and metadata to match an index.
9090
incrementMintAsset := func(asset *mintrpc.MintAsset, ind int) {
91-
asset.Name = asset.Name + strconv.Itoa(ind)
91+
asset.Name += strconv.Itoa(ind)
9292
binary.PutUvarint(metadataPrefix, uint64(ind))
9393
copy(asset.AssetMeta.Data[0:metaPrefixSize], metadataPrefix)
9494
}

proof/tx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func NewTxMerkleProof(txs []*wire.MsgTx, txIdx int) (*TxMerkleProof, error) {
8989

9090
// Update the currentIdx to reflect the next level in the tree.
9191
// We divide by 2 since we always hash in pairs.
92-
currentIdx = currentIdx / 2
92+
currentIdx /= 2
9393

9494
// We've arrived at the root so our proof is complete.
9595
if len(hashes) == 1 {

rpcserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ func (r *rpcServer) listBalancesByAsset(ctx context.Context,
817817

818818
resp.AssetBalances[assetIDStr] = &taprpc.AssetBalance{
819819
AssetGenesis: &taprpc.GenesisInfo{
820-
Version: int32(balance.Version),
820+
Version: balance.Version,
821821
GenesisPoint: balance.GenesisPoint.String(),
822822
AssetType: taprpc.AssetType(balance.Type),
823823
Name: balance.Tag,

tapdb/addrs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (t *TapAddressBook) InsertAddrs(ctx context.Context,
288288
&addr.TaprootOutputKey,
289289
),
290290
Amount: int64(addr.Amount),
291-
AssetType: int16(assetGen.AssetType),
291+
AssetType: assetGen.AssetType,
292292
CreationTime: addr.CreationTime.UTC(),
293293
ProofCourierAddr: proofCourierAddrBytes,
294294
})

tapdb/asset_minting.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,8 @@ func fetchAssetSprouts(ctx context.Context, q PendingAssetStore,
620620
Index: extractSqlInt32[uint32](
621621
sprout.GroupKeyIndex,
622622
),
623-
Family: keychain.KeyFamily(
624-
extractSqlInt32[keychain.KeyFamily](
625-
sprout.GroupKeyFamily,
626-
),
623+
Family: extractSqlInt32[keychain.KeyFamily](
624+
sprout.GroupKeyFamily,
627625
),
628626
},
629627
},

0 commit comments

Comments
 (0)