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
2eab964a
Commit
2eab964a
authored
10 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched over to ethpipe
parent
8f1b4612
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
46 deletions
+22
-46
html_container.go
ethereal/html_container.go
+2
-2
qml_container.go
ethereal/qml_container.go
+2
-10
javascript_runtime.go
javascript/javascript_runtime.go
+4
-16
types.go
javascript/types.go
+12
-16
cmd.go
utils/cmd.go
+2
-2
No files found.
ethereal/html_container.go
View file @
2eab964a
...
...
@@ -10,7 +10,7 @@ import (
"path/filepath"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethp
ub
"
"github.com/ethereum/eth-go/ethp
ipe
"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/javascript"
...
...
@@ -121,7 +121,7 @@ func (app *HtmlApplication) Window() *qml.Window {
}
func
(
app
*
HtmlApplication
)
NewBlock
(
block
*
ethchain
.
Block
)
{
b
:=
&
ethp
ub
.
P
Block
{
Number
:
int
(
block
.
BlockInfo
()
.
Number
),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
())}
b
:=
&
ethp
ipe
.
JS
Block
{
Number
:
int
(
block
.
BlockInfo
()
.
Number
),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
())}
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
}
...
...
This diff is collapsed.
Click to expand it.
ethereal/qml_container.go
View file @
2eab964a
...
...
@@ -5,7 +5,7 @@ import (
"runtime"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethp
ub
"
"github.com/ethereum/eth-go/ethp
ipe
"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"gopkg.in/qml.v1"
...
...
@@ -49,18 +49,10 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
// Events
func
(
app
*
QmlApplication
)
NewBlock
(
block
*
ethchain
.
Block
)
{
pblock
:=
&
ethp
ub
.
P
Block
{
Number
:
int
(
block
.
BlockInfo
()
.
Number
),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
())}
pblock
:=
&
ethp
ipe
.
JS
Block
{
Number
:
int
(
block
.
BlockInfo
()
.
Number
),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
())}
app
.
win
.
Call
(
"onNewBlockCb"
,
pblock
)
}
func
(
app
*
QmlApplication
)
ObjectChanged
(
stateObject
*
ethstate
.
StateObject
)
{
app
.
win
.
Call
(
"onObjectChangeCb"
,
ethpub
.
NewPStateObject
(
stateObject
))
}
func
(
app
*
QmlApplication
)
StorageChanged
(
storageObject
*
ethstate
.
StorageState
)
{
app
.
win
.
Call
(
"onStorageChangeCb"
,
ethpub
.
NewPStorageState
(
storageObject
))
}
func
(
self
*
QmlApplication
)
Messages
(
msgs
ethstate
.
Messages
,
id
string
)
{
fmt
.
Println
(
"IMPLEMENT QML APPLICATION MESSAGES METHOD"
)
}
...
...
This diff is collapsed.
Click to expand it.
javascript/javascript_runtime.go
View file @
2eab964a
...
...
@@ -10,7 +10,7 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethp
ub
"
"github.com/ethereum/eth-go/ethp
ipe
"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
...
...
@@ -23,7 +23,7 @@ var jsrelogger = ethlog.NewLogger("JSRE")
type
JSRE
struct
{
ethereum
*
eth
.
Ethereum
Vm
*
otto
.
Otto
lib
*
ethpub
.
PEthereum
pipe
*
ethpipe
.
JSPipe
blockChan
chan
ethreact
.
Event
changeChan
chan
ethreact
.
Event
...
...
@@ -50,7 +50,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
re
:=
&
JSRE
{
ethereum
,
otto
.
New
(),
ethp
ub
.
New
(
ethereum
),
ethp
ipe
.
NewJSPipe
(
ethereum
),
make
(
chan
ethreact
.
Event
,
10
),
make
(
chan
ethreact
.
Event
,
10
),
make
(
chan
bool
),
...
...
@@ -71,7 +71,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
reactor
:=
ethereum
.
Reactor
()
reactor
.
Subscribe
(
"newBlock"
,
re
.
blockChan
)
re
.
Bind
(
"eth"
,
&
JSEthereum
{
re
.
lib
,
re
.
Vm
,
ethereum
})
re
.
Bind
(
"eth"
,
&
JSEthereum
{
re
.
pipe
,
re
.
Vm
,
ethereum
})
re
.
initStdFuncs
()
...
...
@@ -123,18 +123,6 @@ out:
case
block
:=
<-
self
.
blockChan
:
if
_
,
ok
:=
block
.
Resource
.
(
*
ethchain
.
Block
);
ok
{
}
case
object
:=
<-
self
.
changeChan
:
if
stateObject
,
ok
:=
object
.
Resource
.
(
*
ethstate
.
StateObject
);
ok
{
for
_
,
cb
:=
range
self
.
objectCb
[
ethutil
.
Bytes2Hex
(
stateObject
.
Address
())]
{
val
,
_
:=
self
.
Vm
.
ToValue
(
ethpub
.
NewPStateObject
(
stateObject
))
cb
.
Call
(
cb
,
val
)
}
}
else
if
storageObject
,
ok
:=
object
.
Resource
.
(
*
ethstate
.
StorageState
);
ok
{
for
_
,
cb
:=
range
self
.
objectCb
[
ethutil
.
Bytes2Hex
(
storageObject
.
StateAddress
)
+
ethutil
.
Bytes2Hex
(
storageObject
.
Address
)]
{
val
,
_
:=
self
.
Vm
.
ToValue
(
ethpub
.
NewPStorageState
(
storageObject
))
cb
.
Call
(
cb
,
val
)
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
javascript/types.go
View file @
2eab964a
...
...
@@ -5,20 +5,20 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethp
ub
"
"github.com/ethereum/eth-go/ethp
ipe
"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/otto"
)
type
JSStateObject
struct
{
*
ethp
ub
.
PState
Object
*
ethp
ipe
.
JS
Object
eth
*
JSEthereum
}
func
(
self
*
JSStateObject
)
EachStorage
(
call
otto
.
FunctionCall
)
otto
.
Value
{
cb
:=
call
.
Argument
(
0
)
self
.
PState
Object
.
EachStorage
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
self
.
JS
Object
.
EachStorage
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
value
.
Decode
()
cb
.
Call
(
self
.
eth
.
toVal
(
self
),
self
.
eth
.
toVal
(
key
),
self
.
eth
.
toVal
(
ethutil
.
Bytes2Hex
(
value
.
Bytes
())))
...
...
@@ -30,12 +30,12 @@ func (self *JSStateObject) EachStorage(call otto.FunctionCall) otto.Value {
// The JSEthereum object attempts to wrap the PEthereum object and returns
// meaningful javascript objects
type
JSBlock
struct
{
*
ethp
ub
.
P
Block
*
ethp
ipe
.
JS
Block
eth
*
JSEthereum
}
func
(
self
*
JSBlock
)
GetTransaction
(
hash
string
)
otto
.
Value
{
return
self
.
eth
.
toVal
(
self
.
P
Block
.
GetTransaction
(
hash
))
return
self
.
eth
.
toVal
(
self
.
JS
Block
.
GetTransaction
(
hash
))
}
type
JSMessage
struct
{
...
...
@@ -67,33 +67,29 @@ func NewJSMessage(message *ethstate.Message) JSMessage {
}
type
JSEthereum
struct
{
*
ethp
ub
.
PEthereum
*
ethp
ipe
.
JSPipe
vm
*
otto
.
Otto
ethereum
*
eth
.
Ethereum
}
func
(
self
*
JSEthereum
)
GetBlock
(
hash
string
)
otto
.
Value
{
return
self
.
toVal
(
&
JSBlock
{
self
.
PEthereum
.
GetBlock
(
hash
),
self
})
return
self
.
toVal
(
&
JSBlock
{
self
.
JSPipe
.
GetBlockByHash
(
hash
),
self
})
}
func
(
self
*
JSEthereum
)
GetPeers
()
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetPeers
())
return
self
.
toVal
(
self
.
JSPipe
.
GetPeers
())
}
func
(
self
*
JSEthereum
)
GetKey
()
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetKey
())
return
self
.
toVal
(
self
.
JSPipe
.
GetKey
())
}
func
(
self
*
JSEthereum
)
GetStateObject
(
addr
string
)
otto
.
Value
{
return
self
.
toVal
(
&
JSStateObject
{
self
.
PEthereum
.
GetStateObject
(
addr
),
self
})
}
func
(
self
*
JSEthereum
)
GetStateKeyVals
(
addr
string
)
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetStateObject
(
addr
)
.
StateKeyVal
(
false
))
return
self
.
toVal
(
&
JSStateObject
{
ethpipe
.
NewJSObject
(
self
.
JSPipe
.
World
()
.
SafeGet
(
ethutil
.
Hex2Bytes
(
addr
))),
self
})
}
func
(
self
*
JSEthereum
)
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
string
)
otto
.
Value
{
r
,
err
:=
self
.
PEthereum
.
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
)
r
,
err
:=
self
.
JSPipe
.
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
...
...
@@ -104,7 +100,7 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
}
func
(
self
*
JSEthereum
)
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
string
)
otto
.
Value
{
r
,
err
:=
self
.
PEthereum
.
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
)
r
,
err
:=
self
.
JSPipe
.
Transact
(
key
,
""
,
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
...
...
This diff is collapsed.
Click to expand it.
utils/cmd.go
View file @
2eab964a
...
...
@@ -18,7 +18,7 @@ import (
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethminer"
"github.com/ethereum/eth-go/ethp
ub
"
"github.com/ethereum/eth-go/ethp
ipe
"
"github.com/ethereum/eth-go/ethrpc"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
...
...
@@ -228,7 +228,7 @@ func KeyTasks(keyManager *ethcrypto.KeyManager, KeyRing string, GenAddr bool, Se
func
StartRpc
(
ethereum
*
eth
.
Ethereum
,
RpcPort
int
)
{
var
err
error
ethereum
.
RpcServer
,
err
=
ethrpc
.
NewJsonRpcServer
(
ethp
ub
.
New
(
ethereum
),
RpcPort
)
ethereum
.
RpcServer
,
err
=
ethrpc
.
NewJsonRpcServer
(
ethp
ipe
.
NewJSPipe
(
ethereum
),
RpcPort
)
if
err
!=
nil
{
logger
.
Errorf
(
"Could not start RPC interface (port %v): %v"
,
RpcPort
,
err
)
}
else
{
...
...
This diff is collapsed.
Click to expand it.
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