mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 23:55:11 +00:00
native: allow to modify StoragePrice
in the policy contract
This commit is contained in:
parent
4946556830
commit
62da365302
7 changed files with 123 additions and 7 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/blockchainer"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/dao"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
|
@ -201,7 +200,7 @@ func storageDelete(ic *interop.Context) error {
|
|||
if stc.ReadOnly {
|
||||
return errors.New("StorageContext is read only")
|
||||
}
|
||||
ic.VM.AddGas(native.StoragePrice)
|
||||
ic.VM.AddGas(ic.Chain.GetPolicer().GetStoragePrice())
|
||||
key := ic.VM.Estack().Pop().Bytes()
|
||||
si := ic.DAO.GetStorageItem(stc.ID, key)
|
||||
if si != nil && si.IsConst {
|
||||
|
@ -277,7 +276,7 @@ func putWithContextAndFlags(ic *interop.Context, stc *StorageContext, key []byte
|
|||
sizeInc = (len(si.Value)-1)/4 + 1 + len(value) - len(si.Value)
|
||||
}
|
||||
}
|
||||
if !ic.VM.AddGas(int64(sizeInc) * native.StoragePrice) {
|
||||
if !ic.VM.AddGas(int64(sizeInc) * ic.Chain.GetPolicer().GetStoragePrice()) {
|
||||
return errGasLimitExceeded
|
||||
}
|
||||
si.Value = value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue