diff --git a/chainntnfs/bitcoindnotify/bitcoind.go b/chainntnfs/bitcoindnotify/bitcoind.go index 8c235213..36f7ce19 100644 --- a/chainntnfs/bitcoindnotify/bitcoind.go +++ b/chainntnfs/bitcoindnotify/bitcoind.go @@ -521,7 +521,7 @@ func (b *BitcoindNotifier) confDetailsManually(txid *chainhash.Hash, // Begin scanning blocks at every height to determine where the // transaction was included in. - for height := heightHint; height <= currentHeight; height++ { + for height := currentHeight; height >= heightHint && height > 0; height-- { // Ensure we haven't been requested to shut down before // processing the next height. select { @@ -749,7 +749,7 @@ func (b *BitcoindNotifier) dispatchSpendDetailsManually( // Begin scanning blocks at every height to determine if the outpoint // was spent. - for height := startHeight; height <= endHeight; height++ { + for height := endHeight; height >= startHeight && height > 0; height-- { // Ensure we haven't been requested to shut down before // processing the next height. select { diff --git a/chainntnfs/btcdnotify/btcd.go b/chainntnfs/btcdnotify/btcd.go index bb5e55a4..30b790dd 100644 --- a/chainntnfs/btcdnotify/btcd.go +++ b/chainntnfs/btcdnotify/btcd.go @@ -572,7 +572,7 @@ func (b *BtcdNotifier) confDetailsManually(txid *chainhash.Hash, startHeight, // Begin scanning blocks at every height to determine where the // transaction was included in. - for height := startHeight; height <= endHeight; height++ { + for height := endHeight; height >= startHeight && height > 0; height-- { // Ensure we haven't been requested to shut down before // processing the next height. select { diff --git a/chainntnfs/neutrinonotify/neutrino.go b/chainntnfs/neutrinonotify/neutrino.go index 34b8285f..abc21671 100644 --- a/chainntnfs/neutrinonotify/neutrino.go +++ b/chainntnfs/neutrinonotify/neutrino.go @@ -467,7 +467,7 @@ func (n *NeutrinoNotifier) historicalConfDetails(targetHash *chainhash.Hash, // Starting from the height hint, we'll walk forwards in the chain to // see if this transaction has already been confirmed. - for scanHeight := startHeight; scanHeight <= endHeight; scanHeight++ { + for scanHeight := endHeight; scanHeight >= startHeight && scanHeight > 0; scanHeight-- { // Ensure we haven't been requested to shut down before // processing the next height. select {