Skip to content

Commit

Permalink
Merge pull request #89 from SiaFoundation/nate/fix-32-bit-alignment
Browse files Browse the repository at this point in the history
Align fields for sync/atomic on 32-bit systems
  • Loading branch information
n8maninger committed Jun 20, 2023
2 parents 390b90e + 3e7139c commit faf5192
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions host/contracts/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ type (

// A ContractManager manages contracts' lifecycle
ContractManager struct {
blockHeight uint64 // ensure 64-bit alignment on 32-bit systems

store ContractStore
tg *threadgroup.ThreadGroup
log *zap.Logger
Expand All @@ -74,8 +76,6 @@ type (
tpool TransactionPool
wallet Wallet

blockHeight uint64

processQueue chan uint64 // signals that the contract manager should process actions for a given block height

mu sync.Mutex // guards the following fields
Expand Down
5 changes: 3 additions & 2 deletions host/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ type (

// A VolumeManager manages storage using local volumes.
VolumeManager struct {
cacheHits uint64 // ensure 64-bit alignment on 32-bit systems
cacheMisses uint64

a Alerts
vs VolumeStore
cm ChainManager
Expand All @@ -77,8 +80,6 @@ type (
// changedVolumes tracks volumes that need to be fsynced
changedVolumes map[int]bool
cache *lru.Cache[types.Hash256, *[rhpv2.SectorSize]byte] // Added cache
cacheHits uint64
cacheMisses uint64
}
)

Expand Down
7 changes: 4 additions & 3 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ type (
// A SingleAddressWallet is a hot wallet that manages the outputs controlled by
// a single address.
SingleAddressWallet struct {
priv types.PrivateKey
addr types.Address
scanHeight uint64
scanHeight uint64 // ensure 64-bit alignment on 32-bit systems

priv types.PrivateKey
addr types.Address

cm ChainManager
store SingleAddressStore
Expand Down

0 comments on commit faf5192

Please sign in to comment.