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

[Bug] Fix panic in fee estimator from reorgs #434

Merged
merged 1 commit into from
Dec 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions mempool/estimatefee.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ func (ef *FeeEstimator) RegisterBlock(block *bchutil.Block) error {
return errors.New("Transaction has already been mined")
}

// This shouldn't happen but check just in case to avoid
// an out-of-bounds array index later.
if blocksToConfirm >= estimateFeeDepth {
// This shouldn't happen in normal operation but check just in case
// to avoid an out-of-bounds array index later. Make sure to cover
// negative indexes in the case of reorgs.
if blocksToConfirm >= estimateFeeDepth || blocksToConfirm < 0 {
continue
}

Expand Down