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
3ee0461c
Commit
3ee0461c
authored
Oct 31, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved ethchain to chain
parent
8e0a39f3
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
142 additions
and
142 deletions
+142
-142
block_pool.go
block_pool.go
+8
-8
.gitignore
chain/.gitignore
+0
-0
asm.go
chain/asm.go
+1
-1
block.go
chain/block.go
+1
-1
bloom.go
chain/bloom.go
+1
-1
bloom9.go
chain/bloom9.go
+1
-1
bloom9_test.go
chain/bloom9_test.go
+1
-1
bloom_test.go
chain/bloom_test.go
+1
-1
chain_manager.go
chain/chain_manager.go
+1
-1
chain_manager_test.go
chain/chain_manager_test.go
+1
-0
dagger.go
chain/dagger.go
+1
-1
dagger_test.go
chain/dagger_test.go
+1
-1
derive_sha.go
chain/derive_sha.go
+1
-1
error.go
chain/error.go
+1
-1
events.go
chain/events.go
+1
-1
fees.go
chain/fees.go
+1
-1
filter.go
chain/filter.go
+1
-1
filter_test.go
chain/filter_test.go
+1
-1
genesis.go
chain/genesis.go
+1
-1
helper_test.go
chain/helper_test.go
+1
-1
state_manager.go
chain/state_manager.go
+1
-1
state_transition.go
chain/state_transition.go
+1
-1
transaction.go
chain/transaction.go
+1
-1
transaction_pool.go
chain/transaction_pool.go
+1
-1
transaction_test.go
chain/transaction_test.go
+1
-0
types.go
chain/types.go
+1
-1
vm_env.go
chain/vm_env.go
+1
-1
bindings.go
cmd/mist/bindings.go
+2
-2
debugger.go
cmd/mist/debugger.go
+2
-2
ext_app.go
cmd/mist/ext_app.go
+7
-7
gui.go
cmd/mist/gui.go
+10
-10
html_container.go
cmd/mist/html_container.go
+2
-2
qml_container.go
cmd/mist/qml_container.go
+2
-2
ui_lib.go
cmd/mist/ui_lib.go
+4
-4
chain_manager_test.go
ethchain/chain_manager_test.go
+0
-1
transaction_test.go
ethchain/transaction_test.go
+0
-1
ethereum.go
ethereum.go
+16
-16
miner.go
ethminer/miner.go
+15
-15
js_pipe.go
ethpipe/js_pipe.go
+7
-7
js_types.go
ethpipe/js_types.go
+8
-8
pipe.go
ethpipe/pipe.go
+10
-10
vm_env.go
ethpipe/vm_env.go
+3
-3
javascript_runtime.go
javascript/javascript_runtime.go
+3
-3
peer.go
peer.go
+6
-6
filter.go
ui/filter.go
+6
-6
filter.go
ui/qt/filter.go
+3
-3
vm_env.go
utils/vm_env.go
+3
-3
No files found.
block_pool.go
View file @
3ee0461c
...
...
@@ -9,7 +9,7 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethwire"
...
...
@@ -20,7 +20,7 @@ var poollogger = ethlog.NewLogger("BPOOL")
type
block
struct
{
from
*
Peer
peer
*
Peer
block
*
eth
chain
.
Block
block
*
chain
.
Block
reqAt
time
.
Time
requested
int
}
...
...
@@ -73,7 +73,7 @@ func (self *BlockPool) HasCommonHash(hash []byte) bool {
return
self
.
eth
.
ChainManager
()
.
GetBlock
(
hash
)
!=
nil
}
func
(
self
*
BlockPool
)
Blocks
()
(
blocks
eth
chain
.
Blocks
)
{
func
(
self
*
BlockPool
)
Blocks
()
(
blocks
chain
.
Blocks
)
{
for
_
,
item
:=
range
self
.
pool
{
if
item
.
block
!=
nil
{
blocks
=
append
(
blocks
,
item
.
block
)
...
...
@@ -123,15 +123,15 @@ func (self *BlockPool) AddHash(hash []byte, peer *Peer) {
}
}
func
(
self
*
BlockPool
)
Add
(
b
*
eth
chain
.
Block
,
peer
*
Peer
)
{
func
(
self
*
BlockPool
)
Add
(
b
*
chain
.
Block
,
peer
*
Peer
)
{
self
.
addBlock
(
b
,
peer
,
false
)
}
func
(
self
*
BlockPool
)
AddNew
(
b
*
eth
chain
.
Block
,
peer
*
Peer
)
{
func
(
self
*
BlockPool
)
AddNew
(
b
*
chain
.
Block
,
peer
*
Peer
)
{
self
.
addBlock
(
b
,
peer
,
true
)
}
func
(
self
*
BlockPool
)
addBlock
(
b
*
eth
chain
.
Block
,
peer
*
Peer
,
newBlock
bool
)
{
func
(
self
*
BlockPool
)
addBlock
(
b
*
chain
.
Block
,
peer
*
Peer
,
newBlock
bool
)
{
self
.
mut
.
Lock
()
defer
self
.
mut
.
Unlock
()
...
...
@@ -262,7 +262,7 @@ out:
/*
if !self.fetchingHashes {
blocks := self.Blocks()
ethchain.BlockBy(eth
chain.Number).Sort(blocks)
chain.BlockBy(
chain.Number).Sort(blocks)
if len(blocks) > 0 {
if !self.eth.ChainManager().HasBlock(b.PrevHash) && self.pool[string(b.PrevHash)] == nil && !self.fetchingHashes {
...
...
@@ -283,7 +283,7 @@ out:
break
out
case
<-
procTimer
.
C
:
blocks
:=
self
.
Blocks
()
ethchain
.
BlockBy
(
eth
chain
.
Number
)
.
Sort
(
blocks
)
chain
.
BlockBy
(
chain
.
Number
)
.
Sort
(
blocks
)
// Find common block
for
i
,
block
:=
range
blocks
{
...
...
eth
chain/.gitignore
→
chain/.gitignore
View file @
3ee0461c
File moved
eth
chain/asm.go
→
chain/asm.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"fmt"
...
...
eth
chain/block.go
→
chain/block.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"bytes"
...
...
eth
chain/bloom.go
→
chain/bloom.go
View file @
3ee0461c
package
eth
chain
package
chain
type
BloomFilter
struct
{
bin
[]
byte
...
...
eth
chain/bloom9.go
→
chain/bloom9.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"math/big"
...
...
eth
chain/bloom9_test.go
→
chain/bloom9_test.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"testing"
...
...
eth
chain/bloom_test.go
→
chain/bloom_test.go
View file @
3ee0461c
package
eth
chain
package
chain
import
"testing"
...
...
eth
chain/chain_manager.go
→
chain/chain_manager.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"bytes"
...
...
chain/chain_manager_test.go
0 → 100644
View file @
3ee0461c
package
chain
eth
chain/dagger.go
→
chain/dagger.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"hash"
...
...
eth
chain/dagger_test.go
→
chain/dagger_test.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"math/big"
...
...
eth
chain/derive_sha.go
→
chain/derive_sha.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"github.com/ethereum/go-ethereum/ethtrie"
...
...
eth
chain/error.go
→
chain/error.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"fmt"
...
...
eth
chain/events.go
→
chain/events.go
View file @
3ee0461c
package
eth
chain
package
chain
// TxPreEvent is posted when a transaction enters the transaction pool.
type
TxPreEvent
struct
{
Tx
*
Transaction
}
...
...
eth
chain/fees.go
→
chain/fees.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"math/big"
...
...
eth
chain/filter.go
→
chain/filter.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"bytes"
...
...
eth
chain/filter_test.go
→
chain/filter_test.go
View file @
3ee0461c
package
eth
chain
package
chain
import
"testing"
...
...
eth
chain/genesis.go
→
chain/genesis.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"math/big"
...
...
eth
chain/helper_test.go
→
chain/helper_test.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"container/list"
...
...
eth
chain/state_manager.go
→
chain/state_manager.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"bytes"
...
...
eth
chain/state_transition.go
→
chain/state_transition.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"fmt"
...
...
eth
chain/transaction.go
→
chain/transaction.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"bytes"
...
...
eth
chain/transaction_pool.go
→
chain/transaction_pool.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"bytes"
...
...
chain/transaction_test.go
0 → 100644
View file @
3ee0461c
package
chain
eth
chain/types.go
→
chain/types.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"fmt"
...
...
eth
chain/vm_env.go
→
chain/vm_env.go
View file @
3ee0461c
package
eth
chain
package
chain
import
(
"math/big"
...
...
cmd/mist/bindings.go
View file @
3ee0461c
...
...
@@ -22,7 +22,7 @@ import (
"os"
"strconv"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethutil"
...
...
@@ -110,7 +110,7 @@ func (self *Gui) DumpState(hash, path string) {
if
len
(
hash
)
==
0
{
stateDump
=
self
.
eth
.
StateManager
()
.
CurrentState
()
.
Dump
()
}
else
{
var
block
*
eth
chain
.
Block
var
block
*
chain
.
Block
if
hash
[
0
]
==
'#'
{
i
,
_
:=
strconv
.
Atoi
(
hash
[
1
:
])
block
=
self
.
eth
.
ChainManager
()
.
GetBlockByNumber
(
uint64
(
i
))
...
...
cmd/mist/debugger.go
View file @
3ee0461c
...
...
@@ -24,7 +24,7 @@ import (
"strings"
"unicode"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/utils"
...
...
@@ -81,7 +81,7 @@ func (self *DebuggerWindow) SetData(data string) {
func
(
self
*
DebuggerWindow
)
SetAsm
(
data
[]
byte
)
{
self
.
win
.
Root
()
.
Call
(
"clearAsm"
)
dis
:=
eth
chain
.
Disassemble
(
data
)
dis
:=
chain
.
Disassemble
(
data
)
for
_
,
str
:=
range
dis
{
self
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
}
...
...
cmd/mist/ext_app.go
View file @
3ee0461c
...
...
@@ -20,7 +20,7 @@ package main
import
(
"encoding/json"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/event"
...
...
@@ -36,7 +36,7 @@ type AppContainer interface {
Window
()
*
qml
.
Window
Engine
()
*
qml
.
Engine
NewBlock
(
*
eth
chain
.
Block
)
NewBlock
(
*
chain
.
Block
)
NewWatcher
(
chan
bool
)
Messages
(
ethstate
.
Messages
,
string
)
Post
(
string
,
int
)
...
...
@@ -44,12 +44,12 @@ type AppContainer interface {
type
ExtApplication
struct
{
*
ethpipe
.
JSPipe
eth
eth
chain
.
EthManager
eth
chain
.
EthManager
events
event
.
Subscription
watcherQuitChan
chan
bool
filters
map
[
string
]
*
eth
chain
.
Filter
filters
map
[
string
]
*
chain
.
Filter
container
AppContainer
lib
*
UiLib
...
...
@@ -60,7 +60,7 @@ func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
JSPipe
:
ethpipe
.
NewJSPipe
(
lib
.
eth
),
eth
:
lib
.
eth
,
watcherQuitChan
:
make
(
chan
bool
),
filters
:
make
(
map
[
string
]
*
eth
chain
.
Filter
),
filters
:
make
(
map
[
string
]
*
chain
.
Filter
),
container
:
container
,
lib
:
lib
,
}
...
...
@@ -80,7 +80,7 @@ func (app *ExtApplication) run() {
// Subscribe to events
mux
:=
app
.
lib
.
eth
.
EventMux
()
app
.
events
=
mux
.
Subscribe
(
eth
chain
.
NewBlockEvent
{},
ethstate
.
Messages
(
nil
))
app
.
events
=
mux
.
Subscribe
(
chain
.
NewBlockEvent
{},
ethstate
.
Messages
(
nil
))
// Call the main loop
go
app
.
mainLoop
()
...
...
@@ -106,7 +106,7 @@ func (app *ExtApplication) stop() {
func
(
app
*
ExtApplication
)
mainLoop
()
{
for
ev
:=
range
app
.
events
.
Chan
()
{
switch
ev
:=
ev
.
(
type
)
{
case
eth
chain
.
NewBlockEvent
:
case
chain
.
NewBlockEvent
:
app
.
container
.
NewBlock
(
ev
.
Block
)
case
ethstate
.
Messages
:
...
...
cmd/mist/gui.go
View file @
3ee0461c
...
...
@@ -31,7 +31,7 @@ import (
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethminer"
...
...
@@ -286,7 +286,7 @@ func (gui *Gui) loadAddressBook() {
}
}
func
(
gui
*
Gui
)
insertTransaction
(
window
string
,
tx
*
eth
chain
.
Transaction
)
{
func
(
gui
*
Gui
)
insertTransaction
(
window
string
,
tx
*
chain
.
Transaction
)
{
pipe
:=
ethpipe
.
New
(
gui
.
eth
)
nameReg
:=
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
addr
:=
gui
.
address
()
...
...
@@ -336,7 +336,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
func
(
gui
*
Gui
)
readPreviousTransactions
()
{
it
:=
gui
.
txDb
.
Db
()
.
NewIterator
(
nil
,
nil
)
for
it
.
Next
()
{
tx
:=
eth
chain
.
NewTransactionFromBytes
(
it
.
Value
())
tx
:=
chain
.
NewTransactionFromBytes
(
it
.
Value
())
gui
.
insertTransaction
(
"post"
,
tx
)
...
...
@@ -344,7 +344,7 @@ func (gui *Gui) readPreviousTransactions() {
it
.
Release
()
}
func
(
gui
*
Gui
)
processBlock
(
block
*
eth
chain
.
Block
,
initial
bool
)
{
func
(
gui
*
Gui
)
processBlock
(
block
*
chain
.
Block
,
initial
bool
)
{
name
:=
strings
.
Trim
(
gui
.
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
.
Storage
(
block
.
Coinbase
)
.
Str
(),
"
\x00
"
)
b
:=
ethpipe
.
NewJSBlock
(
block
)
b
.
Name
=
name
...
...
@@ -407,9 +407,9 @@ func (gui *Gui) update() {
events
:=
gui
.
eth
.
EventMux
()
.
Subscribe
(
eth
.
ChainSyncEvent
{},
eth
.
PeerListEvent
{},
eth
chain
.
NewBlockEvent
{},
eth
chain
.
TxPreEvent
{},
eth
chain
.
TxPostEvent
{},
chain
.
NewBlockEvent
{},
chain
.
TxPreEvent
{},
chain
.
TxPostEvent
{},
ethminer
.
Event
{},
)
...
...
@@ -425,13 +425,13 @@ func (gui *Gui) update() {
return
}
switch
ev
:=
ev
.
(
type
)
{
case
eth
chain
.
NewBlockEvent
:
case
chain
.
NewBlockEvent
:
gui
.
processBlock
(
ev
.
Block
,
false
)
if
bytes
.
Compare
(
ev
.
Block
.
Coinbase
,
gui
.
address
())
==
0
{
gui
.
setWalletValue
(
gui
.
eth
.
StateManager
()
.
CurrentState
()
.
GetAccount
(
gui
.
address
())
.
Balance
(),
nil
)
}
case
eth
chain
.
TxPreEvent
:
case
chain
.
TxPreEvent
:
tx
:=
ev
.
Tx
object
:=
state
.
GetAccount
(
gui
.
address
())
...
...
@@ -444,7 +444,7 @@ func (gui *Gui) update() {
gui
.
setWalletValue
(
object
.
Balance
(),
unconfirmedFunds
)
gui
.
insertTransaction
(
"pre"
,
tx
)
case
eth
chain
.
TxPostEvent
:
case
chain
.
TxPostEvent
:
tx
:=
ev
.
Tx
object
:=
state
.
GetAccount
(
gui
.
address
())
...
...
cmd/mist/html_container.go
View file @
3ee0461c
...
...
@@ -27,7 +27,7 @@ import (
"path"
"path/filepath"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
...
...
@@ -138,7 +138,7 @@ func (app *HtmlApplication) Window() *qml.Window {
return
app
.
win
}
func
(
app
*
HtmlApplication
)
NewBlock
(
block
*
eth
chain
.
Block
)
{
func
(
app
*
HtmlApplication
)
NewBlock
(
block
*
chain
.
Block
)
{
b
:=
&
ethpipe
.
JSBlock
{
Number
:
int
(
block
.
BlockInfo
()
.
Number
),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
())}
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
}
...
...
cmd/mist/qml_container.go
View file @
3ee0461c
...
...
@@ -21,7 +21,7 @@ import (
"fmt"
"runtime"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
...
...
@@ -65,7 +65,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
}
// Events
func
(
app
*
QmlApplication
)
NewBlock
(
block
*
eth
chain
.
Block
)
{
func
(
app
*
QmlApplication
)
NewBlock
(
block
*
chain
.
Block
)
{
pblock
:=
&
ethpipe
.
JSBlock
{
Number
:
int
(
block
.
BlockInfo
()
.
Number
),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
())}
app
.
win
.
Call
(
"onNewBlockCb"
,
pblock
)
}
...
...
cmd/mist/ui_lib.go
View file @
3ee0461c
...
...
@@ -25,7 +25,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
...
...
@@ -120,7 +120,7 @@ func (self *UiLib) PastPeers() *ethutil.List {
}
func
(
self
*
UiLib
)
ImportTx
(
rlpTx
string
)
{
tx
:=
eth
chain
.
NewTransactionFromBytes
(
ethutil
.
Hex2Bytes
(
rlpTx
))
tx
:=
chain
.
NewTransactionFromBytes
(
ethutil
.
Hex2Bytes
(
rlpTx
))
self
.
eth
.
TxPool
()
.
QueueTransaction
(
tx
)
}
...
...
@@ -221,8 +221,8 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) {
}
func
(
self
*
UiLib
)
NewFilterString
(
typ
string
)
(
id
int
)
{
filter
:=
eth
chain
.
NewFilter
(
self
.
eth
)
filter
.
BlockCallback
=
func
(
block
*
eth
chain
.
Block
)
{
filter
:=
chain
.
NewFilter
(
self
.
eth
)
filter
.
BlockCallback
=
func
(
block
*
chain
.
Block
)
{
self
.
win
.
Root
()
.
Call
(
"invokeFilterCallback"
,
"{}"
,
id
)
}
id
=
self
.
eth
.
InstallFilter
(
filter
)
...
...
ethchain/chain_manager_test.go
deleted
100644 → 0
View file @
8e0a39f3
package
ethchain
ethchain/transaction_test.go
deleted
100644 → 0
View file @
8e0a39f3
package
ethchain
ethereum.go
View file @
3ee0461c
...
...
@@ -14,7 +14,7 @@ import (
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
...
...
@@ -50,12 +50,12 @@ type Ethereum struct {
// DB interface
db
ethutil
.
Database
// State manager for processing new blocks and managing the over all states
stateManager
*
eth
chain
.
StateManager
stateManager
*
chain
.
StateManager
// The transaction pool. Transaction can be pushed on this pool
// for later including in the blocks
txPool
*
eth
chain
.
TxPool
txPool
*
chain
.
TxPool
// The canonical chain
blockChain
*
eth
chain
.
ChainManager
blockChain
*
chain
.
ChainManager
// The block pool
blockPool
*
BlockPool
// Eventer
...
...
@@ -94,7 +94,7 @@ type Ethereum struct {
filterMu
sync
.
RWMutex
filterId
int
filters
map
[
int
]
*
eth
chain
.
Filter
filters
map
[
int
]
*
chain
.
Filter
}
func
New
(
db
ethutil
.
Database
,
clientIdentity
ethwire
.
ClientIdentity
,
keyManager
*
ethcrypto
.
KeyManager
,
caps
Caps
,
usePnp
bool
)
(
*
Ethereum
,
error
)
{
...
...
@@ -124,13 +124,13 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager
keyManager
:
keyManager
,
clientIdentity
:
clientIdentity
,
isUpToDate
:
true
,
filters
:
make
(
map
[
int
]
*
eth
chain
.
Filter
),
filters
:
make
(
map
[
int
]
*
chain
.
Filter
),
}
ethereum
.
blockPool
=
NewBlockPool
(
ethereum
)
ethereum
.
txPool
=
eth
chain
.
NewTxPool
(
ethereum
)
ethereum
.
blockChain
=
eth
chain
.
NewChainManager
(
ethereum
)
ethereum
.
stateManager
=
eth
chain
.
NewStateManager
(
ethereum
)
ethereum
.
txPool
=
chain
.
NewTxPool
(
ethereum
)
ethereum
.
blockChain
=
chain
.
NewChainManager
(
ethereum
)
ethereum
.
stateManager
=
chain
.
NewStateManager
(
ethereum
)
// Start the tx pool
ethereum
.
txPool
.
Start
()
...
...
@@ -146,15 +146,15 @@ func (s *Ethereum) ClientIdentity() ethwire.ClientIdentity {
return
s
.
clientIdentity
}
func
(
s
*
Ethereum
)
ChainManager
()
*
eth
chain
.
ChainManager
{
func
(
s
*
Ethereum
)
ChainManager
()
*
chain
.
ChainManager
{
return
s
.
blockChain
}
func
(
s
*
Ethereum
)
StateManager
()
*
eth
chain
.
StateManager
{
func
(
s
*
Ethereum
)
StateManager
()
*
chain
.
StateManager
{
return
s
.
stateManager
}
func
(
s
*
Ethereum
)
TxPool
()
*
eth
chain
.
TxPool
{
func
(
s
*
Ethereum
)
TxPool
()
*
chain
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
Ethereum
)
BlockPool
()
*
BlockPool
{
...
...
@@ -590,7 +590,7 @@ out:
// InstallFilter adds filter for blockchain events.
// The filter's callbacks will run for matching blocks and messages.
// The filter should not be modified after it has been installed.
func
(
self
*
Ethereum
)
InstallFilter
(
filter
*
eth
chain
.
Filter
)
(
id
int
)
{
func
(
self
*
Ethereum
)
InstallFilter
(
filter
*
chain
.
Filter
)
(
id
int
)
{
self
.
filterMu
.
Lock
()
id
=
self
.
filterId
self
.
filters
[
id
]
=
filter
...
...
@@ -607,7 +607,7 @@ func (self *Ethereum) UninstallFilter(id int) {
// GetFilter retrieves a filter installed using InstallFilter.
// The filter may not be modified.
func
(
self
*
Ethereum
)
GetFilter
(
id
int
)
*
eth
chain
.
Filter
{
func
(
self
*
Ethereum
)
GetFilter
(
id
int
)
*
chain
.
Filter
{
self
.
filterMu
.
RLock
()
defer
self
.
filterMu
.
RUnlock
()
return
self
.
filters
[
id
]
...
...
@@ -615,10 +615,10 @@ func (self *Ethereum) GetFilter(id int) *ethchain.Filter {
func
(
self
*
Ethereum
)
filterLoop
()
{
// Subscribe to events
events
:=
self
.
eventMux
.
Subscribe
(
eth
chain
.
NewBlockEvent
{},
ethstate
.
Messages
(
nil
))
events
:=
self
.
eventMux
.
Subscribe
(
chain
.
NewBlockEvent
{},
ethstate
.
Messages
(
nil
))
for
event
:=
range
events
.
Chan
()
{
switch
event
:=
event
.
(
type
)
{
case
eth
chain
.
NewBlockEvent
:
case
chain
.
NewBlockEvent
:
self
.
filterMu
.
RLock
()
for
_
,
filter
:=
range
self
.
filters
{
if
filter
.
BlockCallback
!=
nil
{
...
...
ethminer/miner.go
View file @
3ee0461c
...
...
@@ -4,7 +4,7 @@ import (
"bytes"
"sort"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethwire"
"github.com/ethereum/go-ethereum/event"
...
...
@@ -13,12 +13,12 @@ import (
var
logger
=
ethlog
.
NewLogger
(
"MINER"
)
type
Miner
struct
{
pow
eth
chain
.
PoW
ethereum
eth
chain
.
EthManager
pow
chain
.
PoW
ethereum
chain
.
EthManager
coinbase
[]
byte
txs
eth
chain
.
Transactions
uncles
[]
*
eth
chain
.
Block
block
*
eth
chain
.
Block
txs
chain
.
Transactions
uncles
[]
*
chain
.
Block
block
*
chain
.
Block
events
event
.
Subscription
powQuitChan
chan
struct
{}
...
...
@@ -37,13 +37,13 @@ type Event struct {
Miner
*
Miner
}
func
(
self
*
Miner
)
GetPow
()
eth
chain
.
PoW
{
func
(
self
*
Miner
)
GetPow
()
chain
.
PoW
{
return
self
.
pow
}
func
NewDefaultMiner
(
coinbase
[]
byte
,
ethereum
eth
chain
.
EthManager
)
*
Miner
{
func
NewDefaultMiner
(
coinbase
[]
byte
,
ethereum
chain
.
EthManager
)
*
Miner
{
miner
:=
Miner
{
pow
:
&
eth
chain
.
EasyPow
{},
pow
:
&
chain
.
EasyPow
{},
ethereum
:
ethereum
,
coinbase
:
coinbase
,
}
...
...
@@ -64,7 +64,7 @@ func (miner *Miner) Start() {
miner
.
block
=
miner
.
ethereum
.
ChainManager
()
.
NewBlock
(
miner
.
coinbase
)
mux
:=
miner
.
ethereum
.
EventMux
()
miner
.
events
=
mux
.
Subscribe
(
ethchain
.
NewBlockEvent
{},
eth
chain
.
TxPreEvent
{})
miner
.
events
=
mux
.
Subscribe
(
chain
.
NewBlockEvent
{},
chain
.
TxPreEvent
{})
// Prepare inital block
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
...
...
@@ -87,7 +87,7 @@ func (miner *Miner) listener() {
select
{
case
event
:=
<-
miner
.
events
.
Chan
()
:
switch
event
:=
event
.
(
type
)
{
case
eth
chain
.
NewBlockEvent
:
case
chain
.
NewBlockEvent
:
miner
.
stopMining
()
block
:=
event
.
Block
...
...
@@ -97,7 +97,7 @@ func (miner *Miner) listener() {
//logger.Infoln("New top block found resetting state")
// Filter out which Transactions we have that were not in this block
var
newtxs
[]
*
eth
chain
.
Transaction
var
newtxs
[]
*
chain
.
Transaction
for
_
,
tx
:=
range
miner
.
txs
{
found
:=
false
for
_
,
othertx
:=
range
block
.
Transactions
()
{
...
...
@@ -118,7 +118,7 @@ func (miner *Miner) listener() {
}
miner
.
startMining
()
case
eth
chain
.
TxPreEvent
:
case
chain
.
TxPreEvent
:
miner
.
stopMining
()
found
:=
false
...
...
@@ -171,7 +171,7 @@ func (self *Miner) mineNewBlock() {
}
// Sort the transactions by nonce in case of odd network propagation
sort
.
Sort
(
eth
chain
.
TxByNonce
{
self
.
txs
})
sort
.
Sort
(
chain
.
TxByNonce
{
self
.
txs
})
// Accumulate all valid transactions and apply them to the new state
// Error may be ignored. It's not important during mining
...
...
@@ -208,7 +208,7 @@ func (self *Miner) mineNewBlock() {
logger
.
Infoln
(
self
.
block
)
// Gather the new batch of transactions currently in the tx pool
self
.
txs
=
self
.
ethereum
.
TxPool
()
.
CurrentTransactions
()
self
.
ethereum
.
EventMux
()
.
Post
(
eth
chain
.
NewBlockEvent
{
self
.
block
})
self
.
ethereum
.
EventMux
()
.
Post
(
chain
.
NewBlockEvent
{
self
.
block
})
}
// Continue mining on the next block
...
...
ethpipe/js_pipe.go
View file @
3ee0461c
...
...
@@ -5,7 +5,7 @@ import (
"encoding/json"
"sync/atomic"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
...
...
@@ -15,7 +15,7 @@ type JSPipe struct {
*
Pipe
}
func
NewJSPipe
(
eth
eth
chain
.
EthManager
)
*
JSPipe
{
func
NewJSPipe
(
eth
chain
.
EthManager
)
*
JSPipe
{
return
&
JSPipe
{
New
(
eth
)}
}
...
...
@@ -63,7 +63,7 @@ func (self *JSPipe) PeerCount() int {
func
(
self
*
JSPipe
)
Peers
()
[]
JSPeer
{
var
peers
[]
JSPeer
for
peer
:=
self
.
obj
.
Peers
()
.
Front
();
peer
!=
nil
;
peer
=
peer
.
Next
()
{
p
:=
peer
.
Value
.
(
eth
chain
.
Peer
)
p
:=
peer
.
Value
.
(
chain
.
Peer
)
// we only want connected peers
if
atomic
.
LoadInt32
(
p
.
Connected
())
!=
0
{
peers
=
append
(
peers
,
*
NewJSPeer
(
p
))
...
...
@@ -209,7 +209,7 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
gas
=
ethutil
.
Big
(
gasStr
)
gasPrice
=
ethutil
.
Big
(
gasPriceStr
)
data
[]
byte
tx
*
eth
chain
.
Transaction
tx
*
chain
.
Transaction
)
if
ethutil
.
IsHex
(
codeStr
)
{
...
...
@@ -219,9 +219,9 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
}
if
contractCreation
{
tx
=
eth
chain
.
NewContractCreationTx
(
value
,
gas
,
gasPrice
,
data
)
tx
=
chain
.
NewContractCreationTx
(
value
,
gas
,
gasPrice
,
data
)
}
else
{
tx
=
eth
chain
.
NewTransactionMessage
(
hash
,
value
,
gas
,
gasPrice
,
data
)
tx
=
chain
.
NewTransactionMessage
(
hash
,
value
,
gas
,
gasPrice
,
data
)
}
acc
:=
self
.
obj
.
StateManager
()
.
TransState
()
.
GetOrNewStateObject
(
keyPair
.
Address
())
...
...
@@ -240,7 +240,7 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
}
func
(
self
*
JSPipe
)
PushTx
(
txStr
string
)
(
*
JSReceipt
,
error
)
{
tx
:=
eth
chain
.
NewTransactionFromBytes
(
ethutil
.
Hex2Bytes
(
txStr
))
tx
:=
chain
.
NewTransactionFromBytes
(
ethutil
.
Hex2Bytes
(
txStr
))
self
.
obj
.
TxPool
()
.
QueueTransaction
(
tx
)
return
NewJSReciept
(
tx
.
CreatesContract
(),
tx
.
CreationAddress
(
self
.
World
()
.
State
()),
tx
.
Hash
(),
tx
.
Sender
()),
nil
}
...
...
ethpipe/js_types.go
View file @
3ee0461c
...
...
@@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
...
...
@@ -14,7 +14,7 @@ import (
// Block interface exposed to QML
type
JSBlock
struct
{
//Transactions string `json:"transactions"`
ref
*
eth
chain
.
Block
ref
*
chain
.
Block
Size
string
`json:"size"`
Number
int
`json:"number"`
Hash
string
`json:"hash"`
...
...
@@ -29,7 +29,7 @@ type JSBlock struct {
}
// Creates a new QML Block from a chain block
func
NewJSBlock
(
block
*
eth
chain
.
Block
)
*
JSBlock
{
func
NewJSBlock
(
block
*
chain
.
Block
)
*
JSBlock
{
if
block
==
nil
{
return
&
JSBlock
{}
}
...
...
@@ -75,7 +75,7 @@ func (self *JSBlock) GetTransaction(hash string) *JSTransaction {
}
type
JSTransaction
struct
{
ref
*
eth
chain
.
Transaction
ref
*
chain
.
Transaction
Value
string
`json:"value"`
Gas
string
`json:"gas"`
...
...
@@ -90,7 +90,7 @@ type JSTransaction struct {
Confirmations
int
`json:"confirmations"`
}
func
NewJSTx
(
tx
*
eth
chain
.
Transaction
,
state
*
ethstate
.
State
)
*
JSTransaction
{
func
NewJSTx
(
tx
*
chain
.
Transaction
,
state
*
ethstate
.
State
)
*
JSTransaction
{
hash
:=
ethutil
.
Bytes2Hex
(
tx
.
Hash
())
receiver
:=
ethutil
.
Bytes2Hex
(
tx
.
Recipient
)
if
receiver
==
"0000000000000000000000000000000000000000"
{
...
...
@@ -101,7 +101,7 @@ func NewJSTx(tx *ethchain.Transaction, state *ethstate.State) *JSTransaction {
var
data
string
if
tx
.
CreatesContract
()
{
data
=
strings
.
Join
(
eth
chain
.
Disassemble
(
tx
.
Data
),
"
\n
"
)
data
=
strings
.
Join
(
chain
.
Disassemble
(
tx
.
Data
),
"
\n
"
)
}
else
{
data
=
ethutil
.
Bytes2Hex
(
tx
.
Data
)
}
...
...
@@ -150,7 +150,7 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *
// Peer interface exposed to QML
type
JSPeer
struct
{
ref
*
eth
chain
.
Peer
ref
*
chain
.
Peer
Inbound
bool
`json:"isInbound"`
LastSend
int64
`json:"lastSend"`
LastPong
int64
`json:"lastPong"`
...
...
@@ -162,7 +162,7 @@ type JSPeer struct {
Caps
string
`json:"caps"`
}
func
NewJSPeer
(
peer
eth
chain
.
Peer
)
*
JSPeer
{
func
NewJSPeer
(
peer
chain
.
Peer
)
*
JSPeer
{
if
peer
==
nil
{
return
nil
}
...
...
ethpipe/pipe.go
View file @
3ee0461c
...
...
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
...
...
@@ -19,15 +19,15 @@ type VmVars struct {
}
type
Pipe
struct
{
obj
eth
chain
.
EthManager
stateManager
*
eth
chain
.
StateManager
blockChain
*
eth
chain
.
ChainManager
obj
chain
.
EthManager
stateManager
*
chain
.
StateManager
blockChain
*
chain
.
ChainManager
world
*
World
Vm
VmVars
}
func
New
(
obj
eth
chain
.
EthManager
)
*
Pipe
{
func
New
(
obj
chain
.
EthManager
)
*
Pipe
{
pipe
:=
&
Pipe
{
obj
:
obj
,
stateManager
:
obj
.
StateManager
(),
...
...
@@ -68,7 +68,7 @@ func (self *Pipe) ExecuteObject(object *Object, data []byte, value, gas, price *
return
ret
,
err
}
func
(
self
*
Pipe
)
Block
(
hash
[]
byte
)
*
eth
chain
.
Block
{
func
(
self
*
Pipe
)
Block
(
hash
[]
byte
)
*
chain
.
Block
{
return
self
.
blockChain
.
GetBlock
(
hash
)
}
...
...
@@ -111,7 +111,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
contractCreation
=
true
}
var
tx
*
eth
chain
.
Transaction
var
tx
*
chain
.
Transaction
// Compile and assemble the given data
if
contractCreation
{
script
,
err
:=
ethutil
.
Compile
(
string
(
data
),
false
)
...
...
@@ -119,7 +119,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return
nil
,
err
}
tx
=
eth
chain
.
NewContractCreationTx
(
value
.
BigInt
(),
gas
.
BigInt
(),
price
.
BigInt
(),
script
)
tx
=
chain
.
NewContractCreationTx
(
value
.
BigInt
(),
gas
.
BigInt
(),
price
.
BigInt
(),
script
)
}
else
{
data
:=
ethutil
.
StringToByteFunc
(
string
(
data
),
func
(
s
string
)
(
ret
[]
byte
)
{
slice
:=
strings
.
Split
(
s
,
"
\n
"
)
...
...
@@ -130,7 +130,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return
})
tx
=
eth
chain
.
NewTransactionMessage
(
hash
,
value
.
BigInt
(),
gas
.
BigInt
(),
price
.
BigInt
(),
data
)
tx
=
chain
.
NewTransactionMessage
(
hash
,
value
.
BigInt
(),
gas
.
BigInt
(),
price
.
BigInt
(),
data
)
}
acc
:=
self
.
stateManager
.
TransState
()
.
GetOrNewStateObject
(
key
.
Address
())
...
...
@@ -151,7 +151,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return
tx
.
Hash
(),
nil
}
func
(
self
*
Pipe
)
PushTx
(
tx
*
eth
chain
.
Transaction
)
([]
byte
,
error
)
{
func
(
self
*
Pipe
)
PushTx
(
tx
*
chain
.
Transaction
)
([]
byte
,
error
)
{
self
.
obj
.
TxPool
()
.
QueueTransaction
(
tx
)
if
tx
.
Recipient
==
nil
{
addr
:=
tx
.
CreationAddress
(
self
.
World
()
.
State
())
...
...
ethpipe/vm_env.go
View file @
3ee0461c
...
...
@@ -3,19 +3,19 @@ package ethpipe
import
(
"math/big"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/vm"
)
type
VMEnv
struct
{
state
*
ethstate
.
State
block
*
eth
chain
.
Block
block
*
chain
.
Block
value
*
big
.
Int
sender
[]
byte
}
func
NewEnv
(
state
*
ethstate
.
State
,
block
*
eth
chain
.
Block
,
value
*
big
.
Int
,
sender
[]
byte
)
*
VMEnv
{
func
NewEnv
(
state
*
ethstate
.
State
,
block
*
chain
.
Block
,
value
*
big
.
Int
,
sender
[]
byte
)
*
VMEnv
{
return
&
VMEnv
{
state
:
state
,
block
:
block
,
...
...
javascript/javascript_runtime.go
View file @
3ee0461c
...
...
@@ -8,7 +8,7 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
...
...
@@ -62,7 +62,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
// Subscribe to events
mux
:=
ethereum
.
EventMux
()
re
.
events
=
mux
.
Subscribe
(
eth
chain
.
NewBlockEvent
{})
re
.
events
=
mux
.
Subscribe
(
chain
.
NewBlockEvent
{})
// We have to make sure that, whoever calls this, calls "Stop"
go
re
.
mainLoop
()
...
...
@@ -130,7 +130,7 @@ func (self *JSRE) dump(call otto.FunctionCall) otto.Value {
var
state
*
ethstate
.
State
if
len
(
call
.
ArgumentList
)
>
0
{
var
block
*
eth
chain
.
Block
var
block
*
chain
.
Block
if
call
.
Argument
(
0
)
.
IsNumber
()
{
num
,
_
:=
call
.
Argument
(
0
)
.
ToInteger
()
block
=
self
.
ethereum
.
ChainManager
()
.
GetBlockByNumber
(
uint64
(
num
))
...
...
peer.go
View file @
3ee0461c
...
...
@@ -12,7 +12,7 @@ import (
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethwire"
...
...
@@ -155,7 +155,7 @@ type Peer struct {
pingTime
time
.
Duration
pingStartTime
time
.
Time
lastRequestedBlock
*
eth
chain
.
Block
lastRequestedBlock
*
chain
.
Block
protocolCaps
*
ethutil
.
Value
}
...
...
@@ -378,7 +378,7 @@ func formatMessage(msg *ethwire.Msg) (ret string) {
case ethwire.MsgPeersTy:
ret += fmt.Sprintf("(%d entries)", msg.Data.Len())
case ethwire.MsgBlockTy:
b1, b2 :=
eth
chain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1))
b1, b2 := chain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1))
ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4])
case ethwire.MsgBlockHashesTy:
h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes()
...
...
@@ -429,7 +429,7 @@ func (p *Peer) HandleInbound() {
// in the TxPool where it will undergo validation and
// processing when a new block is found
for
i
:=
0
;
i
<
msg
.
Data
.
Len
();
i
++
{
tx
:=
eth
chain
.
NewTransactionFromValue
(
msg
.
Data
.
Get
(
i
))
tx
:=
chain
.
NewTransactionFromValue
(
msg
.
Data
.
Get
(
i
))
p
.
ethereum
.
TxPool
()
.
QueueTransaction
(
tx
)
}
case
ethwire
.
MsgGetPeersTy
:
...
...
@@ -535,7 +535,7 @@ func (p *Peer) HandleInbound() {
it
:=
msg
.
Data
.
NewIterator
()
for
it
.
Next
()
{
block
:=
eth
chain
.
NewBlockFromRlpValue
(
it
.
Value
())
block
:=
chain
.
NewBlockFromRlpValue
(
it
.
Value
())
blockPool
.
Add
(
block
,
p
)
p
.
lastBlockReceived
=
time
.
Now
()
...
...
@@ -543,7 +543,7 @@ func (p *Peer) HandleInbound() {
case
ethwire
.
MsgNewBlockTy
:
var
(
blockPool
=
p
.
ethereum
.
blockPool
block
=
eth
chain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
0
))
block
=
chain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
0
))
td
=
msg
.
Data
.
Get
(
1
)
.
BigInt
()
)
...
...
ui/filter.go
View file @
3ee0461c
package
ui
import
(
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethutil"
)
func
NewFilterFromMap
(
object
map
[
string
]
interface
{},
eth
ethchain
.
EthManager
)
*
eth
chain
.
Filter
{
filter
:=
eth
chain
.
NewFilter
(
eth
)
func
NewFilterFromMap
(
object
map
[
string
]
interface
{},
eth
chain
.
EthManager
)
*
chain
.
Filter
{
filter
:=
chain
.
NewFilter
(
eth
)
if
object
[
"earliest"
]
!=
nil
{
val
:=
ethutil
.
NewValue
(
object
[
"earliest"
])
...
...
@@ -46,7 +46,7 @@ func NewFilterFromMap(object map[string]interface{}, eth ethchain.EthManager) *e
}
// Conversion methodn
func
mapToAccountChange
(
m
map
[
string
]
interface
{})
(
d
eth
chain
.
AccountChange
)
{
func
mapToAccountChange
(
m
map
[
string
]
interface
{})
(
d
chain
.
AccountChange
)
{
if
str
,
ok
:=
m
[
"id"
]
.
(
string
);
ok
{
d
.
Address
=
ethutil
.
Hex2Bytes
(
str
)
}
...
...
@@ -60,9 +60,9 @@ func mapToAccountChange(m map[string]interface{}) (d ethchain.AccountChange) {
// data can come in in the following formats:
// ["aabbccdd", {id: "ccddee", at: "11223344"}], "aabbcc", {id: "ccddee", at: "1122"}
func
makeAltered
(
v
interface
{})
(
d
[]
eth
chain
.
AccountChange
)
{
func
makeAltered
(
v
interface
{})
(
d
[]
chain
.
AccountChange
)
{
if
str
,
ok
:=
v
.
(
string
);
ok
{
d
=
append
(
d
,
eth
chain
.
AccountChange
{
ethutil
.
Hex2Bytes
(
str
),
nil
})
d
=
append
(
d
,
chain
.
AccountChange
{
ethutil
.
Hex2Bytes
(
str
),
nil
})
}
else
if
obj
,
ok
:=
v
.
(
map
[
string
]
interface
{});
ok
{
d
=
append
(
d
,
mapToAccountChange
(
obj
))
}
else
if
slice
,
ok
:=
v
.
([]
interface
{});
ok
{
...
...
ui/qt/filter.go
View file @
3ee0461c
...
...
@@ -3,12 +3,12 @@ package qt
import
(
"fmt"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ui"
"gopkg.in/qml.v1"
)
func
NewFilterFromMap
(
object
map
[
string
]
interface
{},
eth
ethchain
.
EthManager
)
*
eth
chain
.
Filter
{
func
NewFilterFromMap
(
object
map
[
string
]
interface
{},
eth
chain
.
EthManager
)
*
chain
.
Filter
{
filter
:=
ui
.
NewFilterFromMap
(
object
,
eth
)
if
object
[
"altered"
]
!=
nil
{
...
...
@@ -18,7 +18,7 @@ func NewFilterFromMap(object map[string]interface{}, eth ethchain.EthManager) *e
return
filter
}
func
makeAltered
(
v
interface
{})
(
d
[]
eth
chain
.
AccountChange
)
{
func
makeAltered
(
v
interface
{})
(
d
[]
chain
.
AccountChange
)
{
if
qList
,
ok
:=
v
.
(
*
qml
.
List
);
ok
{
var
s
[]
interface
{}
qList
.
Convert
(
&
s
)
...
...
utils/vm_env.go
View file @
3ee0461c
...
...
@@ -3,20 +3,20 @@ package utils
import
(
"math/big"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/vm"
)
type
VMEnv
struct
{
state
*
ethstate
.
State
block
*
eth
chain
.
Block
block
*
chain
.
Block
transactor
[]
byte
value
*
big
.
Int
}
func
NewEnv
(
state
*
ethstate
.
State
,
block
*
eth
chain
.
Block
,
transactor
[]
byte
,
value
*
big
.
Int
)
*
VMEnv
{
func
NewEnv
(
state
*
ethstate
.
State
,
block
*
chain
.
Block
,
transactor
[]
byte
,
value
*
big
.
Int
)
*
VMEnv
{
return
&
VMEnv
{
state
:
state
,
block
:
block
,
...
...
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