From 524bf9aaa003242bcd6c42728b3a45a07e895536 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 12 Jan 2021 21:27:42 +0300 Subject: [PATCH] native: swap oracle and role management init Role management doesn't need oracles, but oracles do need role management. See neo-project/neo#2187. --- pkg/core/native/contract.go | 14 +++++++------- pkg/core/native/designate.go | 2 +- pkg/core/native/oracle.go | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/core/native/contract.go b/pkg/core/native/contract.go index 7dad9d2e8..efccd7c3a 100644 --- a/pkg/core/native/contract.go +++ b/pkg/core/native/contract.go @@ -73,18 +73,18 @@ func NewContracts(p2pSigExtensionsEnabled bool) *Contracts { cs.Policy = policy cs.Contracts = append(cs.Contracts, policy) - oracle := newOracle() - oracle.GAS = gas - oracle.NEO = neo - cs.Oracle = oracle - cs.Contracts = append(cs.Contracts, oracle) - desig := newDesignate(p2pSigExtensionsEnabled) desig.NEO = neo cs.Designate = desig - cs.Oracle.Desig = desig cs.Contracts = append(cs.Contracts, desig) + oracle := newOracle() + oracle.GAS = gas + oracle.NEO = neo + oracle.Desig = desig + cs.Oracle = oracle + cs.Contracts = append(cs.Contracts, oracle) + if p2pSigExtensionsEnabled { notary := newNotary() notary.GAS = gas diff --git a/pkg/core/native/designate.go b/pkg/core/native/designate.go index ecfbdbd77..5fa9ec822 100644 --- a/pkg/core/native/designate.go +++ b/pkg/core/native/designate.go @@ -40,7 +40,7 @@ type oraclesData struct { } const ( - designateContractID = -5 + designateContractID = -4 // maxNodeCount is the maximum number of nodes to set the role for. maxNodeCount = 32 diff --git a/pkg/core/native/oracle.go b/pkg/core/native/oracle.go index 497373ebc..dd5f79aae 100644 --- a/pkg/core/native/oracle.go +++ b/pkg/core/native/oracle.go @@ -38,7 +38,7 @@ type Oracle struct { } const ( - oracleContractID = -4 + oracleContractID = -5 maxURLLength = 256 maxFilterLength = 128 maxCallbackLength = 32