aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-12 00:00:30 +0800
committerobscuren <geffobscura@gmail.com>2015-03-12 00:00:30 +0800
commit2da7af4ba0913acc74c554422a04958f3f8d78b9 (patch)
tree6e0528ee381ef9367984f2e190d1dbfbeb8e9f53 /rpc/api.go
parente8d1b622d9381a2717f1a09f29078e07c23b01bd (diff)
parent90f34ed40a1b3c87073d7e2e13b5515cc4cb3940 (diff)
downloaddexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.tar
dexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.tar.gz
dexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.tar.bz2
dexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.tar.lz
dexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.tar.xz
dexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.tar.zst
dexon-2da7af4ba0913acc74c554422a04958f3f8d78b9.zip
Merge branch 'rpcfrontier' of github.com-obscure:ethereum/go-ethereum into rpcfrontier
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go47
1 files changed, 41 insertions, 6 deletions
diff --git a/rpc/api.go b/rpc/api.go
index f214c212b..fb974883a 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -394,7 +394,7 @@ func (self *EthereumApi) MessagesChanged(id int, reply *interface{}) error {
}
func (p *EthereumApi) WhisperPost(args *WhisperMessageArgs, reply *interface{}) error {
- err := p.xeth().Whisper().Post(args.Payload, args.To, args.From, args.Topic, args.Priority, args.Ttl)
+ err := p.xeth().Whisper().Post(args.Payload, args.To, args.From, args.Topics, args.Priority, args.Ttl)
if err != nil {
return err
}
@@ -597,10 +597,10 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
if err != nil {
return err
}
- if args.TxIndex > int64(len(v.Transactions)) || args.TxIndex < 0 {
+ if args.Index > int64(len(v.Transactions)) || args.Index < 0 {
return NewErrorWithMessage(errDecodeArgs, "Transaction index does not exist")
}
- *reply = v.Transactions[args.TxIndex]
+ *reply = v.Transactions[args.Index]
case "eth_getTransactionByBlockNumberAndIndex":
args := new(BlockNumIndexArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
@@ -611,13 +611,48 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
if err != nil {
return err
}
- if args.TxIndex > int64(len(v.Transactions)) || args.TxIndex < 0 {
+ if args.Index > int64(len(v.Transactions)) || args.Index < 0 {
return NewErrorWithMessage(errDecodeArgs, "Transaction index does not exist")
}
- *reply = v.Transactions[args.TxIndex]
+ *reply = v.Transactions[args.Index]
case "eth_getUncleByBlockHashAndIndex":
+ args := new(HashIndexArgs)
+ if err := json.Unmarshal(req.Params, &args); err != nil {
+ return err
+ }
+
+ v, err := p.GetBlockByHash(args.BlockHash, false)
+ if err != nil {
+ return err
+ }
+ if args.Index > int64(len(v.Uncles)) || args.Index < 0 {
+ return NewErrorWithMessage(errDecodeArgs, "Uncle index does not exist")
+ }
+
+ uncle, err := p.GetBlockByHash(toHex(v.Uncles[args.Index]), false)
+ if err != nil {
+ return err
+ }
+ *reply = uncle
case "eth_getUncleByBlockNumberAndIndex":
- return errNotImplemented
+ args := new(BlockNumIndexArgs)
+ if err := json.Unmarshal(req.Params, &args); err != nil {
+ return err
+ }
+
+ v, err := p.GetBlockByNumber(args.BlockNumber, true)
+ if err != nil {
+ return err
+ }
+ if args.Index > int64(len(v.Uncles)) || args.Index < 0 {
+ return NewErrorWithMessage(errDecodeArgs, "Uncle index does not exist")
+ }
+
+ uncle, err := p.GetBlockByHash(toHex(v.Uncles[args.Index]), false)
+ if err != nil {
+ return err
+ }
+ *reply = uncle
case "eth_getCompilers":
return p.GetCompilers(reply)
case "eth_compileSolidity":