aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-07-26 19:04:10 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-07-26 19:04:10 +0800
commit8a5ea466e4d97021f9c1422e76a5f4665a8a6b08 (patch)
tree462837515c45e940db09129d25cf953b5b755338 /rpc
parente86233abc9fefc58f52d8a7d9990ddbf8cfda02d (diff)
parent1e241e84f7a282a3b284851bb7a4790c6c6afe9c (diff)
downloaddexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.tar
dexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.tar.gz
dexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.tar.bz2
dexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.tar.lz
dexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.tar.xz
dexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.tar.zst
dexon-8a5ea466e4d97021f9c1422e76a5f4665a8a6b08.zip
Merge pull request #1528 from obscuren/reduce-extra-data
params: reduce extra data to 32 bytes & target block time
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
}