Skip to content

Commit

Permalink
Document monitor archival idempotency requirement.
Browse files Browse the repository at this point in the history
  • Loading branch information
arik-so committed Sep 19, 2024
1 parent 66fb520 commit 59a71b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lightning/src/chain/chainmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ pub trait Persist<ChannelSigner: EcdsaChannelSigner> {
///
/// Archiving the data in a backup location (rather than deleting it fully) is useful for
/// hedging against data loss in case of unexpected failure.
///
/// Note that if a crash occurs during the archiving process, a state may emerge where the
/// monitor is copied to the archive path but isn't removed yet. In that scenario, the monitor
/// would still end up being loaded on startup pending successful archival completion.
/// Additionally, this scenario might see the monitor being written to the archive path twice,
/// which is why this method must be idempotent and be able to handle monitors already existing
/// in the archive directory.
fn archive_persisted_channel(&self, channel_funding_outpoint: OutPoint);
}

Expand Down

0 comments on commit 59a71b3

Please sign in to comment.