OSDN Git Service

modify utxo pending number and consensus node vote restrict (#285)
[bytom/vapor.git] / protocol / txpool.go
index 957ab6a..912091c 100644 (file)
@@ -194,17 +194,21 @@ func (tp *TxPool) HaveTransaction(txHash *bc.Hash) bool {
 
 func isTransactionNoBtmInput(tx *types.Tx) bool {
        for _, input := range tx.TxData.Inputs {
+               switch input.InputType() {
+               case types.CrossChainInputType:
+                       return false
+               }
                if input.AssetID() == *consensus.BTMAssetID {
                        return false
                }
        }
+
        return true
 }
 
 func isTransactionZeroOutput(tx *types.Tx) bool {
        for _, output := range tx.TxData.Outputs {
-               value := output.AssetAmount()
-               if value.Amount == uint64(0) {
+               if value := output.AssetAmount(); value.Amount == uint64(0) {
                        return true
                }
        }
@@ -277,11 +281,12 @@ func (tp *TxPool) addTransaction(txD *TxDesc) error {
        txD.Added = time.Now()
        tp.pool[tx.ID] = txD
        for _, id := range tx.ResultIds {
-               var assetID bc.AssetID
                outputEntry, err := tx.Entry(*id)
                if err != nil {
                        return err
                }
+
+               var assetID bc.AssetID
                switch output := outputEntry.(type) {
                case *bc.IntraChainOutput:
                        assetID = *output.Source.Value.AssetId