mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
triedb/pathdb: derive state set without holding the lock
This commit is contained in:
parent
99bb61207a
commit
9d9ca45145
1 changed files with 4 additions and 1 deletions
|
|
@ -302,6 +302,10 @@ func (dl *diskLayer) revert(h *history) (*diskLayer, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// Derive the state modification set from the history, keyed by the hash
|
||||||
|
// of the account address and the storage key.
|
||||||
|
accounts, storages := h.stateSet()
|
||||||
|
|
||||||
// Mark the diskLayer as stale before applying any mutations on top.
|
// Mark the diskLayer as stale before applying any mutations on top.
|
||||||
dl.lock.Lock()
|
dl.lock.Lock()
|
||||||
defer dl.lock.Unlock()
|
defer dl.lock.Unlock()
|
||||||
|
|
@ -314,7 +318,6 @@ func (dl *diskLayer) revert(h *history) (*diskLayer, error) {
|
||||||
// needs to be reverted is not yet flushed and cached in node
|
// needs to be reverted is not yet flushed and cached in node
|
||||||
// buffer, otherwise, manipulate persistent state directly.
|
// buffer, otherwise, manipulate persistent state directly.
|
||||||
if !dl.buffer.empty() {
|
if !dl.buffer.empty() {
|
||||||
accounts, storages := h.stateSet()
|
|
||||||
err := dl.buffer.revertTo(dl.db.diskdb, nodes, accounts, storages)
|
err := dl.buffer.revertTo(dl.db.diskdb, nodes, accounts, storages)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue