Trait dlc_manager::Blockchain
source · pub trait Blockchain {
// Required methods
fn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>;
fn get_network(&self) -> Result<Network, Error>;
fn get_blockchain_height(&self) -> Result<u64, Error>;
fn get_block_at_height(&self, height: u64) -> Result<Block, Error>;
fn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>;
fn get_transaction_confirmations(&self, tx_id: &Txid) -> Result<u32, Error>;
}
Expand description
Blockchain trait provides access to the bitcoin blockchain.
Required Methods§
sourcefn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>
fn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>
Broadcast the given transaction to the bitcoin network.
sourcefn get_network(&self) -> Result<Network, Error>
fn get_network(&self) -> Result<Network, Error>
Returns the network currently used (mainnet, testnet or regtest).
sourcefn get_blockchain_height(&self) -> Result<u64, Error>
fn get_blockchain_height(&self) -> Result<u64, Error>
Returns the height of the blockchain
sourcefn get_block_at_height(&self, height: u64) -> Result<Block, Error>
fn get_block_at_height(&self, height: u64) -> Result<Block, Error>
Returns the block at given height
sourcefn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>
fn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>
Get the transaction with given id.