core: fix default asset expiration to match C# code

Fixes bogus verification failures for non-native assets.
This commit is contained in:
Roman Khimov 2019-09-30 17:27:41 +03:00
parent 832c56f97d
commit 1095abb04c

View file

@ -22,6 +22,13 @@ import (
const (
headerBatchCount = 2000
version = "0.0.1"
// This one comes from C# code and it's different from the constant used
// when creating an asset with Neo.Asset.Create interop call. It looks
// like 2000000 is coming from the decrementInterval, but C# code doesn't
// contain any relationship between the two, so we should follow this
// behavior.
registeredAssetLifetime = 2 * 2000000
)
var (
@ -358,13 +365,14 @@ func (bc *Blockchain) storeBlock(block *Block) error {
switch t := tx.Data.(type) {
case *transaction.RegisterTX:
assets[tx.Hash()] = &AssetState{
ID: tx.Hash(),
AssetType: t.AssetType,
Name: t.Name,
Amount: t.Amount,
Precision: t.Precision,
Owner: t.Owner,
Admin: t.Admin,
ID: tx.Hash(),
AssetType: t.AssetType,
Name: t.Name,
Amount: t.Amount,
Precision: t.Precision,
Owner: t.Owner,
Admin: t.Admin,
Expiration: bc.BlockHeight() + registeredAssetLifetime,
}
case *transaction.IssueTX:
case *transaction.ClaimTX: