core: add a check for fractional gas in invocation TXes

It's not allowed in C# code and that's reasonable as it's a sysfee essentially
that can only be integer.
This commit is contained in:
Roman Khimov 2020-03-04 13:27:22 +03:00
parent 823798514a
commit ae6edf0601

View file

@ -1283,7 +1283,8 @@ func (bc *Blockchain) verifyTx(t *transaction.Transaction, block *block.Block) e
}
}
if t.Type == transaction.ClaimType {
switch t.Type {
case transaction.ClaimType:
claim := t.Data.(*transaction.ClaimTX)
if transaction.HaveDuplicateInputs(claim.Claims) {
return errors.New("duplicate claims")
@ -1294,6 +1295,11 @@ func (bc *Blockchain) verifyTx(t *transaction.Transaction, block *block.Block) e
if err := bc.verifyClaims(t); err != nil {
return err
}
case transaction.InvocationType:
inv := t.Data.(*transaction.InvocationTX)
if inv.Gas.FractionalValue() != 0 {
return errors.New("invocation gas can only be integer")
}
}
return bc.verifyTxWitnesses(t, block)