Skip to content

Commit

Permalink
pool: Use fmt.Stringer.
Browse files Browse the repository at this point in the history
There is no reason to explicitly call .String in format statements since
they automatically invoke it because it implements fmt.Stringer.
  • Loading branch information
davecgh authored and jholdstock committed Oct 12, 2023
1 parent de6e42e commit 7c33d07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pool/chainstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func testChainState(t *testing.T) {
cs.cfg.GetBlock = func(ctx context.Context, hash *chainhash.Hash) (*wire.MsgBlock, error) {
return nil, &dcrjson.RPCError{
Code: dcrjson.ErrRPCBlockNotFound,
Message: fmt.Sprintf("no block found with hash: %v", hash.String()),
Message: fmt.Sprintf("no block found with hash: %v", hash),
}
}
height := uint32(10)
Expand Down
7 changes: 3 additions & 4 deletions pool/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,16 +603,15 @@ func (c *Client) handleSubmitWorkRequest(ctx context.Context, req *Request, allo
resp := SubmitWorkResponse(*req.ID, false, nil)
c.sendMessage(resp)

desc := fmt.Sprintf("%s: work %s rejected by the network",
id, hash.String())
desc := fmt.Sprintf("%s: work %s rejected by the network", id, hash)
if err != nil {
// send the current work if the error is a block difficulty mismatch.
if strings.Contains(err.Error(), "block difficulty of") {
c.updateWork(true)
}

desc = fmt.Sprintf("%s: work %s rejected by the network (%v)",
id, hash.String(), err)
id, hash, err)
}

return errs.PoolError(errs.WorkRejected, desc)
Expand All @@ -637,7 +636,7 @@ func (c *Client) handleSubmitWorkRequest(ctx context.Context, req *Request, allo
c.sendMessage(resp)
return err
}
log.Tracef("Work %s accepted by the network", hash.String())
log.Tracef("Work %s accepted by the network", hash)
resp := SubmitWorkResponse(*req.ID, true, nil)
c.sendMessage(resp)
return nil
Expand Down

0 comments on commit 7c33d07

Please sign in to comment.