aboutsummaryrefslogtreecommitdiffstats
path: root/ethrpc
diff options
context:
space:
mode:
authorCayman Nava <caymannava@gmail.com>2014-09-07 04:51:13 +0800
committerCayman Nava <caymannava@gmail.com>2014-09-10 12:27:34 +0800
commit7dacd7eb7818a336b3be99aea834093cf40a1b08 (patch)
treed2dcc8e7832a3e2c167c064195a3590fc7f43db1 /ethrpc
parent6afc16399f9624663579ad72950b4ea3b887db57 (diff)
downloadgo-tangerine-7dacd7eb7818a336b3be99aea834093cf40a1b08.tar.gz
go-tangerine-7dacd7eb7818a336b3be99aea834093cf40a1b08.tar.zst
go-tangerine-7dacd7eb7818a336b3be99aea834093cf40a1b08.zip
add pushtx to api
Previously the software assumed use of an internal private key for use in all broadcasted transactions. This addition lets nodes relay pre-signed transactions originating from sources other than the node itself.
Diffstat (limited to 'ethrpc')
-rw-r--r--ethrpc/packages.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/ethrpc/packages.go b/ethrpc/packages.go
index f2e57fa49..087167a42 100644
--- a/ethrpc/packages.go
+++ b/ethrpc/packages.go
@@ -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