Merge pull request #1390 from nspcc-dev/fix/persist

core: do not persist Policy contract
This commit is contained in:
Roman Khimov 2020-09-07 15:39:01 +03:00 committed by GitHub
commit 77ff84932b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,6 +57,11 @@ func (cs *Contracts) GetPersistScript() []byte {
w := io.NewBufBinWriter()
for i := range cs.Contracts {
md := cs.Contracts[i].Metadata()
// Not every contract is persisted:
// https://github.com/neo-project/neo/blob/master/src/neo/Ledger/Blockchain.cs#L90
if md.ContractID == policyContractID {
continue
}
emit.Int(w.BinWriter, 0)
emit.Opcode(w.BinWriter, opcode.NEWARRAY)
emit.String(w.BinWriter, "onPersist")