state: split ContractBase and UpdateCounter

Latter doesn't make sense for native contracts.
This commit is contained in:
Evgeniy Stratonikov 2021-02-09 12:02:38 +03:00
parent 29b1581ea8
commit e1d2a5b5b7
9 changed files with 113 additions and 74 deletions

View file

@ -280,10 +280,12 @@ func (m *Management) Deploy(d dao.DAO, sender util.Uint160, neff *nef.File, mani
return nil, err
}
newcontract := &state.Contract{
ID: id,
Hash: h,
NEF: *neff,
Manifest: *manif,
ContractBase: state.ContractBase{
ID: id,
Hash: h,
NEF: *neff,
Manifest: *manif,
},
}
err = m.PutContractState(d, newcontract)
if err != nil {
@ -451,10 +453,12 @@ func (m *Management) OnPersist(ic *interop.Context) error {
md := native.Metadata()
cs := &state.Contract{
ID: md.ContractID,
Hash: md.Hash,
NEF: md.NEF,
Manifest: md.Manifest,
ContractBase: state.ContractBase{
ID: md.ContractID,
Hash: md.Hash,
NEF: md.NEF,
Manifest: md.Manifest,
},
}
err := m.PutContractState(ic.DAO, cs)
if err != nil {