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