mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
add changes (#13661)
This commit is contained in:
parent
5735379963
commit
ddb321e0ce
@ -185,13 +185,14 @@ func (f *FieldTrie) CopyTrie() *FieldTrie {
|
|||||||
copy(dstFieldTrie[i], layer)
|
copy(dstFieldTrie[i], layer)
|
||||||
}
|
}
|
||||||
return &FieldTrie{
|
return &FieldTrie{
|
||||||
fieldLayers: dstFieldTrie,
|
fieldLayers: dstFieldTrie,
|
||||||
field: f.field,
|
field: f.field,
|
||||||
dataType: f.dataType,
|
dataType: f.dataType,
|
||||||
reference: stateutil.NewRef(1),
|
reference: stateutil.NewRef(1),
|
||||||
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