OSDN Git Service

modify general config (#257)
[bytom/vapor.git] / wallet / utxo.go
index aa083dc..1eec505 100644 (file)
@@ -82,6 +82,9 @@ func (w *Wallet) detachUtxos(batch dbm.Batch, b *types.Block, txStatus *bc.Trans
                        code := []byte{}
                        switch resOut := tx.Entries[*tx.ResultIds[j]].(type) {
                        case *bc.IntraChainOutput:
+                               if resOut.Source.Value.Amount == uint64(0) {
+                                       continue
+                               }
                                code = resOut.ControlProgram.Code
                        case *bc.VoteOutput:
                                code = resOut.ControlProgram.Code
@@ -213,7 +216,6 @@ func txInToUtxos(tx *types.Tx, statusFail bool) []*account.UTXO {
                                Vote:           resOut.Vote,
                        }
                default:
-                       log.WithFields(log.Fields{"module": logModule, "err": errors.Wrapf(bc.ErrEntryType, "entry %x has unexpected type %T", inpID.Bytes(), e)}).Error("txInToUtxos fail on get resOut")
                        continue
                }
                utxos = append(utxos, utxo)
@@ -224,7 +226,7 @@ func txInToUtxos(tx *types.Tx, statusFail bool) []*account.UTXO {
 func txOutToUtxos(tx *types.Tx, statusFail bool, blockHeight uint64) []*account.UTXO {
        validHeight := uint64(0)
        if tx.Inputs[0].InputType() == types.CoinbaseInputType {
-               validHeight = blockHeight + consensus.CoinbasePendingBlockNumber
+               validHeight = blockHeight + consensus.ActiveNetParams.CoinbasePendingBlockNumber
        }
 
        utxos := []*account.UTXO{}
@@ -238,7 +240,7 @@ func txOutToUtxos(tx *types.Tx, statusFail bool, blockHeight uint64) []*account.
                utxo := &account.UTXO{}
                switch bcOut := entryOutput.(type) {
                case *bc.IntraChainOutput:
-                       if statusFail && *out.AssetAmount().AssetId != *consensus.BTMAssetID {
+                       if (statusFail && *out.AssetAmount().AssetId != *consensus.BTMAssetID) || out.AssetAmount().Amount == uint64(0) {
                                continue
                        }
                        utxo = &account.UTXO{
@@ -256,7 +258,7 @@ func txOutToUtxos(tx *types.Tx, statusFail bool, blockHeight uint64) []*account.
                                continue
                        }
 
-                       voteValidHeight := blockHeight + consensus.VotePendingBlockNumber
+                       voteValidHeight := blockHeight + consensus.ActiveNetParams.VotePendingBlockNumber
                        if validHeight < voteValidHeight {
                                validHeight = voteValidHeight
                        }