core: fix SystemFee calculation for Invocation TXes

They have it specified right in the transaction. Unfortunately, this little
change rendered invalid our RPC test chain, but I think it became even better
after it, especially given that chain generation is a nice test by itself, so
it should be running as a regular test.
This commit is contained in:
Roman Khimov 2020-03-04 17:45:29 +03:00
parent ae6edf0601
commit 81d89cd502
4 changed files with 172 additions and 94 deletions

View file

@ -1209,6 +1209,12 @@ func (bc *Blockchain) NetworkFee(t *transaction.Transaction) util.Fixed8 {
// SystemFee returns system fee.
func (bc *Blockchain) SystemFee(t *transaction.Transaction) util.Fixed8 {
if t.Type == transaction.InvocationType {
inv := t.Data.(*transaction.InvocationTX)
if inv.Version >= 1 {
return inv.Gas
}
}
return bc.GetConfig().SystemFee.TryGetValue(t.Type)
}