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
5553e5aa
Commit
5553e5aa
authored
Dec 10, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
states moved to chain
parent
af6afbaa
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
28 deletions
+31
-28
bindings.go
cmd/mist/bindings.go
+1
-1
debugger.go
cmd/mist/debugger.go
+2
-2
gui.go
cmd/mist/gui.go
+4
-4
ui_lib.go
cmd/mist/ui_lib.go
+1
-1
block_manager.go
core/block_manager.go
+0
-10
chain_manager.go
core/chain_manager.go
+13
-0
transaction_pool.go
core/transaction_pool.go
+1
-1
javascript_runtime.go
javascript/javascript_runtime.go
+1
-1
miner.go
miner/miner.go
+1
-1
pipe.go
xeth/pipe.go
+6
-6
world.go
xeth/world.go
+1
-1
No files found.
cmd/mist/bindings.go
View file @
5553e5aa
...
...
@@ -103,7 +103,7 @@ func (self *Gui) DumpState(hash, path string) {
var
stateDump
[]
byte
if
len
(
hash
)
==
0
{
stateDump
=
self
.
eth
.
BlockManager
()
.
Current
State
()
.
Dump
()
stateDump
=
self
.
eth
.
ChainManager
()
.
State
()
.
Dump
()
}
else
{
var
block
*
types
.
Block
if
hash
[
0
]
==
'#'
{
...
...
cmd/mist/debugger.go
View file @
5553e5aa
...
...
@@ -141,8 +141,8 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
keyPair
=
self
.
lib
.
eth
.
KeyManager
()
.
KeyPair
()
)
statedb
:=
self
.
lib
.
eth
.
Block
Manager
()
.
TransState
()
account
:=
self
.
lib
.
eth
.
Block
Manager
()
.
TransState
()
.
GetAccount
(
keyPair
.
Address
())
statedb
:=
self
.
lib
.
eth
.
Chain
Manager
()
.
TransState
()
account
:=
self
.
lib
.
eth
.
Chain
Manager
()
.
TransState
()
.
GetAccount
(
keyPair
.
Address
())
contract
:=
statedb
.
NewStateObject
([]
byte
{
0
})
contract
.
SetCode
(
script
)
contract
.
SetBalance
(
value
)
...
...
cmd/mist/gui.go
View file @
5553e5aa
...
...
@@ -401,7 +401,7 @@ func (gui *Gui) update() {
generalUpdateTicker
:=
time
.
NewTicker
(
500
*
time
.
Millisecond
)
statsUpdateTicker
:=
time
.
NewTicker
(
5
*
time
.
Second
)
state
:=
gui
.
eth
.
Block
Manager
()
.
TransState
()
state
:=
gui
.
eth
.
Chain
Manager
()
.
TransState
()
gui
.
win
.
Root
()
.
Call
(
"setWalletValue"
,
fmt
.
Sprintf
(
"%v"
,
ethutil
.
CurrencyToString
(
state
.
GetAccount
(
gui
.
address
())
.
Balance
())))
...
...
@@ -428,14 +428,14 @@ func (gui *Gui) update() {
case
core
.
NewBlockEvent
:
gui
.
processBlock
(
ev
.
Block
,
false
)
if
bytes
.
Compare
(
ev
.
Block
.
Coinbase
,
gui
.
address
())
==
0
{
gui
.
setWalletValue
(
gui
.
eth
.
BlockManager
()
.
CurrentState
()
.
GetAccount
(
gui
.
address
())
.
Balance
(
),
nil
)
gui
.
setWalletValue
(
gui
.
eth
.
ChainManager
()
.
State
()
.
GetBalance
(
gui
.
address
()
),
nil
)
}
case
core
.
TxPreEvent
:
tx
:=
ev
.
Tx
tstate
:=
gui
.
eth
.
Block
Manager
()
.
TransState
()
cstate
:=
gui
.
eth
.
BlockManager
()
.
Current
State
()
tstate
:=
gui
.
eth
.
Chain
Manager
()
.
TransState
()
cstate
:=
gui
.
eth
.
ChainManager
()
.
State
()
taccount
:=
tstate
.
GetAccount
(
gui
.
address
())
caccount
:=
cstate
.
GetAccount
(
gui
.
address
())
...
...
cmd/mist/ui_lib.go
View file @
5553e5aa
...
...
@@ -200,7 +200,7 @@ func (ui *UiLib) AssetPath(p string) string {
func
(
self
*
UiLib
)
StartDbWithContractAndData
(
contractHash
,
data
string
)
{
dbWindow
:=
NewDebuggerWindow
(
self
)
object
:=
self
.
eth
.
BlockManager
()
.
Current
State
()
.
GetStateObject
(
ethutil
.
Hex2Bytes
(
contractHash
))
object
:=
self
.
eth
.
ChainManager
()
.
State
()
.
GetStateObject
(
ethutil
.
Hex2Bytes
(
contractHash
))
if
len
(
object
.
Code
)
>
0
{
dbWindow
.
SetCode
(
"0x"
+
ethutil
.
Bytes2Hex
(
object
.
Code
))
}
...
...
core/block_manager.go
View file @
5553e5aa
...
...
@@ -84,20 +84,10 @@ func NewBlockManager(ethereum EthManager) *BlockManager {
eth
:
ethereum
,
bc
:
ethereum
.
ChainManager
(),
}
sm
.
transState
=
ethereum
.
ChainManager
()
.
CurrentBlock
.
State
()
.
Copy
()
sm
.
miningState
=
ethereum
.
ChainManager
()
.
CurrentBlock
.
State
()
.
Copy
()
return
sm
}
func
(
sm
*
BlockManager
)
CurrentState
()
*
state
.
StateDB
{
return
sm
.
eth
.
ChainManager
()
.
CurrentBlock
.
State
()
}
func
(
sm
*
BlockManager
)
TransState
()
*
state
.
StateDB
{
return
sm
.
transState
}
func
(
sm
*
BlockManager
)
TransitionState
(
statedb
*
state
.
StateDB
,
parent
,
block
*
types
.
Block
)
(
receipts
types
.
Receipts
,
err
error
)
{
coinbase
:=
statedb
.
GetOrNewStateObject
(
block
.
Coinbase
)
coinbase
.
SetGasPool
(
block
.
CalcGasLimit
(
parent
))
...
...
core/chain_manager.go
View file @
5553e5aa
...
...
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
)
var
chainlogger
=
logger
.
NewLogger
(
"CHAIN"
)
...
...
@@ -55,6 +56,8 @@ type ChainManager struct {
CurrentBlock
*
types
.
Block
LastBlockHash
[]
byte
transState
*
state
.
StateDB
}
func
NewChainManager
(
mux
*
event
.
TypeMux
)
*
ChainManager
{
...
...
@@ -64,6 +67,8 @@ func NewChainManager(mux *event.TypeMux) *ChainManager {
bc
.
setLastBlock
()
bc
.
transState
=
bc
.
State
()
.
Copy
()
return
bc
}
...
...
@@ -71,6 +76,14 @@ func (self *ChainManager) SetProcessor(proc types.BlockProcessor) {
self
.
processor
=
proc
}
func
(
self
*
ChainManager
)
State
()
*
state
.
StateDB
{
return
self
.
CurrentBlock
.
State
()
}
func
(
self
*
ChainManager
)
TransState
()
*
state
.
StateDB
{
return
self
.
transState
}
func
(
bc
*
ChainManager
)
setLastBlock
()
{
data
,
_
:=
ethutil
.
Config
.
Db
.
Get
([]
byte
(
"LastBlock"
))
if
len
(
data
)
!=
0
{
...
...
core/transaction_pool.go
View file @
5553e5aa
...
...
@@ -116,7 +116,7 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
}
// Get the sender
sender
:=
pool
.
Ethereum
.
BlockManager
()
.
Current
State
()
.
GetAccount
(
tx
.
Sender
())
sender
:=
pool
.
Ethereum
.
ChainManager
()
.
State
()
.
GetAccount
(
tx
.
Sender
())
totAmount
:=
new
(
big
.
Int
)
.
Set
(
tx
.
Value
)
// Make sure there's enough in the sender's account. Having insufficient
...
...
javascript/javascript_runtime.go
View file @
5553e5aa
...
...
@@ -150,7 +150,7 @@ func (self *JSRE) dump(call otto.FunctionCall) otto.Value {
state
=
block
.
State
()
}
else
{
state
=
self
.
ethereum
.
BlockManager
()
.
Current
State
()
state
=
self
.
ethereum
.
ChainManager
()
.
State
()
}
v
,
_
:=
self
.
Vm
.
ToValue
(
state
.
Dump
())
...
...
miner/miner.go
View file @
5553e5aa
...
...
@@ -232,7 +232,7 @@ func (self *Miner) finiliseTxs() types.Transactions {
actualSize
:=
len
(
self
.
localTxs
)
// See copy below
txs
:=
make
(
types
.
Transactions
,
actualSize
+
self
.
eth
.
TxPool
()
.
Size
())
state
:=
self
.
eth
.
Block
Manager
()
.
TransState
()
state
:=
self
.
eth
.
Chain
Manager
()
.
TransState
()
// XXX This has to change. Coinbase is, for new, same as key.
key
:=
self
.
eth
.
KeyManager
()
for
i
,
ltx
:=
range
self
.
localTxs
{
...
...
xeth/pipe.go
View file @
5553e5aa
...
...
@@ -22,7 +22,7 @@ type VmVars struct {
type
XEth
struct
{
obj
core
.
EthManager
blockManager
*
core
.
BlockManager
blockChain
*
core
.
ChainManager
chainManager
*
core
.
ChainManager
world
*
World
Vm
VmVars
...
...
@@ -32,7 +32,7 @@ func New(obj core.EthManager) *XEth {
pipe
:=
&
XEth
{
obj
:
obj
,
blockManager
:
obj
.
BlockManager
(),
blockChain
:
obj
.
ChainManager
(),
chainManager
:
obj
.
ChainManager
(),
}
pipe
.
world
=
NewWorld
(
pipe
)
...
...
@@ -51,7 +51,7 @@ func (self *XEth) Nonce(addr []byte) uint64 {
}
func
(
self
*
XEth
)
Block
(
hash
[]
byte
)
*
types
.
Block
{
return
self
.
blockChain
.
GetBlock
(
hash
)
return
self
.
chainManager
.
GetBlock
(
hash
)
}
func
(
self
*
XEth
)
Storage
(
addr
,
storageAddr
[]
byte
)
*
ethutil
.
Value
{
...
...
@@ -82,7 +82,7 @@ func (self *XEth) Execute(addr []byte, data []byte, value, gas, price *ethutil.V
func
(
self
*
XEth
)
ExecuteObject
(
object
*
Object
,
data
[]
byte
,
value
,
gas
,
price
*
ethutil
.
Value
)
([]
byte
,
error
)
{
var
(
initiator
=
state
.
NewStateObject
(
self
.
obj
.
KeyManager
()
.
KeyPair
()
.
Address
())
block
=
self
.
blockChain
.
CurrentBlock
block
=
self
.
chainManager
.
CurrentBlock
)
self
.
Vm
.
State
=
self
.
World
()
.
State
()
.
Copy
()
...
...
@@ -131,14 +131,14 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et
tx
=
types
.
NewTransactionMessage
(
hash
,
value
.
BigInt
(),
gas
.
BigInt
(),
price
.
BigInt
(),
data
)
}
state
:=
self
.
block
Manager
.
TransState
()
state
:=
self
.
chain
Manager
.
TransState
()
nonce
:=
state
.
GetNonce
(
key
.
Address
())
tx
.
Nonce
=
nonce
tx
.
Sign
(
key
.
PrivateKey
)
// Do some pre processing for our "pre" events and hooks
block
:=
self
.
blockChain
.
NewBlock
(
key
.
Address
())
block
:=
self
.
chainManager
.
NewBlock
(
key
.
Address
())
coinbase
:=
state
.
GetStateObject
(
key
.
Address
())
coinbase
.
SetGasPool
(
block
.
GasLimit
)
self
.
blockManager
.
ApplyTransactions
(
coinbase
,
state
,
block
,
types
.
Transactions
{
tx
},
true
)
...
...
xeth/world.go
View file @
5553e5aa
...
...
@@ -23,7 +23,7 @@ func (self *XEth) World() *World {
}
func
(
self
*
World
)
State
()
*
state
.
StateDB
{
return
self
.
pipe
.
blockManager
.
Current
State
()
return
self
.
pipe
.
chainManager
.
State
()
}
func
(
self
*
World
)
Get
(
addr
[]
byte
)
*
Object
{
...
...
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