mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
add changes (#13661)
This commit is contained in:
parent
5735379963
commit
ddb321e0ce
beacon-chain/state
@ -192,6 +192,7 @@ func (f *FieldTrie) CopyTrie() *FieldTrie {
|
|||||||
RWMutex: new(sync.RWMutex),
|
RWMutex: new(sync.RWMutex),
|
||||||
length: f.length,
|
length: f.length,
|
||||||
numOfElems: f.numOfElems,
|
numOfElems: f.numOfElems,
|
||||||
|
isTransferred: f.isTransferred,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,8 +1158,16 @@ func (b *BeaconState) recomputeFieldTrie(index types.FieldIndex, elements interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fTrie.FieldReference().Refs() > 1 {
|
if fTrie.FieldReference().Refs() > 1 {
|
||||||
|
var newTrie *fieldtrie.FieldTrie
|
||||||
|
// We choose to only copy the validator
|
||||||
|
// trie as it is pretty expensive to regenerate
|
||||||
|
// in the event of late blocks.
|
||||||
|
if index == types.Validators {
|
||||||
|
newTrie = fTrie.CopyTrie()
|
||||||
|
} else {
|
||||||
|
newTrie = fTrie.TransferTrie()
|
||||||
|
}
|
||||||
fTrie.FieldReference().MinusRef()
|
fTrie.FieldReference().MinusRef()
|
||||||
newTrie := fTrie.TransferTrie()
|
|
||||||
b.stateFieldLeaves[index] = newTrie
|
b.stateFieldLeaves[index] = newTrie
|
||||||
fTrie = newTrie
|
fTrie = newTrie
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user