transaction: raise max oracle response size

Follow neo-project/neo#1984.
This commit is contained in:
Roman Khimov 2020-11-05 21:48:20 +03:00
parent 679846c1a1
commit 39a38dc5f5

View file

@ -2,6 +2,7 @@ package transaction
import ( import (
"errors" "errors"
"math"
"github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/io"
) )
@ -16,7 +17,8 @@ type OracleResponse struct {
Result []byte `json:"result"` Result []byte `json:"result"`
} }
const maxResultSize = 1024 // MaxOracleResultSize is the maximum allowed oracle answer size.
const MaxOracleResultSize = math.MaxUint16
// Enumeration of possible oracle response types. // Enumeration of possible oracle response types.
const ( const (
@ -46,7 +48,7 @@ func (r *OracleResponse) DecodeBinary(br *io.BinReader) {
br.Err = ErrInvalidResponseCode br.Err = ErrInvalidResponseCode
return return
} }
r.Result = br.ReadVarBytes(maxResultSize) r.Result = br.ReadVarBytes(MaxOracleResultSize)
if r.Code != Success && len(r.Result) > 0 { if r.Code != Success && len(r.Result) > 0 {
br.Err = ErrInvalidResult br.Err = ErrInvalidResult
} }