core: use native cache to check whether the same contract exists on deploy
This commit is contained in:
parent
c0b490c7bf
commit
27b0193da0
1 changed files with 2 additions and 3 deletions
|
@ -286,9 +286,8 @@ func (m *Management) markUpdated(d *dao.Simple, hash util.Uint160, cs *state.Con
|
|||
// It doesn't run _deploy method and doesn't emit notification.
|
||||
func (m *Management) Deploy(d *dao.Simple, sender util.Uint160, neff *nef.File, manif *manifest.Manifest) (*state.Contract, error) {
|
||||
h := state.CreateContractHash(sender, neff.Checksum, manif.Name)
|
||||
key := MakeContractKey(h)
|
||||
si := d.GetStorageItem(m.ID, key)
|
||||
if si != nil {
|
||||
_, err := m.GetContract(d, h)
|
||||
if err == nil {
|
||||
return nil, errors.New("contract already exists")
|
||||
}
|
||||
id, err := m.getNextContractID(d)
|
||||
|
|
Loading…
Reference in a new issue