From 9e4532806f3cbd39a57a38103894c709f615b5cf Mon Sep 17 00:00:00 2001 From: jholdstock Date: Mon, 13 Feb 2023 15:48:08 +0000 Subject: [PATCH] rpcclient: Use atomic types. --- rpcclient/go.mod | 2 +- rpcclient/infrastructure.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcclient/go.mod b/rpcclient/go.mod index 0f34e7fdcd..946e6146c6 100644 --- a/rpcclient/go.mod +++ b/rpcclient/go.mod @@ -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 diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index a4201f3bc2..7bf71d0c16 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -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. @@ -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. @@ -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