Proposed fix for (one type of) force_return errors. #995
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
When dealing with some orphan transactions1, some addresses aren't in the address map, and so when we look them up we get an invalid return value to indicate we didn't find it. However, we don't check for the sentinel value and instead try to look up its type (it's a
boost::variant
) which can assert with forced_return if thewhich_
field is outside the valid range.Fix
We don't need to look up an address in the map when all we're going to do is use the key (which must be the same type per
boost::variant
).Tested
Windows 10 mainnet wallet.
Footnotes
This only happened for me for months-old orphan blocks, and I can't tell if the address never existed or if it got corrupted at some point. ↩