forked from TrueCloudLab/neoneo-go
stateroot: protect incomplete root manipulations in signAndSend
We're modifying it here, so there can be a race between this method and AddSignature().
This commit is contained in:
parent
ba5273999f
commit
fc800dcbc1
1 changed files with 2 additions and 0 deletions
|
@ -60,9 +60,11 @@ func (s *service) signAndSend(r *state.MPTRoot) error {
|
|||
|
||||
sig := acc.PrivateKey().SignHashable(uint32(s.Network), r)
|
||||
incRoot := s.getIncompleteRoot(r.Index)
|
||||
incRoot.Lock()
|
||||
incRoot.root = r
|
||||
incRoot.addSignature(acc.PrivateKey().PublicKey(), sig)
|
||||
incRoot.reverify(s.Network)
|
||||
incRoot.Unlock()
|
||||
|
||||
s.accMtx.RLock()
|
||||
myIndex := s.myIndex
|
||||
|
|
Loading…
Reference in a new issue