1
0
Fork 0

fix lock value copy bug

This commit is contained in:
Massaki Archambault 2021-12-24 15:58:38 -05:00
parent 44fab9eab5
commit a0430b6c1e
1 changed files with 8 additions and 2 deletions

View File

@ -45,11 +45,12 @@ func NewExporter(accountAddress []string) (*Exporter, error) {
// Account represents a helium account // Account represents a helium account
type Account struct { type Account struct {
Address string Address string
UpdateLock sync.Mutex
LastUpdate time.Time LastUpdate time.Time
RewardsTotal map[string]int RewardsTotal map[string]int
Tx AccountTx Tx AccountTx
Hotspots map[string]Hotspot Hotspots map[string]Hotspot
UpdateLock *sync.Mutex
} }
func NewAccount(address string) Account { func NewAccount(address string) Account {
@ -67,6 +68,8 @@ func NewAccount(address string) Account {
WithdrawalTotal: 0, WithdrawalTotal: 0,
}, },
Hotspots: map[string]Hotspot{}, Hotspots: map[string]Hotspot{},
UpdateLock: &sync.Mutex{},
} }
} }
@ -78,9 +81,10 @@ type AccountTx struct {
// Hotspot represents a hotspot // Hotspot represents a hotspot
type Hotspot struct { type Hotspot struct {
Address string Address string
UpdateLock sync.Mutex
LastUpdate time.Time LastUpdate time.Time
RewardsTotal map[string]int RewardsTotal map[string]int
UpdateLock *sync.Mutex
} }
func NewHotspot(address string) Hotspot { func NewHotspot(address string) Hotspot {
@ -93,6 +97,8 @@ func NewHotspot(address string) Hotspot {
"poc_challengees": 0, "poc_challengees": 0,
"poc_witnesses": 0, "poc_witnesses": 0,
}, },
UpdateLock: &sync.Mutex{},
} }
} }