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

Fix maxBy() exception in the case of empty Blockchain in ChainHandler… #1934

Merged
merged 2 commits into from Aug 29, 2020

Conversation

Christewart
Copy link
Contributor

….bestFilterHeaderSearch()

This was introduced in #1926

The use of maxBy() is tricky in the Scala standard library, as it throws an exception if the Vector is empty. This PR adds a guard for the case that we are syncing a new node from scratch, we will have zero filter headers in the database. Previously we would fail with a throw new UnsupportedOperationException("empty.maxBy")

@Christewart Christewart added bug chain work on the chain project labels Aug 29, 2020
@Christewart Christewart merged commit 5785f0c into bitcoin-s:master Aug 29, 2020
Christewart added a commit that referenced this pull request May 1, 2021
#1934)

* Fix maxBy() exception in the case of empty Blockchain in ChainHandler.bestFilterHeaderSearch()

* Add another unit test to CompactFilterHeaderDAO for coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug chain work on the chain project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants