[Chronik] Fix catch_merge_errors by keeping intermediate results
Summary:
The current catch_merge_errors function is insufficient, for the following reason:
- When using merge_cf, it seems like RocksDB applies them on the fly for potentially many values, even if they've been read (and thus applied) before already.
- This means that a previous successful call to merge_cf would be reverted by the old catch_merge_errors, as any failed merge op would cause all previous successful applications to be discarded, causing a sort-of spooky removal action at a distance.
The solution is to keep previous successful applications of merge operands and to return the value from just before the error occured as the result of the merge function.
Test Plan: ninja check-crates && ninja check-functional
Reviewers: Fabien, #bitcoin_abc
Reviewed By: Fabien, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D14505