params: reduce extra data to 32 bytes
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user