diff options
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 } |