From 1e241e84f7a282a3b284851bb7a4790c6c6afe9c Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sun, 26 Jul 2015 12:24:52 +0200 Subject: params: reduce extra data to 32 bytes --- rpc/api/miner.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rpc') 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 } -- cgit v1.2.3