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
c734dde9
Commit
c734dde9
authored
Jun 13, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments & refactor
parent
cebf4e36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
state_manager.go
ethchain/state_manager.go
+3
-1
state_transition.go
ethchain/state_transition.go
+16
-4
No files found.
ethchain/state_manager.go
View file @
c734dde9
...
...
@@ -124,6 +124,9 @@ done:
}
}
// Notify all subscribers
self
.
Ethereum
.
Reactor
()
.
Post
(
"newTx:post"
,
tx
)
txGas
.
Sub
(
txGas
,
st
.
gas
)
accumelative
:=
new
(
big
.
Int
)
.
Set
(
totalUsedGas
.
Add
(
totalUsedGas
,
txGas
))
receipt
:=
&
Receipt
{
tx
,
ethutil
.
CopyBytes
(
state
.
Root
()
.
([]
byte
)),
accumelative
}
...
...
@@ -158,7 +161,6 @@ func (sm *StateManager) ProcessBlock(state *State, parent, block *Block, dontRea
hash
:=
block
.
Hash
()
if
sm
.
bc
.
HasBlock
(
hash
)
{
//fmt.Println("[STATE] We already have this block, ignoring")
return
nil
}
...
...
ethchain/state_transition.go
View file @
c734dde9
...
...
@@ -6,6 +6,22 @@ import (
"math/big"
)
/*
* The State transitioning model
*
* A state transition is a change made when a transaction is applied to the current world state
* The state transitioning model does all all the necessary work to work out a valid new state root.
* 1) Nonce handling
* 2) Pre pay / buy gas of the coinbase (miner)
* 3) Create a new state object if the recipient is \0*32
* 4) Value transfer
* == If contract creation ==
* 4a) Attempt to run transaction data
* 4b) If valid, use result as code for the new state object
* == end ==
* 5) Run Script section
* 6) Derive new state root
*/
type
StateTransition
struct
{
coinbase
[]
byte
tx
*
Transaction
...
...
@@ -115,10 +131,6 @@ func (self *StateTransition) TransitionState() (err error) {
}
sender
.
Nonce
+=
1
defer
func
()
{
// Notify all subscribers
//self.Ethereum.Reactor().Post("newTx:post", tx)
}()
if
err
=
self
.
BuyGas
();
err
!=
nil
{
return
err
...
...
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