mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
core: fix default asset expiration to match C# code
Fixes bogus verification failures for non-native assets.
This commit is contained in:
parent
832c56f97d
commit
1095abb04c
1 changed files with 15 additions and 7 deletions
|
@ -22,6 +22,13 @@ import (
|
||||||
const (
|
const (
|
||||||
headerBatchCount = 2000
|
headerBatchCount = 2000
|
||||||
version = "0.0.1"
|
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 (
|
var (
|
||||||
|
@ -358,13 +365,14 @@ func (bc *Blockchain) storeBlock(block *Block) error {
|
||||||
switch t := tx.Data.(type) {
|
switch t := tx.Data.(type) {
|
||||||
case *transaction.RegisterTX:
|
case *transaction.RegisterTX:
|
||||||
assets[tx.Hash()] = &AssetState{
|
assets[tx.Hash()] = &AssetState{
|
||||||
ID: tx.Hash(),
|
ID: tx.Hash(),
|
||||||
AssetType: t.AssetType,
|
AssetType: t.AssetType,
|
||||||
Name: t.Name,
|
Name: t.Name,
|
||||||
Amount: t.Amount,
|
Amount: t.Amount,
|
||||||
Precision: t.Precision,
|
Precision: t.Precision,
|
||||||
Owner: t.Owner,
|
Owner: t.Owner,
|
||||||
Admin: t.Admin,
|
Admin: t.Admin,
|
||||||
|
Expiration: bc.BlockHeight() + registeredAssetLifetime,
|
||||||
}
|
}
|
||||||
case *transaction.IssueTX:
|
case *transaction.IssueTX:
|
||||||
case *transaction.ClaimTX:
|
case *transaction.ClaimTX:
|
||||||
|
|
Loading…
Reference in a new issue