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