Same repo and branch like “Granular invalidateblock and RewindBlockIndex #15402 “, can be merged as is.
This saves us all the cherry-picks and review of the backport cherry-picks.
Same repo and branch like “Granular invalidateblock and RewindBlockIndex #15402 “, can be merged as is.
This saves us all the cherry-picks and review of the backport cherry-picks.
Note that the former 'else' branch in RewindBlockIndex is now
dealt with more naturally inside the EraseBlockData call (by
checking whether the parent needs to be re-added as candidate
after deleting a child).
This lets us simplify the iteration to just walking back in the chain,
rather than looping over all of mapBlockIndex.
2837- invalid_walk_tip->nStatus |= BLOCK_FAILED_CHILD;
2838+ DisconnectedBlockTransactions disconnectpool;
2839+ bool ret = DisconnectTip(state, chainparams, &disconnectpool);
2840+ // DisconnectTip will add transactions to disconnectpool.
2841+ // Adjust the mempool to be consistent with the new tip, adding
2842+ // transactions back to the mempool if disconnecting was succesful,