Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chainntnfs: modify all historical rescans to scan backwards #2211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chainntnfs/bitcoindnotify/bitcoind.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion chainntnfs/btcdnotify/btcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion chainntnfs/neutrinonotify/neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down