Skip to content

Commit

Permalink
feat: persist ExpectedUtxo to disk (db)
Browse files Browse the repository at this point in the history
closes #172, #137.

fixes loss-of-funds scenario.

changes:
 * add RustyWalletDatabase::expected_utxos (DbtVec)
 * remove UtxoNotificationPool
 * remove UtxoNotifier::PeerUnsigned
 * add WalletState methods:
    add_expected_utxo(), scan_for_expected_utxos()
 * disables timer call to prune_stale_expected_utxos() for now.
 + remove cli args:
    max_utxo_notification_size,
    max_unconfirmed_utxo_notification_count_per_peer
 * mod utxo_notification_pool --> expected_utxo
 * derive Hash for Timestamp

tests:
 * adapt existing tests to changes
 * move tests from utxo_notification_pool into wallet_state
 * adds regression tests for issue #172 that verify:
    1.  expected_utxo are persisted if db is written to disk.
    2.  expected_utxo are not persisted if db is not written to disk.
  • Loading branch information
dan-da committed Aug 19, 2024
1 parent 2e97005 commit d2f87f4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/models/state/wallet/wallet_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,13 @@ impl WalletState {
/// note: It is questionable if this method should ever be called
/// as presently implemented.
///
/// issues:
/// 1. expiration does not consider if utxo has been
/// claimed by wallet or not.
/// 2. expiration thresholds are based on time, not
/// # of blocks.
/// 3. what if a deep re-org occurs after ExpectedUtxo
/// have been expired? possible loss of funds.
/// issues:
/// 1. expiration does not consider if utxo has been
/// claimed by wallet or not.
/// 2. expiration thresholds are based on time, not
/// # of blocks.
/// 3. what if a deep re-org occurs after ExpectedUtxo
/// have been expired? possible loss of funds.
///
/// Fundamentally, any time we remove an ExpectedUtxo we risk a possible
/// loss of funds in the future.
Expand Down

0 comments on commit d2f87f4

Please sign in to comment.