core: use BaseExecFee from InteropContext instead of Blockchain's one

The InteropContext's one contains all relevant fee changes applied in
the prevouse transactions of the current block.
This commit is contained in:
Anna Shaleva 2022-04-08 12:31:55 +03:00
parent 544f2c2cb2
commit d3672eb14a
3 changed files with 2 additions and 2 deletions

View file

@ -56,6 +56,7 @@ type Ledger interface {
PoolTx(t *transaction.Transaction, pools ...*mempool.Pool) error
SubscribeForBlocks(ch chan<- *coreb.Block)
UnsubscribeFromBlocks(ch chan<- *coreb.Block)
GetBaseExecFee() int64
interop.Ledger
mempool.Feer
}

View file

@ -37,7 +37,6 @@ const (
type Ledger interface {
BlockHeight() uint32
CurrentBlockHash() util.Uint256
GetBaseExecFee() int64
GetBlock(hash util.Uint256) (*block.Block, error)
GetConfig() config.ProtocolConfiguration
GetHeaderHash(int) util.Uint256

View file

@ -42,7 +42,7 @@ func Call(ic *interop.Context) error {
return fmt.Errorf("missing call flags for native %d `%s` operation call: %05b vs %05b",
version, m.MD.Name, ic.VM.Context().GetCallFlags(), m.RequiredFlags)
}
invokeFee := m.CPUFee*ic.Chain.GetBaseExecFee() +
invokeFee := m.CPUFee*ic.BaseExecFee() +
m.StorageFee*ic.BaseStorageFee()
if !ic.VM.AddGas(invokeFee) {
return errors.New("gas limit exceeded")