Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
92ec07d6
Unverified
Commit
92ec07d6
authored
Feb 27, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/state: fix an account resurrection issue
parent
06d4470b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
state_object.go
core/state/state_object.go
+1
-8
statedb.go
core/state/statedb.go
+4
-4
No files found.
core/state/state_object.go
View file @
92ec07d6
...
@@ -297,18 +297,11 @@ func (s *stateObject) updateTrie(db Database) Trie {
...
@@ -297,18 +297,11 @@ func (s *stateObject) updateTrie(db Database) Trie {
// Retrieve the snapshot storage map for the object
// Retrieve the snapshot storage map for the object
var
storage
map
[
common
.
Hash
][]
byte
var
storage
map
[
common
.
Hash
][]
byte
if
s
.
db
.
snap
!=
nil
{
if
s
.
db
.
snap
!=
nil
{
// Retrieve the old storage map, if available
// Retrieve the old storage map, if available, create a new one otherwise
s
.
db
.
snapLock
.
RLock
()
storage
=
s
.
db
.
snapStorage
[
s
.
addrHash
]
storage
=
s
.
db
.
snapStorage
[
s
.
addrHash
]
s
.
db
.
snapLock
.
RUnlock
()
// If no old storage map was available, create a new one
if
storage
==
nil
{
if
storage
==
nil
{
storage
=
make
(
map
[
common
.
Hash
][]
byte
)
storage
=
make
(
map
[
common
.
Hash
][]
byte
)
s
.
db
.
snapLock
.
Lock
()
s
.
db
.
snapStorage
[
s
.
addrHash
]
=
storage
s
.
db
.
snapStorage
[
s
.
addrHash
]
=
storage
s
.
db
.
snapLock
.
Unlock
()
}
}
}
}
// Insert all the pending updates into the trie
// Insert all the pending updates into the trie
...
...
core/state/statedb.go
View file @
92ec07d6
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"sort"
"sort"
"sync"
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -72,7 +71,6 @@ type StateDB struct {
...
@@ -72,7 +71,6 @@ type StateDB struct {
snap
snapshot
.
Snapshot
snap
snapshot
.
Snapshot
snapAccounts
map
[
common
.
Hash
][]
byte
snapAccounts
map
[
common
.
Hash
][]
byte
snapStorage
map
[
common
.
Hash
]
map
[
common
.
Hash
][]
byte
snapStorage
map
[
common
.
Hash
]
map
[
common
.
Hash
][]
byte
snapLock
sync
.
RWMutex
// Lock for the concurrent storage updaters
// This map holds 'live' objects, which will get modified while processing a state transition.
// This map holds 'live' objects, which will get modified while processing a state transition.
stateObjects
map
[
common
.
Address
]
*
stateObject
stateObjects
map
[
common
.
Address
]
*
stateObject
...
@@ -468,6 +466,10 @@ func (s *StateDB) updateStateObject(obj *stateObject) {
...
@@ -468,6 +466,10 @@ func (s *StateDB) updateStateObject(obj *stateObject) {
// If state snapshotting is active, cache the data til commit
// If state snapshotting is active, cache the data til commit
if
s
.
snap
!=
nil
{
if
s
.
snap
!=
nil
{
// If the account is an empty resurrection, unmark the storage nil-ness
if
storage
,
ok
:=
s
.
snapStorage
[
obj
.
addrHash
];
storage
==
nil
&&
ok
{
delete
(
s
.
snapStorage
,
obj
.
addrHash
)
}
s
.
snapAccounts
[
obj
.
addrHash
]
=
snapshot
.
AccountRLP
(
obj
.
data
.
Nonce
,
obj
.
data
.
Balance
,
obj
.
data
.
Root
,
obj
.
data
.
CodeHash
)
s
.
snapAccounts
[
obj
.
addrHash
]
=
snapshot
.
AccountRLP
(
obj
.
data
.
Nonce
,
obj
.
data
.
Balance
,
obj
.
data
.
Root
,
obj
.
data
.
CodeHash
)
}
}
}
}
...
@@ -484,10 +486,8 @@ func (s *StateDB) deleteStateObject(obj *stateObject) {
...
@@ -484,10 +486,8 @@ func (s *StateDB) deleteStateObject(obj *stateObject) {
// If state snapshotting is active, cache the data til commit
// If state snapshotting is active, cache the data til commit
if
s
.
snap
!=
nil
{
if
s
.
snap
!=
nil
{
s
.
snapLock
.
Lock
()
s
.
snapAccounts
[
obj
.
addrHash
]
=
nil
// We need to maintain account deletions explicitly
s
.
snapAccounts
[
obj
.
addrHash
]
=
nil
// We need to maintain account deletions explicitly
s
.
snapStorage
[
obj
.
addrHash
]
=
nil
// We need to maintain storage deletions explicitly
s
.
snapStorage
[
obj
.
addrHash
]
=
nil
// We need to maintain storage deletions explicitly
s
.
snapLock
.
Unlock
()
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment