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
8ac1b85a
Commit
8ac1b85a
authored
Sep 10, 2014
by
Cayman Nava
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-pushtx' into develop
parents
29499900
7dacd7eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
js_pipe.go
ethpipe/js_pipe.go
+6
-0
pipe.go
ethpipe/pipe.go
+9
-0
packages.go
ethrpc/packages.go
+21
-0
No files found.
ethpipe/js_pipe.go
View file @
8ac1b85a
...
...
@@ -225,6 +225,12 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
return
NewJSReciept
(
contractCreation
,
tx
.
CreationAddress
(),
tx
.
Hash
(),
keyPair
.
Address
()),
nil
}
func
(
self
*
JSPipe
)
PushTx
(
txStr
string
)
(
*
JSReceipt
,
error
)
{
tx
:=
ethchain
.
NewTransactionFromBytes
(
ethutil
.
Hex2Bytes
(
txStr
))
self
.
obj
.
TxPool
()
.
QueueTransaction
(
tx
)
return
NewJSReciept
(
tx
.
CreatesContract
(),
tx
.
CreationAddress
(),
tx
.
Hash
(),
tx
.
Sender
()),
nil
}
func
(
self
*
JSPipe
)
CompileMutan
(
code
string
)
string
{
data
,
err
:=
self
.
Pipe
.
CompileMutan
(
code
)
if
err
!=
nil
{
...
...
ethpipe/pipe.go
View file @
8ac1b85a
...
...
@@ -149,6 +149,15 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return
tx
.
Hash
(),
nil
}
func
(
self
*
Pipe
)
PushTx
(
tx
*
ethchain
.
Transaction
)
([]
byte
,
error
)
{
self
.
obj
.
TxPool
()
.
QueueTransaction
(
tx
)
if
tx
.
Recipient
==
nil
{
logger
.
Infof
(
"Contract addr %x"
,
tx
.
CreationAddress
())
return
tx
.
CreationAddress
(),
nil
}
return
tx
.
Hash
(),
nil
}
func
(
self
*
Pipe
)
CompileMutan
(
code
string
)
([]
byte
,
error
)
{
data
,
err
:=
ethutil
.
Compile
(
code
,
false
)
if
err
!=
nil
{
...
...
ethrpc/packages.go
View file @
8ac1b85a
...
...
@@ -145,6 +145,27 @@ func (p *EthereumApi) Create(args *NewTxArgs, reply *string) error {
return
nil
}
type
PushTxArgs
struct
{
Tx
string
}
func
(
a
*
PushTxArgs
)
requirementsPushTx
()
error
{
if
a
.
Tx
==
""
{
return
NewErrorResponse
(
"PushTx requires a 'tx' as argument"
)
}
return
nil
}
func
(
p
*
EthereumApi
)
PushTx
(
args
*
PushTxArgs
,
reply
*
string
)
error
{
err
:=
args
.
requirementsPushTx
()
if
err
!=
nil
{
return
err
}
result
,
_
:=
p
.
pipe
.
PushTx
(
args
.
Tx
)
*
reply
=
NewSuccessRes
(
result
)
return
nil
}
func
(
p
*
EthereumApi
)
GetKey
(
args
interface
{},
reply
*
string
)
error
{
*
reply
=
NewSuccessRes
(
p
.
pipe
.
Key
())
return
nil
...
...
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