core: verify results of issue transaction

It shouldn't try to issue more tokens than there is available.
This commit is contained in:
Roman Khimov 2020-03-16 18:43:02 +03:00
parent 10601cb375
commit d5d0479671

View file

@ -1660,6 +1660,13 @@ func (bc *Blockchain) verifyResults(t *transaction.Transaction, results []*trans
if r.AssetID == UtilityTokenID() { if r.AssetID == UtilityTokenID() {
return errors.New("issue tx issues utility tokens") return errors.New("issue tx issues utility tokens")
} }
asset, err := bc.dao.GetAssetState(r.AssetID)
if asset == nil || err != nil {
return errors.New("invalid asset in issue tx")
}
if asset.Available < r.Amount {
return errors.New("trying to issue more than available")
}
} }
break break
default: default: