diff options
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api.go | 12 | ||||
-rw-r--r-- | rpc/args.go | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/rpc/api.go b/rpc/api.go index 4b61fa3a5..66283752b 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -2,7 +2,7 @@ package rpc import ( "encoding/json" - // "fmt" + "fmt" "math/big" "sync" @@ -167,6 +167,12 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } + // call ConfirmTransaction first + tx, _ := json.Marshal(req) + if !api.xeth().ConfirmTransaction(string(tx)) { + return fmt.Errorf("Transaction not confirmed") + } + v, err := api.xeth().Transact(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data) if err != nil { return err @@ -182,8 +188,8 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err if err != nil { return err } - - *reply = v + // TODO unwrap the parent method's ToHex call + *reply = newHexData(common.FromHex(v)) case "eth_flush": return NewNotImplementedError(req.Method) case "eth_getBlockByHash": diff --git a/rpc/args.go b/rpc/args.go index 4bc36f5d9..4b3840285 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -279,6 +279,8 @@ func (args *CallArgs) UnmarshalJSON(b []byte) (err error) { return NewDecodeParamError(err.Error()) } + args.From = ext.From + if len(ext.To) == 0 { return NewValidationError("to", "is required") } |