ensure 64bit alignment of atomically accessed field in ChannelAcceptor

- help lnd avoid a bug in the `sync/atomic` package which requires 64-bit alignment of atomically accessed fields
This commit is contained in:
Calvin Zachman 2020-12-28 10:04:13 -06:00
parent 9cd9bff59f
commit 19440c1e39

View File

@ -7,12 +7,12 @@ import (
// ChainedAcceptor represents a conjunction of ChannelAcceptor results. // ChainedAcceptor represents a conjunction of ChannelAcceptor results.
type ChainedAcceptor struct { type ChainedAcceptor struct {
acceptorID uint64 // To be used atomically.
// acceptors is a map of ChannelAcceptors that will be evaluated when // acceptors is a map of ChannelAcceptors that will be evaluated when
// the ChainedAcceptor's Accept method is called. // the ChainedAcceptor's Accept method is called.
acceptors map[uint64]ChannelAcceptor acceptors map[uint64]ChannelAcceptor
acceptorsMtx sync.RWMutex acceptorsMtx sync.RWMutex
acceptorID uint64 // To be used atomically.
} }
// NewChainedAcceptor initializes a ChainedAcceptor. // NewChainedAcceptor initializes a ChainedAcceptor.