chainntnfs/btcd: remove unnecessary check for tx==nil

This commit is contained in:
Johan T. Halseth 2018-08-24 13:54:36 +02:00
parent a91466e9fa
commit 4a60887974
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -569,10 +569,12 @@ func (b *BtcdNotifier) historicalConfDetails(txid *chainhash.Hash,
return txConf, txStatus, nil return txConf, txStatus, nil
} }
// confDetailsFromTxIndex looks up whether a transaction is already included // confDetailsFromTxIndex looks up whether a transaction is already included in
// in a block in the active chain by using the backend node's transaction index. // a block in the active chain by using the backend node's transaction index.
// If the transaction is found, its confirmation details are returned. // If the transaction is found its TxConfStatus is returned. If it was found in
// Otherwise, nil is returned. // the mempool this will be TxFoundMempool, if it is found in a block this will
// be TxFoundIndex. Otherwise TxNotFoundIndex is returned. If the tx is found
// in a block its confirmation details are also returned.
func (b *BtcdNotifier) confDetailsFromTxIndex(txid *chainhash.Hash, func (b *BtcdNotifier) confDetailsFromTxIndex(txid *chainhash.Hash,
) (*chainntnfs.TxConfirmation, txConfStatus, error) { ) (*chainntnfs.TxConfirmation, txConfStatus, error) {
@ -597,9 +599,9 @@ func (b *BtcdNotifier) confDetailsFromTxIndex(txid *chainhash.Hash,
} }
// Make sure we actually retrieved a transaction that is included in a // Make sure we actually retrieved a transaction that is included in a
// block. Without this, we won't be able to retrieve its confirmation // block. If not, the transaction must be unconfirmed (in the mempool),
// details. // and we'll return TxFoundMempool together with a nil TxConfirmation.
if tx == nil || tx.BlockHash == "" { if tx.BlockHash == "" {
return nil, txFoundMempool, nil return nil, txFoundMempool, nil
} }