[avalanche] Only allow contender cache cleanup up to the height of the last promoted block
Summary:
If contender cache cleanup occurs at height N before promoteToBlock() has been called at that height, data loss could occur by cleaning up cached remote proofs that have not been promoted yet.
In practice, the cache is always promoting entries ahead of the cleanup height, which is the height of the last finalized block. However, promotions do not occur until the first block is finalized in order to prevent uncontrolled cache growth, so this change also ensures proofs received before the first finalized block are not cleaned up until they are promoted.
Test Plan:
ninja check-avalanche-stakecontendercache_tests
Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D17075