mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
Merge pull request #3704 from nspcc-dev/interop-md-fixes
Native contract manifest build fixes
This commit is contained in:
commit
e89f9fe2a4
1 changed files with 10 additions and 12 deletions
|
@ -266,18 +266,16 @@ func (c *ContractMD) BuildHFSpecificMD(activeIn *config.Hardfork) {
|
|||
}
|
||||
|
||||
for _, hf := range append([]config.Hardfork{config.HFDefault}, config.Hardforks...) {
|
||||
switch {
|
||||
case hf.Cmp(start) < 0:
|
||||
if hf.Cmp(start) < 0 {
|
||||
continue
|
||||
case hf.Cmp(start) == 0:
|
||||
c.buildHFSpecificMD(hf)
|
||||
default:
|
||||
if _, ok := c.ActiveHFs[hf]; !ok {
|
||||
// Intentionally omit HFSpecificContractMD structure copying since mdCache is read-only.
|
||||
c.mdCache[hf] = c.mdCache[hf.Prev()]
|
||||
continue
|
||||
}
|
||||
}
|
||||
_, contractHasChanges := c.ActiveHFs[hf]
|
||||
if hf.Cmp(start) == 0 || contractHasChanges {
|
||||
c.buildHFSpecificMD(hf)
|
||||
} else {
|
||||
// Optimize out MD rebuild, the contract is the same.
|
||||
// Intentionally omit HFSpecificContractMD structure copying since mdCache is read-only.
|
||||
c.mdCache[hf] = c.mdCache[hf.Prev()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +292,7 @@ func (c *ContractMD) buildHFSpecificMD(hf config.Hardfork) {
|
|||
w := io.NewBufBinWriter()
|
||||
for i := range c.methods {
|
||||
m := c.methods[i]
|
||||
if !(m.ActiveFrom == nil || (hf != config.HFDefault && (*m.ActiveFrom).Cmp(hf) >= 0)) ||
|
||||
if (m.ActiveFrom != nil && (*m.ActiveFrom).Cmp(hf) > 0) ||
|
||||
(m.ActiveTill != nil && (*m.ActiveTill).Cmp(hf) <= 0) {
|
||||
continue
|
||||
}
|
||||
|
@ -317,7 +315,7 @@ func (c *ContractMD) buildHFSpecificMD(hf config.Hardfork) {
|
|||
}
|
||||
for i := range c.events {
|
||||
e := c.events[i]
|
||||
if !(e.ActiveFrom == nil || (hf != config.HFDefault && (*e.ActiveFrom).Cmp(hf) >= 0)) ||
|
||||
if (e.ActiveFrom != nil && (*e.ActiveFrom).Cmp(hf) > 0) ||
|
||||
(e.ActiveTill != nil && (*e.ActiveTill).Cmp(hf) <= 0) {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue