fedimint_testing::btc

Trait BitcoinTest

Source
pub trait BitcoinTest {
    // Required methods
    fn lock_exclusive<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Box<dyn BitcoinTest + Send + Sync>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mine_blocks<'life0, 'async_trait>(
        &'life0 self,
        block_num: u64,
    ) -> Pin<Box<dyn Future<Output = Vec<BlockHash>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn prepare_funding_wallet<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_and_mine_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        address: &'life1 Address,
        amount: Amount,
    ) -> Pin<Box<dyn Future<Output = (TxOutProof, Transaction)> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_new_address<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Address> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mine_block_and_get_received<'life0, 'life1, 'async_trait>(
        &'life0 self,
        address: &'life1 Address,
    ) -> Pin<Box<dyn Future<Output = Amount> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_mempool_tx_fee<'life0, 'life1, 'async_trait>(
        &'life0 self,
        txid: &'life1 Txid,
    ) -> Pin<Box<dyn Future<Output = Amount> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_tx_block_height<'life0, 'life1, 'async_trait>(
        &'life0 self,
        txid: &'life1 Txid,
    ) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_block_count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_mempool_tx<'life0, 'life1, 'async_trait>(
        &'life0 self,
        txid: &'life1 Txid,
    ) -> Pin<Box<dyn Future<Output = Option<Transaction>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn lock_exclusive<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Box<dyn BitcoinTest + Send + Sync>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Make the underlying instance act as if it was exclusively available for the existence of the returned guard.

Source

fn mine_blocks<'life0, 'async_trait>( &'life0 self, block_num: u64, ) -> Pin<Box<dyn Future<Output = Vec<BlockHash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Mines a given number of blocks

Source

fn prepare_funding_wallet<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Prepare funding wallet

If needed will mine initial 100 blocks for send_and_mine_block to work.

Source

fn send_and_mine_block<'life0, 'life1, 'async_trait>( &'life0 self, address: &'life1 Address, amount: Amount, ) -> Pin<Box<dyn Future<Output = (TxOutProof, Transaction)> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send some bitcoin to an address then mine a block to confirm it. Returns the proof that the transaction occurred.

The implementation is responsible for making sure the funds can be sent (e.g. first 100 blocks are mined to make funds available)

Source

fn get_new_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Address> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a new address.

Source

fn mine_block_and_get_received<'life0, 'life1, 'async_trait>( &'life0 self, address: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Amount> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mine a block to include any pending transactions then get the amount received to an address

Source

fn get_mempool_tx_fee<'life0, 'life1, 'async_trait>( &'life0 self, txid: &'life1 Txid, ) -> Pin<Box<dyn Future<Output = Amount> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Waits till tx is found in mempool and returns the fees

Source

fn get_tx_block_height<'life0, 'life1, 'async_trait>( &'life0 self, txid: &'life1 Txid, ) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the block height for the txid if found.

Note: this exists since there’s a bug for using bitcoind without txindex for finding a tx block height. see: <https://github.com/fedimint/fedimint/issues/5329>

Source

fn get_block_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the current block count

Source

fn get_mempool_tx<'life0, 'life1, 'async_trait>( &'life0 self, txid: &'life1 Txid, ) -> Pin<Box<dyn Future<Output = Option<Transaction>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a transaction with the provided txid if it exists in the mempool

Implementors§