diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 13159122e..f29aaaeda 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -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: diff --git a/pkg/smartcontract/param_context.go b/pkg/smartcontract/param_context.go index 8f585f86b..f7414f6a0 100644 --- a/pkg/smartcontract/param_context.go +++ b/pkg/smartcontract/param_context.go @@ -23,10 +23,10 @@ type PropertyState byte // List of supported properties. const ( - NoProperties = 0 - HasStorage PropertyState = 1 << iota + HasStorage PropertyState = 1 << iota HasDynamicInvoke IsPayable + NoProperties = 0 ) // Parameter represents a smart contract parameter.