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

This commit is contained in:
Johan T. Halseth committed 2018-08-24 14:46:20 +02:00
1 parent 4a60887974
commit 89c33731fe
1 file changed
+9 -7
+9 -7
View File
@@ -501,10 +501,12 @@ func (b *BitcoindNotifier) 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 *BitcoindNotifier) confDetailsFromTxIndex(txid *chainhash.Hash, func (b *BitcoindNotifier) confDetailsFromTxIndex(txid *chainhash.Hash,
) (*chainntnfs.TxConfirmation, txConfStatus, error) { ) (*chainntnfs.TxConfirmation, txConfStatus, error) {
@@ -529,9 +531,9 @@ func (b *BitcoindNotifier) 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
} }