diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-07 20:00:36 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-07 20:00:36 +0800 |
commit | d7580f21f65beaf896bfc004cf13d28ed87f2ae3 (patch) | |
tree | eeb9391f0b828099319612445337ef2a9069819a /miner | |
parent | b1fac4270d639d0a80871784edd80cf16c9f8540 (diff) | |
parent | 132df860d90c163a8be55260bdd219892f9e1bef (diff) | |
download | go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.tar go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.tar.gz go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.tar.bz2 go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.tar.lz go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.tar.xz go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.tar.zst go-tangerine-d7580f21f65beaf896bfc004cf13d28ed87f2ae3.zip |
Merge pull request #1595 from obscuren/extra-data
cmd/geth, eth: added canonical extra data
Diffstat (limited to 'miner')
-rw-r--r-- | miner/miner.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/miner/miner.go b/miner/miner.go index 508778579..b550ed6d6 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -18,6 +18,7 @@ package miner import ( + "fmt" "math/big" "sync/atomic" @@ -29,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/pow" ) @@ -150,8 +152,13 @@ func (self *Miner) HashRate() (tot int64) { return } -func (self *Miner) SetExtra(extra []byte) { +func (self *Miner) SetExtra(extra []byte) error { + if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() { + return fmt.Errorf("Extra exceeds max length. %d > %v", len(extra), params.MaximumExtraDataSize) + } + self.worker.extra = extra + return nil } func (self *Miner) PendingState() *state.StateDB { |