aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-26 18:24:52 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-26 18:47:57 +0800
commit1e241e84f7a282a3b284851bb7a4790c6c6afe9c (patch)
treeeaf3a03dfc7d45d01908f3e0c3f12085ff74681c /rpc
parent73a576c9af5038366f50509136a91a86d203fc6b (diff)
downloaddexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.tar
dexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.tar.gz
dexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.tar.bz2
dexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.tar.lz
dexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.tar.xz
dexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.tar.zst
dexon-1e241e84f7a282a3b284851bb7a4790c6c6afe9c.zip
params: reduce extra data to 32 bytes
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api/miner.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/rpc/api/miner.go b/rpc/api/miner.go
index 93507f54a..12203ffe0 100644
--- a/rpc/api/miner.go
+++ b/rpc/api/miner.go
@@ -17,9 +17,12 @@
package api
import (
+ "fmt"
+
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
+ "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
)
@@ -122,6 +125,11 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) {
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
+
+ if uint64(len(args.Data)) > params.MaximumExtraDataSize.Uint64()*2 {
+ return false, fmt.Errorf("extra datasize can be no longer than %v bytes", params.MaximumExtraDataSize)
+ }
+
self.ethereum.Miner().SetExtra([]byte(args.Data))
return true, nil
}