mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
fix bug
This commit is contained in:
parent
01eba515f9
commit
d84c199ba8
4 changed files with 9 additions and 9 deletions
|
|
@ -144,7 +144,7 @@ func (it *nodeIterator) step() error {
|
|||
}
|
||||
if !bytes.Equal(account.CodeHash, types.EmptyCodeHash.Bytes()) {
|
||||
it.codeHash = common.BytesToHash(account.CodeHash)
|
||||
it.code, err = it.state.reader.Code(address, common.BytesToHash(account.CodeHash))
|
||||
it.code, err = it.state.reader.Code(common.BytesToHash(account.CodeHash))
|
||||
if err != nil {
|
||||
return fmt.Errorf("code %x: %v", account.CodeHash, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ func (s *stateObject) Code() []byte {
|
|||
if bytes.Equal(s.CodeHash(), types.EmptyCodeHash.Bytes()) {
|
||||
return nil
|
||||
}
|
||||
code, err := s.db.reader.Code(s.address, common.BytesToHash(s.CodeHash()))
|
||||
code, err := s.db.reader.Code(common.BytesToHash(s.CodeHash()))
|
||||
if err != nil {
|
||||
s.db.setError(fmt.Errorf("can't load code hash %x: %v", s.CodeHash(), err))
|
||||
}
|
||||
|
|
@ -538,7 +538,7 @@ func (s *stateObject) CodeSize() int {
|
|||
if bytes.Equal(s.CodeHash(), types.EmptyCodeHash.Bytes()) {
|
||||
return 0
|
||||
}
|
||||
size, err := s.db.reader.CodeSize(s.address, common.BytesToHash(s.CodeHash()))
|
||||
size, err := s.db.reader.CodeSize(common.BytesToHash(s.CodeHash()))
|
||||
if err != nil {
|
||||
s.db.setError(fmt.Errorf("can't load code size %x: %v", s.CodeHash(), err))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ func testIterativeStateSync(t *testing.T, count int, commit bool, bypath bool, s
|
|||
codeResults = make([]trie.CodeSyncResult, len(codeElements))
|
||||
)
|
||||
for i, element := range codeElements {
|
||||
data, err := cReader.Code(common.Address{}, element.code)
|
||||
data, err := cReader.Code(element.code)
|
||||
if err != nil || len(data) == 0 {
|
||||
t.Fatalf("failed to retrieve contract bytecode for hash %x", element.code)
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ func testIterativeDelayedStateSync(t *testing.T, scheme string) {
|
|||
if len(codeElements) > 0 {
|
||||
codeResults := make([]trie.CodeSyncResult, len(codeElements)/2+1)
|
||||
for i, element := range codeElements[:len(codeResults)] {
|
||||
data, err := cReader.Code(common.Address{}, element.code)
|
||||
data, err := cReader.Code(element.code)
|
||||
if err != nil || len(data) == 0 {
|
||||
t.Fatalf("failed to retrieve contract bytecode for %x", element.code)
|
||||
}
|
||||
|
|
@ -452,7 +452,7 @@ func testIterativeRandomStateSync(t *testing.T, count int, scheme string) {
|
|||
if len(codeQueue) > 0 {
|
||||
results := make([]trie.CodeSyncResult, 0, len(codeQueue))
|
||||
for hash := range codeQueue {
|
||||
data, err := cReader.Code(common.Address{}, hash)
|
||||
data, err := cReader.Code(hash)
|
||||
if err != nil || len(data) == 0 {
|
||||
t.Fatalf("failed to retrieve node data for %x", hash)
|
||||
}
|
||||
|
|
@ -551,7 +551,7 @@ func testIterativeRandomDelayedStateSync(t *testing.T, scheme string) {
|
|||
for hash := range codeQueue {
|
||||
delete(codeQueue, hash)
|
||||
|
||||
data, err := cReader.Code(common.Address{}, hash)
|
||||
data, err := cReader.Code(hash)
|
||||
if err != nil || len(data) == 0 {
|
||||
t.Fatalf("failed to retrieve node data for %x", hash)
|
||||
}
|
||||
|
|
@ -671,7 +671,7 @@ func testIncompleteStateSync(t *testing.T, scheme string) {
|
|||
if len(codeQueue) > 0 {
|
||||
results := make([]trie.CodeSyncResult, 0, len(codeQueue))
|
||||
for hash := range codeQueue {
|
||||
data, err := cReader.Code(common.Address{}, hash)
|
||||
data, err := cReader.Code(hash)
|
||||
if err != nil || len(data) == 0 {
|
||||
t.Fatalf("failed to retrieve node data for %x", hash)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
|
|||
|
||||
// Preload the contract code if the destination has non-empty code
|
||||
if account != nil && !bytes.Equal(account.CodeHash, types.EmptyCodeHash.Bytes()) {
|
||||
reader.Code(*tx.To(), common.BytesToHash(account.CodeHash))
|
||||
reader.Code(common.BytesToHash(account.CodeHash))
|
||||
}
|
||||
}
|
||||
for _, list := range tx.AccessList() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue