Merge pull request #1528 from nspcc-dev/new-oracle-response-codes

transaction: add new oracle response codes
This commit is contained in:
Roman Khimov 2020-11-09 17:26:22 +03:00 committed by GitHub
commit 89baa7ec90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,9 +23,12 @@ const MaxOracleResultSize = math.MaxUint16
// Enumeration of possible oracle response types. // Enumeration of possible oracle response types.
const ( const (
Success OracleResponseCode = 0x00 Success OracleResponseCode = 0x00
NotFound OracleResponseCode = 0x10 ConsensusUnreachable OracleResponseCode = 0x10
Timeout OracleResponseCode = 0x12 NotFound OracleResponseCode = 0x12
Forbidden OracleResponseCode = 0x14 Timeout OracleResponseCode = 0x14
Forbidden OracleResponseCode = 0x16
ResponseTooLarge OracleResponseCode = 0x18
InsufficientFunds OracleResponseCode = 0x1a
Error OracleResponseCode = 0xff Error OracleResponseCode = 0xff
) )
@ -37,7 +40,9 @@ var (
// IsValid checks if c is valid response code. // IsValid checks if c is valid response code.
func (c OracleResponseCode) IsValid() bool { func (c OracleResponseCode) IsValid() bool {
return c == Success || c == NotFound || c == Timeout || c == Forbidden || c == Error return c == Success || c == ConsensusUnreachable || c == NotFound ||
c == Timeout || c == Forbidden || c == ResponseTooLarge ||
c == InsufficientFunds || c == Error
} }
// DecodeBinary implements io.Serializable interface. // DecodeBinary implements io.Serializable interface.