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
b56e20be
Commit
b56e20be
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorg for clarity
parent
754160af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
59 deletions
+59
-59
api.go
rpc/api.go
+30
-52
xeth.go
xeth/xeth.go
+29
-7
No files found.
rpc/api.go
View file @
b56e20be
...
@@ -43,59 +43,7 @@ func (self *EthereumApi) xeth() *xeth.XEth {
...
@@ -43,59 +43,7 @@ func (self *EthereumApi) xeth() *xeth.XEth {
return
self
.
eth
return
self
.
eth
}
}
// func (self *EthereumApi) Register(args string, reply *interface{}) error {
// self.regmut.Lock()
// defer self.regmut.Unlock()
// if _, ok := self.register[args]; ok {
// self.register[args] = nil // register with empty
// }
// return nil
// }
// func (self *EthereumApi) Unregister(args string, reply *interface{}) error {
// self.regmut.Lock()
// defer self.regmut.Unlock()
// delete(self.register, args)
// return nil
// }
// func (self *EthereumApi) WatchTx(args string, reply *interface{}) error {
// self.regmut.Lock()
// defer self.regmut.Unlock()
// txs := self.register[args]
// self.register[args] = nil
// *reply = txs
// return nil
// }
func
(
p
*
EthereumApi
)
Transact
(
args
*
NewTxArgs
,
reply
*
interface
{})
(
err
error
)
{
func
(
p
*
EthereumApi
)
Transact
(
args
*
NewTxArgs
,
reply
*
interface
{})
(
err
error
)
{
// TODO if no_private_key then
//if _, exists := p.register[args.From]; exists {
// p.register[args.From] = append(p.register[args.From], args)
//} else {
/*
account := accounts.Get(common.FromHex(args.From))
if account != nil {
if account.Unlocked() {
if !unlockAccount(account) {
return
}
}
result, _ := account.Transact(common.FromHex(args.To), common.FromHex(args.Value), common.FromHex(args.Gas), common.FromHex(args.GasPrice), common.FromHex(args.Data))
if len(result) > 0 {
*reply = common.ToHex(result)
}
} else if _, exists := p.register[args.From]; exists {
p.register[ags.From] = append(p.register[args.From], args)
}
*/
if
err
:=
args
.
requirements
();
err
!=
nil
{
if
err
:=
args
.
requirements
();
err
!=
nil
{
return
err
return
err
}
}
...
@@ -163,6 +111,36 @@ func (p *EthereumApi) GetBlockByNumber(blocknum int64, includetx bool) (*BlockRe
...
@@ -163,6 +111,36 @@ func (p *EthereumApi) GetBlockByNumber(blocknum int64, includetx bool) (*BlockRe
return
br
,
nil
return
br
,
nil
}
}
// func (self *EthereumApi) Register(args string, reply *interface{}) error {
// self.regmut.Lock()
// defer self.regmut.Unlock()
// if _, ok := self.register[args]; ok {
// self.register[args] = nil // register with empty
// }
// return nil
// }
// func (self *EthereumApi) Unregister(args string, reply *interface{}) error {
// self.regmut.Lock()
// defer self.regmut.Unlock()
// delete(self.register, args)
// return nil
// }
// func (self *EthereumApi) WatchTx(args string, reply *interface{}) error {
// self.regmut.Lock()
// defer self.regmut.Unlock()
// txs := self.register[args]
// self.register[args] = nil
// *reply = txs
// return nil
// }
func
(
p
*
EthereumApi
)
GetRequestReply
(
req
*
RpcRequest
,
reply
*
interface
{})
error
{
func
(
p
*
EthereumApi
)
GetRequestReply
(
req
*
RpcRequest
,
reply
*
interface
{})
error
{
// Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
// Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
rpclogger
.
Infof
(
"%s %s"
,
req
.
Method
,
req
.
Params
)
rpclogger
.
Infof
(
"%s %s"
,
req
.
Method
,
req
.
Params
)
...
...
xeth/xeth.go
View file @
b56e20be
...
@@ -70,6 +70,13 @@ type Frontend interface {
...
@@ -70,6 +70,13 @@ type Frontend interface {
ConfirmTransaction
(
tx
*
types
.
Transaction
)
bool
ConfirmTransaction
(
tx
*
types
.
Transaction
)
bool
}
}
// dummyFrontend is a non-interactive frontend that allows all
// transactions but cannot not unlock any keys.
type
dummyFrontend
struct
{}
func
(
dummyFrontend
)
UnlockAccount
([]
byte
)
bool
{
return
false
}
func
(
dummyFrontend
)
ConfirmTransaction
(
*
types
.
Transaction
)
bool
{
return
true
}
type
XEth
struct
{
type
XEth
struct
{
eth
Backend
eth
Backend
blockProcessor
*
core
.
BlockProcessor
blockProcessor
*
core
.
BlockProcessor
...
@@ -90,13 +97,6 @@ type XEth struct {
...
@@ -90,13 +97,6 @@ type XEth struct {
messages
map
[
int
]
*
whisperFilter
messages
map
[
int
]
*
whisperFilter
}
}
// dummyFrontend is a non-interactive frontend that allows all
// transactions but cannot not unlock any keys.
type
dummyFrontend
struct
{}
func
(
dummyFrontend
)
UnlockAccount
([]
byte
)
bool
{
return
false
}
func
(
dummyFrontend
)
ConfirmTransaction
(
*
types
.
Transaction
)
bool
{
return
true
}
// New creates an XEth that uses the given frontend.
// New creates an XEth that uses the given frontend.
// If a nil Frontend is provided, a default frontend which
// If a nil Frontend is provided, a default frontend which
// confirms all transactions will be used.
// confirms all transactions will be used.
...
@@ -527,6 +527,28 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt
...
@@ -527,6 +527,28 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt
contractCreation
bool
contractCreation
bool
)
)
// TODO if no_private_key then
//if _, exists := p.register[args.From]; exists {
// p.register[args.From] = append(p.register[args.From], args)
//} else {
/*
account := accounts.Get(common.FromHex(args.From))
if account != nil {
if account.Unlocked() {
if !unlockAccount(account) {
return
}
}
result, _ := account.Transact(common.FromHex(args.To), common.FromHex(args.Value), common.FromHex(args.Gas), common.FromHex(args.GasPrice), common.FromHex(args.Data))
if len(result) > 0 {
*reply = common.ToHex(result)
}
} else if _, exists := p.register[args.From]; exists {
p.register[ags.From] = append(p.register[args.From], args)
}
*/
from
=
common
.
FromHex
(
fromStr
)
from
=
common
.
FromHex
(
fromStr
)
data
=
common
.
FromHex
(
codeStr
)
data
=
common
.
FromHex
(
codeStr
)
to
=
common
.
FromHex
(
toStr
)
to
=
common
.
FromHex
(
toStr
)
...
...
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