Add test_bump_txn_sanitize_tracking_maps
[rust-lightning] / lightning / src / ln / channelmonitor.rs
index 154d8ccf70d29ccd641c85f9105b54b9783c707e..d83171bd1ec981a96500a1356ea531034d4b359f 100644 (file)
@@ -513,7 +513,7 @@ enum OnchainEvent {
 
 /// Higher-level cache structure needed to re-generate bumped claim txn if needed
 #[derive(Clone, PartialEq)]
-struct ClaimTxBumpMaterial {
+pub struct ClaimTxBumpMaterial {
        // At every block tick, used to check if pending claiming tx is taking too
        // much time for confirmation and we need to bump it.
        height_timer: u32,
@@ -621,6 +621,9 @@ pub struct ChannelMonitor {
        // Key is identifier of the pending claim request, i.e the txid of the initial claiming transaction generated by
        // us and is immutable until all outpoint of the claimable set are post-anti-reorg-delay solved.
        // Entry is cache of elements need to generate a bumped claiming transaction (see ClaimTxBumpMaterial)
+       #[cfg(test)] // Used in functional_test to verify sanitization
+       pub pending_claim_requests: HashMap<Sha256dHash, ClaimTxBumpMaterial>,
+       #[cfg(not(test))]
        pending_claim_requests: HashMap<Sha256dHash, ClaimTxBumpMaterial>,
 
        // Used to link outpoints claimed in a connected block to a pending claim request.
@@ -629,6 +632,9 @@ pub struct ChannelMonitor {
        // is txid of the initial claiming transaction and is immutable until outpoint is
        // post-anti-reorg-delay solved, confirmaiton_block is used to erase entry if
        // block with output gets disconnected.
+       #[cfg(test)] // Used in functional_test to verify sanitization
+       pub claimable_outpoints: HashMap<BitcoinOutPoint, (Sha256dHash, u32)>,
+       #[cfg(not(test))]
        claimable_outpoints: HashMap<BitcoinOutPoint, (Sha256dHash, u32)>,
 
        // Used to track onchain events, i.e transactions parts of channels confirmed on chain, on which