forked from TrueCloudLab/neoneo-go
Merge pull request #450 from nspcc-dev/tx-processing-fixes
TX processing fixes
This commit is contained in:
commit
d900be2585
2 changed files with 17 additions and 2 deletions
|
@ -394,6 +394,21 @@ func (bc *Blockchain) storeBlock(block *Block) error {
|
||||||
Expiration: bc.BlockHeight() + registeredAssetLifetime,
|
Expiration: bc.BlockHeight() + registeredAssetLifetime,
|
||||||
}
|
}
|
||||||
case *transaction.IssueTX:
|
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.ClaimTX:
|
||||||
case *transaction.EnrollmentTX:
|
case *transaction.EnrollmentTX:
|
||||||
case *transaction.StateTX:
|
case *transaction.StateTX:
|
||||||
|
|
|
@ -23,10 +23,10 @@ type PropertyState byte
|
||||||
|
|
||||||
// List of supported properties.
|
// List of supported properties.
|
||||||
const (
|
const (
|
||||||
NoProperties = 0
|
|
||||||
HasStorage PropertyState = 1 << iota
|
HasStorage PropertyState = 1 << iota
|
||||||
HasDynamicInvoke
|
HasDynamicInvoke
|
||||||
IsPayable
|
IsPayable
|
||||||
|
NoProperties = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parameter represents a smart contract parameter.
|
// Parameter represents a smart contract parameter.
|
||||||
|
|
Loading…
Reference in a new issue