Merge pull request #450 from nspcc-dev/tx-processing-fixes

TX processing fixes
This commit is contained in:
Roman Khimov 2019-10-25 17:37:43 +03:00 committed by GitHub
commit d900be2585
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -394,6 +394,21 @@ func (bc *Blockchain) storeBlock(block *Block) error {
Expiration: bc.BlockHeight() + registeredAssetLifetime,
}
case *transaction.IssueTX:
for _, res := range bc.GetTransactionResults(tx) {
if res.Amount < 0 {
var asset *AssetState
asset, ok := assets[res.AssetID]
if !ok {
asset = bc.GetAssetState(res.AssetID)
}
if asset == nil {
return fmt.Errorf("issue failed: no asset %s", res.AssetID)
}
asset.Available -= res.Amount
assets[res.AssetID] = asset
}
}
case *transaction.ClaimTX:
case *transaction.EnrollmentTX:
case *transaction.StateTX:

View file

@ -23,10 +23,10 @@ type PropertyState byte
// List of supported properties.
const (
NoProperties = 0
HasStorage PropertyState = 1 << iota
HasDynamicInvoke
IsPayable
NoProperties = 0
)
// Parameter represents a smart contract parameter.