Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore unconfirmed spent input #198

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Sep 26, 2024

  1. feat: wallet unconfirmed balance.

    wallet subscribes to mempool via tokio broadcast to track owned utxos.
    
    Changes:
    
     * add spent_utxos, unspent_utxos lists to WalletState struct
     * add WalletState::handle_mempool_event()
     * add test confirmed_and_unconfirmed_balance()
     * add Mempool::event_channel (tokio broadcast channel)
     * Mempool faillible mutation methods return Result()
     * Mempool mutable methods broadcast MempoolEvent
     * add tests::shared::mine_block_to_wallet()
     * lib.rs: spawn wallet task for listening to mempool events
       and dispatch to WalletState for handling.
     * add locks::tokio::AtomicRw::try_lock_guard_mut()
    dan-da committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    98f8071 View commit details
    Browse the repository at this point in the history
  2. refactor: wallet updates now atomic with mempool

    removes the mempool broadcast channel and wallet listener task.
    
    Instead all mempool mutations go through GlobalState methods
    which inform wallet of the changes.  This makes changes atomic
    over mempool+wallet so they are always in sync.
    
    Changes:
     * remove Mempool::event_channel
     * Mempool &mut methods only callable by super
     * Mempool &mut methods return MempoolEvent(s)
     * add MempoolEvent::UpdateTxMutatorSet.  (unused)
     * add GlobalState methods: mempool_clear, mempool_insert,
        mempool_prune_stale_transactions
     * remove spawn_wallet_task from lib.rs
     * add/improve doc-comments
    dan-da committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    da50084 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2024

  1. fix: prevent spending same input twice.

    closes Neptune-Crypto#189.
    
    input selection now ignores spent inputs from unconfirmed tx in the
    mempool.
    
    Also fixes an input selection bug where the balance check considers
    available funds (not timelocked) but the input utxo selection does not.
    
    Adds a test to verify that same input can no longer be spent twice.
    dan-da committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    9ec1de6 View commit details
    Browse the repository at this point in the history