Skip to content

Commit

Permalink
FD-785 Added missing mutex usage in FactoidState.GetBalanceHash()
Browse files Browse the repository at this point in the history
  • Loading branch information
sambarnes committed Jan 7, 2019
1 parent ac44c1f commit c891a25
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions state/factoidstate.go
Expand Up @@ -97,8 +97,13 @@ func GetMapHash(dbheight uint32, bmap map[[32]byte]int64) interfaces.IHash {
}

func (fs *FactoidState) GetBalanceHash(includeTemp bool) interfaces.IHash {
fs.State.ECBalancesPMutex.Lock()
fs.State.FactoidBalancesPMutex.Lock()
h1 := GetMapHash(fs.DBHeight, fs.State.FactoidBalancesP)
h2 := GetMapHash(fs.DBHeight, fs.State.ECBalancesP)
fs.State.ECBalancesPMutex.Unlock()
fs.State.FactoidBalancesPMutex.Unlock()

h3 := h1
h4 := h2
if includeTemp {
Expand Down

0 comments on commit c891a25

Please sign in to comment.