Documentation ¶
Index ¶
- Variables
- type Broadcaster
- type Config
- type HTTPClient
- type Oracle
- func (o *Oracle) AddRequests(reqs map[uint64]*state.OracleRequest)
- func (o *Oracle) AddResponse(pub *keys.PublicKey, reqID uint64, txSig []byte)
- func (o *Oracle) CreateResponseTx(gasForResponse int64, height uint32, resp *transaction.OracleResponse) (*transaction.Transaction, error)
- func (o *Oracle) ProcessRequestsInternal(reqs map[uint64]*state.OracleRequest)
- func (o *Oracle) RemoveRequests(ids []uint64)
- func (o *Oracle) Run()
- func (o *Oracle) SetBroadcaster(b Broadcaster)
- func (o *Oracle) SetOnTransaction(cb TxCallback)
- func (o *Oracle) Shutdown()
- func (o *Oracle) UpdateNativeContract(script, resp []byte, h util.Uint160, verifyOffset int)
- func (o *Oracle) UpdateOracleNodes(oracleNodes keys.PublicKeys)
- type TxCallback
- type URIValidator
Constants ¶
This section is empty.
Variables ¶
var ErrResponseTooLarge = errors.New("too big response")
ErrResponseTooLarge is returned when response exceeds max allowed size.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster interface { SendResponse(priv *keys.PrivateKey, resp *transaction.OracleResponse, txSig []byte) Run() Shutdown() }
Broadcaster broadcasts oracle responses.
type Config ¶
type Config struct { Log *zap.Logger Network netmode.Magic MainCfg config.OracleConfiguration Client HTTPClient Chain blockchainer.Blockchainer ResponseHandler Broadcaster OnTransaction TxCallback URIValidator URIValidator }
Config contains oracle module parameters.
type HTTPClient ¶
HTTPClient is an interface capable of doing oracle requests.
type Oracle ¶
type Oracle struct { Config // contains filtered or unexported fields }
Oracle represents oracle module capable of talking with the external world.
func (*Oracle) AddRequests ¶
func (o *Oracle) AddRequests(reqs map[uint64]*state.OracleRequest)
AddRequests saves all requests in-fly for further processing.
func (*Oracle) AddResponse ¶
AddResponse processes oracle response from node pub. sig is response transaction signature.
func (*Oracle) CreateResponseTx ¶
func (o *Oracle) CreateResponseTx(gasForResponse int64, height uint32, resp *transaction.OracleResponse) (*transaction.Transaction, error)
CreateResponseTx creates unsigned oracle response transaction.
func (*Oracle) ProcessRequestsInternal ¶
func (o *Oracle) ProcessRequestsInternal(reqs map[uint64]*state.OracleRequest)
ProcessRequestsInternal processes provided requests synchronously.
func (*Oracle) RemoveRequests ¶
RemoveRequests removes all data associated with requests which have been processed by oracle contract.
func (*Oracle) SetBroadcaster ¶
func (o *Oracle) SetBroadcaster(b Broadcaster)
SetBroadcaster sets callback to broadcast response.
func (*Oracle) SetOnTransaction ¶
func (o *Oracle) SetOnTransaction(cb TxCallback)
SetOnTransaction sets callback to pool and broadcast tx.
func (*Oracle) UpdateNativeContract ¶ added in v0.94.0
UpdateNativeContract updates native oracle contract info for tx verification.
func (*Oracle) UpdateOracleNodes ¶
func (o *Oracle) UpdateOracleNodes(oracleNodes keys.PublicKeys)
UpdateOracleNodes updates oracle nodes list.
type TxCallback ¶
type TxCallback = func(tx *transaction.Transaction)
TxCallback executes on new transactions when they are ready to be pooled.
type URIValidator ¶
URIValidator is used to check if provided URL is valid.