Skip to content

Commit

Permalink
multi: Remove unused params from various funcs.
Browse files Browse the repository at this point in the history
Highlighted by IDE whilst I was working on something else.
  • Loading branch information
jholdstock authored and jrick committed Sep 3, 2024
1 parent 073598e commit 34fa123
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions internal/rpc/jsonrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ func createTxRawResult(chainParams *chaincfg.Params, mtx *wire.MsgTx, blkIdx uin
LockTime: mtx.LockTime,
Expiry: mtx.Expiry,
Vin: createVinList(mtx, isTreasuryEnabled),
Vout: createVoutList(mtx, chainParams, nil, isTreasuryEnabled),
Vout: createVoutList(mtx, chainParams, nil),
BlockHash: blkHeader.BlockHash().String(),
BlockHeight: int64(blkHeader.Height),
BlockIndex: blkIdx,
Expand Down Expand Up @@ -1600,7 +1600,7 @@ func createVinList(mtx *wire.MsgTx, isTreasuryEnabled bool) []dcrdtypes.Vin {

// createVoutList returns a slice of JSON objects for the outputs of the passed
// transaction.
func createVoutList(mtx *wire.MsgTx, chainParams *chaincfg.Params, filterAddrMap map[string]struct{}, isTreasuryEnabled bool) []dcrdtypes.Vout {
func createVoutList(mtx *wire.MsgTx, chainParams *chaincfg.Params, filterAddrMap map[string]struct{}) []dcrdtypes.Vout {
txType := stake.DetermineTxType(mtx)
voutList := make([]dcrdtypes.Vout, 0, len(mtx.TxOut))
for i, v := range mtx.TxOut {
Expand Down
6 changes: 3 additions & 3 deletions wallet/chainntfns.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (w *Wallet) extendMainChain(ctx context.Context, op errors.Op, dbtx walletd
}

// Notify interested clients of the connected block.
w.NtfnServer.notifyAttachedBlock(dbtx, n.Header, blockHash)
w.NtfnServer.notifyAttachedBlock(n.Header, blockHash)

blockMeta, err := w.txStore.GetBlockMetaForHash(txmgrNs, blockHash)
if err != nil {
Expand Down Expand Up @@ -288,7 +288,7 @@ func (w *Wallet) ChainSwitch(ctx context.Context, forest *SidechainForest, chain
// evaluateStakePoolTicket evaluates a stake pool ticket to see if it's
// acceptable to the stake pool. The ticket must pay out to the stake
// pool cold wallet, and must have a sufficient fee.
func (w *Wallet) evaluateStakePoolTicket(rec *udb.TxRecord, blockHeight int32, poolUser stdaddr.Address) bool {
func (w *Wallet) evaluateStakePoolTicket(rec *udb.TxRecord, blockHeight int32) bool {
tx := rec.MsgTx

// Check the first commitment output (txOuts[1])
Expand Down Expand Up @@ -510,7 +510,7 @@ func (w *Wallet) processTransactionRecord(ctx context.Context, dbtx walletdb.Rea
break
}

if w.evaluateStakePoolTicket(rec, height, addr) {
if w.evaluateStakePoolTicket(rec, height) {
// Be sure to insert this into the user's stake
// pool entry into the stake manager.
poolTicket := &udb.PoolTicket{
Expand Down
10 changes: 5 additions & 5 deletions wallet/notifications.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Copyright (c) 2016-2021 The Decred developers
// Copyright (c) 2016-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -211,7 +211,7 @@ func flattenBalanceMap(m map[uint32]dcrutil.Amount) []AccountBalance {
return s
}

func relevantAccounts(w *Wallet, m map[uint32]dcrutil.Amount, txs []TransactionSummary) {
func relevantAccounts(m map[uint32]dcrutil.Amount, txs []TransactionSummary) {
for _, tx := range txs {
for _, d := range tx.MyInputs {
m[d.PreviousAccount] = 0
Expand Down Expand Up @@ -244,7 +244,7 @@ func (s *NotificationServer) notifyUnminedTransaction(dbtx walletdb.ReadTx, deta
return
}
bals := make(map[uint32]dcrutil.Amount)
relevantAccounts(s.wallet, bals, unminedTxs)
relevantAccounts(bals, unminedTxs)
err = totalBalances(dbtx, s.wallet, bals)
if err != nil {
log.Errorf("Cannot determine balances for relevant accounts: %v", err)
Expand Down Expand Up @@ -285,7 +285,7 @@ func (s *NotificationServer) notifyMinedTransaction(dbtx walletdb.ReadTx, detail
*txs = append(*txs, makeTxSummary(dbtx, s.wallet, details))
}

func (s *NotificationServer) notifyAttachedBlock(dbtx walletdb.ReadTx, block *wire.BlockHeader, blockHash *chainhash.Hash) {
func (s *NotificationServer) notifyAttachedBlock(block *wire.BlockHeader, blockHash *chainhash.Hash) {
defer s.mu.Unlock()
s.mu.Lock()

Expand Down Expand Up @@ -335,7 +335,7 @@ func (s *NotificationServer) sendAttachedBlockNotification(ctx context.Context)
return err
}
for _, b := range currentTxNtfn.AttachedBlocks {
relevantAccounts(w, bals, b.Transactions)
relevantAccounts(bals, b.Transactions)
}
return totalBalances(dbtx, w, bals)

Expand Down
14 changes: 7 additions & 7 deletions wallet/udb/addressdb.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -515,7 +515,7 @@ func putWatchingOnly(ns walletdb.ReadWriteBucket, watchingOnly bool) error {
// deserializeAccountRow deserializes the passed serialized account information.
// This is used as a common base for the various account types to deserialize
// the common parts.
func deserializeAccountRow(accountID []byte, serializedAccount []byte) (*dbAccountRow, error) {
func deserializeAccountRow(serializedAccount []byte) (*dbAccountRow, error) {
// The serialized account format is:
// <acctType><rdlen><rawdata>
//
Expand Down Expand Up @@ -771,7 +771,7 @@ func fetchAccountByName(ns walletdb.ReadBucket, name string) (uint32, error) {

// fetchAccountRow loads the row serializing details regarding an account.
// This function does not perform any further parsing based on the account type.
func fetchAccountRow(ns walletdb.ReadBucket, account uint32, dbVersion uint32) (*dbAccountRow, error) {
func fetchAccountRow(ns walletdb.ReadBucket, account uint32) (*dbAccountRow, error) {
bucket := ns.NestedReadBucket(acctBucketName)

accountID := uint32ToBytes(account)
Expand All @@ -780,13 +780,13 @@ func fetchAccountRow(ns walletdb.ReadBucket, account uint32, dbVersion uint32) (
return nil, errors.E(errors.NotExist, errors.Errorf("no account %d", account))
}

return deserializeAccountRow(accountID, serializedRow)
return deserializeAccountRow(serializedRow)
}

// fetchAccountInfo loads information about the passed account from the
// database.
func fetchAccountInfo(ns walletdb.ReadBucket, account uint32, dbVersion uint32) (*dbBIP0044AccountRow, error) {
row, err := fetchAccountRow(ns, account, dbVersion)
row, err := fetchAccountRow(ns, account)
if err != nil {
return nil, err
}
Expand All @@ -801,7 +801,7 @@ func fetchAccountInfo(ns walletdb.ReadBucket, account uint32, dbVersion uint32)
}

func fetchDBAccount(ns walletdb.ReadBucket, account uint32, dbVersion uint32) (dbAccount, error) {
row, err := fetchAccountRow(ns, account, dbVersion)
row, err := fetchAccountRow(ns, account)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1509,7 +1509,7 @@ func deletePrivateKeys(ns walletdb.ReadWriteBucket, dbVersion uint32) error {
}

// Deserialize the account row first to determine the type.
row, err := deserializeAccountRow(k, v)
row, err := deserializeAccountRow(v)
if err != nil {
c.Close()
return err
Expand Down
2 changes: 1 addition & 1 deletion wallet/udb/addressmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ func (m *Manager) UpgradeToSLIP0044CoinType(dbtx walletdb.ReadWriteTx) error {
return errors.E(errors.IO, "missing SLIP0044 coin type account row")
}
accountID := uint32ToBytes(0)
row, err := deserializeAccountRow(accountID, serializedRow)
row, err := deserializeAccountRow(serializedRow)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions wallet/udb/txdb.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015 The btcsuite developers
// Copyright (c) 2015-2019 The Decred developers
// Copyright (c) 2015-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -546,7 +546,7 @@ func putRawTxRecord(ns walletdb.ReadWriteBucket, k, v []byte) error {
return nil
}

func readRawTxRecordMsgTx(txHash *chainhash.Hash, v []byte, msgTx *wire.MsgTx) error {
func readRawTxRecordMsgTx(v []byte, msgTx *wire.MsgTx) error {
if len(v) < 8 {
return errors.E(errors.IO, errors.Errorf("tx record len %d", len(v)))
}
Expand Down
4 changes: 2 additions & 2 deletions wallet/udb/txquery.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015 The btcsuite developers
// Copyright (c) 2015-2017 The Decred developers
// Copyright (c) 2015-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -662,7 +662,7 @@ func (s *Store) Spender(dbtx walletdb.ReadTx, out *wire.OutPoint) (*wire.MsgTx,
spenderIndex = extractRawDebitInputIndex(k)
k = extractRawDebitTxRecordKey(k)
v = existsRawTxRecord(ns, k)
err = readRawTxRecordMsgTx(&spenderHash, v, &spender)
err = readRawTxRecordMsgTx(v, &spender)
if err != nil {
return nil, 0, err
}
Expand Down

0 comments on commit 34fa123

Please sign in to comment.