rpcsrv: carefully store Oracle service
And simplify atomic service value stored by RPC server. Oracle service can either be an untyped nil or be the proper non-nil *oracle.Oracle. Otherwise `submitoracleresponse` RPC handler doesn't work properly. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
6c1240d023
commit
c39153756a
3 changed files with 21 additions and 12 deletions
|
@ -359,7 +359,14 @@ func resetDB(ctx *cli.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func mkOracle(config config.OracleConfiguration, magic netmode.Magic, chain *core.Blockchain, serv *network.Server, log *zap.Logger) (*oracle.Oracle, error) {
|
||||
// oracleService is an interface representing Oracle service with network.Service
|
||||
// capabilities and ability to submit oracle responses.
|
||||
type oracleService interface {
|
||||
rpcsrv.OracleHandler
|
||||
network.Service
|
||||
}
|
||||
|
||||
func mkOracle(config config.OracleConfiguration, magic netmode.Magic, chain *core.Blockchain, serv *network.Server, log *zap.Logger) (oracleService, error) {
|
||||
if !config.Enabled {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue