Break when active block tip is higher than nStopAtHeight#13490
Break when active block tip is higher than nStopAtHeight#13490qmma70 wants to merge 2 commits intobitcoin:masterfrom
Conversation
|
This seems like a very roundabout way of fixing that bug. Can't you just break the inner loop whenever the requested height is exceeded? |
|
@sipa Thanks for pointing that out. Fixed and tested. Also, would it be worth it to implement a "rewind" functionality so the block can be rewinded to the desired height, like my original commit did? |
|
@qmma70 You can use the |
|
I'll start by saying that I don't really like the way The issue reported in #13477 arises because when ABC invokes In practice, this is not currently an issue during IBD, because ABCStep will just connect one block at a time except in the case of a reorg. But we only do this to avoid holding cs_main too long; however it's possible we could change this behavior in the future and therefore break the So the most correct fix, I think, would involve embedding this into ABCStep... But I like spreading out the knowledge of this feature in multiple consensus functions even less than I like the potential bug with this... So I'd propose that we instead just (a) return at the top of |
This addresses issue #13477
In
ActivateBestChain, when the loop ends with the active chain's tip higher thannStopAtHeight, keep disconnecting the tip until the height is exactly the same asnStopAtHeight.