Accept input as either hex or a string with correct length handling for both

This commit is contained in:
David Dworken 2015-08-07 18:58:27 +00:00
parent ce116681c5
commit 3b4000a1f5

View file

@ -126,6 +126,10 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) {
return nil, err
}
if common.IsHex(args.Data) {
args.Data = string(common.FromHex(args.Data)) //convert the byte array back to a string
}
if uint64(len(args.Data)) > params.MaximumExtraDataSize.Uint64() {
return false, fmt.Errorf("extra datasize can be no longer than %v bytes", params.MaximumExtraDataSize)
}