Skip to content

Commit

Permalink
rpcclient: Use atomic types.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholdstock committed Feb 17, 2023
1 parent 8f5a18b commit 9e45328
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rpcclient/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/decred/dcrd/rpcclient/v8

go 1.17
go 1.19

require (
github.com/decred/dcrd/chaincfg/chainhash v1.0.3
Expand Down
6 changes: 3 additions & 3 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014-2016 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2023 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 @@ -134,7 +134,7 @@ type jsonRequest struct {
// the returned future will block until the result is available if it's not
// already.
type Client struct {
id uint64 // atomic, so must stay 64-bit aligned
id atomic.Uint64

// config holds the connection configuration associated with this
// client.
Expand Down Expand Up @@ -203,7 +203,7 @@ func (c *Client) String() string {
// this function should be used to ensure the ID is unique amongst all requests
// being made.
func (c *Client) NextID() uint64 {
return atomic.AddUint64(&c.id, 1)
return c.id.Add(1)
}

// addRequest associates the passed jsonRequest with its id. This allows the
Expand Down

0 comments on commit 9e45328

Please sign in to comment.