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:
parent
544f2c2cb2
commit
d3672eb14a
3 changed files with 2 additions and 2 deletions
|
@ -56,6 +56,7 @@ type Ledger interface {
|
||||||
PoolTx(t *transaction.Transaction, pools ...*mempool.Pool) error
|
PoolTx(t *transaction.Transaction, pools ...*mempool.Pool) error
|
||||||
SubscribeForBlocks(ch chan<- *coreb.Block)
|
SubscribeForBlocks(ch chan<- *coreb.Block)
|
||||||
UnsubscribeFromBlocks(ch chan<- *coreb.Block)
|
UnsubscribeFromBlocks(ch chan<- *coreb.Block)
|
||||||
|
GetBaseExecFee() int64
|
||||||
interop.Ledger
|
interop.Ledger
|
||||||
mempool.Feer
|
mempool.Feer
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ const (
|
||||||
type Ledger interface {
|
type Ledger interface {
|
||||||
BlockHeight() uint32
|
BlockHeight() uint32
|
||||||
CurrentBlockHash() util.Uint256
|
CurrentBlockHash() util.Uint256
|
||||||
GetBaseExecFee() int64
|
|
||||||
GetBlock(hash util.Uint256) (*block.Block, error)
|
GetBlock(hash util.Uint256) (*block.Block, error)
|
||||||
GetConfig() config.ProtocolConfiguration
|
GetConfig() config.ProtocolConfiguration
|
||||||
GetHeaderHash(int) util.Uint256
|
GetHeaderHash(int) util.Uint256
|
||||||
|
|
|
@ -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",
|
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)
|
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()
|
m.StorageFee*ic.BaseStorageFee()
|
||||||
if !ic.VM.AddGas(invokeFee) {
|
if !ic.VM.AddGas(invokeFee) {
|
||||||
return errors.New("gas limit exceeded")
|
return errors.New("gas limit exceeded")
|
||||||
|
|
Loading…
Reference in a new issue