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
35ae9e3a
Commit
35ae9e3a
authored
Jul 02, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Paranoia check
parent
2f9bc2ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
state_manager.go
ethchain/state_manager.go
+9
-0
state_transition.go
ethchain/state_transition.go
+4
-12
No files found.
ethchain/state_manager.go
View file @
35ae9e3a
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"fmt"
"fmt"
"github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethwire"
"math/big"
"math/big"
...
@@ -204,7 +205,15 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) {
...
@@ -204,7 +205,15 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) {
return
err
return
err
}
}
if
ethutil
.
Config
.
Paranoia
{
valid
,
_
:=
ethtrie
.
ParanoiaCheck
(
state
.
trie
)
if
!
valid
{
err
=
fmt
.
Errorf
(
"PARANOIA: World state trie comparison failed"
)
}
}
if
!
block
.
State
()
.
Cmp
(
state
)
{
if
!
block
.
State
()
.
Cmp
(
state
)
{
err
=
fmt
.
Errorf
(
"Invalid merkle root.
\n
rec: %x
\n
is: %x"
,
block
.
State
()
.
trie
.
Root
,
state
.
trie
.
Root
)
err
=
fmt
.
Errorf
(
"Invalid merkle root.
\n
rec: %x
\n
is: %x"
,
block
.
State
()
.
trie
.
Root
,
state
.
trie
.
Root
)
return
return
}
}
...
...
ethchain/state_transition.go
View file @
35ae9e3a
package
ethchain
package
ethchain
import
(
import
(
"bytes"
"fmt"
"fmt"
"github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
...
@@ -264,23 +263,16 @@ func Call(vm *Vm, closure *Closure, data []byte) (ret []byte, err error, deepErr
...
@@ -264,23 +263,16 @@ func Call(vm *Vm, closure *Closure, data []byte) (ret []byte, err error, deepErr
ret
,
_
,
err
=
closure
.
Call
(
vm
,
data
)
ret
,
_
,
err
=
closure
.
Call
(
vm
,
data
)
deepErr
=
vm
.
err
!=
nil
deepErr
=
vm
.
err
!=
nil
Paranoia
:=
ethutil
.
Config
.
Paranoia
if
ethutil
.
Config
.
Paranoia
{
if
Paranoia
{
var
(
var
(
context
=
closure
.
object
context
=
closure
.
object
trie
=
context
.
state
.
trie
trie
=
context
.
state
.
trie
trie2
=
ethtrie
.
NewTrie
(
ethutil
.
Config
.
Db
,
""
)
)
)
trie
.
NewIterator
()
.
Each
(
func
(
key
string
,
v
*
ethutil
.
Value
)
{
valid
,
t2
:=
ethtrie
.
ParanoiaCheck
(
trie
)
trie2
.
Update
(
key
,
v
.
Str
())
if
!
valid
{
})
a
:=
ethutil
.
NewValue
(
trie2
.
Root
)
.
Bytes
()
b
:=
ethutil
.
NewValue
(
context
.
state
.
trie
.
Root
)
.
Bytes
()
if
bytes
.
Compare
(
a
,
b
)
!=
0
{
// TODO FIXME ASAP
// TODO FIXME ASAP
context
.
state
.
trie
=
t
rie
2
context
.
state
.
trie
=
t2
/*
/*
statelogger.Debugf("(o): %x\n", trie.Root)
statelogger.Debugf("(o): %x\n", trie.Root)
trie.NewIterator().Each(func(key string, v *ethutil.Value) {
trie.NewIterator().Each(func(key string, v *ethutil.Value) {
...
...
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