Skip to content

Commit

Permalink
multi: Use const instead of var when possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholdstock committed Aug 22, 2023
1 parent 3ddad3e commit c039dc8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/v3tool/dcrwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (w *dcrwallet) createFeeTx(feeAddress string, fee int64) (string, error) {
}

var locked bool
unlock := false
const unlock = false
err = w.Call(context.TODO(), "lockunspent", &locked, unlock, transactions)
if err != nil {
return "", err
Expand Down Expand Up @@ -118,7 +118,7 @@ func (w *dcrwallet) dumpPrivKey(addr stdaddr.Address) (string, error) {

func (w *dcrwallet) getTickets() (*wallettypes.GetTicketsResult, error) {
var tickets wallettypes.GetTicketsResult
includeImmature := true
const includeImmature = true
err := w.Call(context.TODO(), "gettickets", &tickets, includeImmature)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/vspd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func run() int {
return 1
}

writeBackup := true
const writeBackup = true
defer db.Close(writeBackup)

// Create a context that is cancelled when a shutdown request is received
Expand Down
4 changes: 2 additions & 2 deletions rpc/dcrd.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (c *DcrdRPC) DecodeRawTransaction(txHex string) (*dcrdtypes.TxRawDecodeResu
// SendRawTransaction uses sendrawtransaction RPC to broadcast a transaction to
// the network. It ignores errors caused by duplicate transactions.
func (c *DcrdRPC) SendRawTransaction(txHex string) error {
allowHighFees := false
const allowHighFees = false
err := c.Call(c.ctx, "sendrawtransaction", nil, txHex, allowHighFees)
if err != nil {

Expand Down Expand Up @@ -238,7 +238,7 @@ func (c *DcrdRPC) GetBestBlockHeader() (*dcrdtypes.GetBlockHeaderVerboseResult,
// GetBlockHeaderVerbose uses getblockheader RPC with verbose=true to retrieve
// the header of the requested block.
func (c *DcrdRPC) GetBlockHeaderVerbose(blockHash string) (*dcrdtypes.GetBlockHeaderVerboseResult, error) {
verbose := true
const verbose = true
var blockHeader dcrdtypes.GetBlockHeaderVerboseResult
err := c.Call(c.ctx, "getblockheader", &blockHeader, blockHash, verbose)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions rpc/dcrwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ func (c *WalletRPC) WalletInfo() (*wallettypes.WalletInfoResult, error) {
// AddTicketForVoting uses importprivkey RPC, followed by addtransaction RPC, to
// add a new ticket to a voting wallet.
func (c *WalletRPC) AddTicketForVoting(votingWIF, blockHash, txHex string) error {
label := "imported"
rescan := false
scanFrom := 0
const label = "imported"
const rescan = false
const scanFrom = 0
err := c.Call(c.ctx, "importprivkey", nil, votingWIF, label, rescan, scanFrom)
if err != nil {
return fmt.Errorf("importprivkey failed: %w", err)
Expand Down

0 comments on commit c039dc8

Please sign in to comment.