diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-26 18:24:52 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-26 19:04:56 +0800 |
commit | 8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6 (patch) | |
tree | b621ed27d3af9a312eaeefabdb13c5d9af13f306 /rpc | |
parent | b0df9b164c4b4b0c5cc8ada220c4908b01acafcd (diff) | |
download | go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.tar go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.tar.gz go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.tar.bz2 go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.tar.lz go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.tar.xz go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.tar.zst go-tangerine-8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6.zip |
params: reduce extra data to 32 bytes
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api/miner.go | 8 |
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 } |