mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-21 06:12:38 +02:00
lntest: change the nodeCounter
to be atomic
This commit is contained in:
parent
cc6ff150b9
commit
4506fd30cb
@ -46,7 +46,7 @@ type nodeManager struct {
|
|||||||
|
|
||||||
// nodeCounter is a monotonically increasing counter that's used as the
|
// nodeCounter is a monotonically increasing counter that's used as the
|
||||||
// node's unique ID.
|
// node's unique ID.
|
||||||
nodeCounter uint32
|
nodeCounter atomic.Uint32
|
||||||
|
|
||||||
// feeServiceURL is the url of the fee service.
|
// feeServiceURL is the url of the fee service.
|
||||||
feeServiceURL string
|
feeServiceURL string
|
||||||
@ -67,8 +67,8 @@ func newNodeManager(lndBinary string, dbBackend node.DatabaseBackend,
|
|||||||
|
|
||||||
// nextNodeID generates a unique sequence to be used as the node's ID.
|
// nextNodeID generates a unique sequence to be used as the node's ID.
|
||||||
func (nm *nodeManager) nextNodeID() uint32 {
|
func (nm *nodeManager) nextNodeID() uint32 {
|
||||||
nodeID := atomic.AddUint32(&nm.nodeCounter, 1)
|
nodeID := nm.nodeCounter.Add(1)
|
||||||
return nodeID - 1
|
return nodeID
|
||||||
}
|
}
|
||||||
|
|
||||||
// newNode initializes a new HarnessNode, supporting the ability to initialize
|
// newNode initializes a new HarnessNode, supporting the ability to initialize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user