pub trait Database: BatchOperations {
Show 13 methods
// Required methods
fn check_descriptor_checksum<B: AsRef<[u8]>>(
&mut self,
keychain: KeychainKind,
bytes: B,
) -> Result<(), Error>;
fn iter_script_pubkeys(
&self,
keychain: Option<KeychainKind>,
) -> Result<Vec<ScriptBuf>, Error>;
fn iter_utxos(&self) -> Result<Vec<LocalUtxo>, Error>;
fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>;
fn iter_txs(
&self,
include_raw: bool,
) -> Result<Vec<TransactionDetails>, Error>;
fn get_script_pubkey_from_path(
&self,
keychain: KeychainKind,
child: u32,
) -> Result<Option<ScriptBuf>, Error>;
fn get_path_from_script_pubkey(
&self,
script: &Script,
) -> Result<Option<(KeychainKind, u32)>, Error>;
fn get_utxo(&self, outpoint: &OutPoint) -> Result<Option<LocalUtxo>, Error>;
fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>;
fn get_tx(
&self,
txid: &Txid,
include_raw: bool,
) -> Result<Option<TransactionDetails>, Error>;
fn get_last_index(
&self,
keychain: KeychainKind,
) -> Result<Option<u32>, Error>;
fn get_sync_time(&self) -> Result<Option<SyncTime>, Error>;
fn increment_last_index(
&mut self,
keychain: KeychainKind,
) -> Result<u32, Error>;
}
Expand description
Trait for reading data from a database
This traits defines the operations that can be used to read data out of a database
Required Methods§
Sourcefn check_descriptor_checksum<B: AsRef<[u8]>>(
&mut self,
keychain: KeychainKind,
bytes: B,
) -> Result<(), Error>
fn check_descriptor_checksum<B: AsRef<[u8]>>( &mut self, keychain: KeychainKind, bytes: B, ) -> Result<(), Error>
Read and checks the descriptor checksum for a given keychain.
Should return Error::ChecksumMismatch
if the
checksum doesn’t match. If there’s no checksum in the database, simply store it for the
next time.
Sourcefn iter_script_pubkeys(
&self,
keychain: Option<KeychainKind>,
) -> Result<Vec<ScriptBuf>, Error>
fn iter_script_pubkeys( &self, keychain: Option<KeychainKind>, ) -> Result<Vec<ScriptBuf>, Error>
Return the list of script_pubkeys
Sourcefn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>
fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>
Return the list of raw transactions
Sourcefn iter_txs(&self, include_raw: bool) -> Result<Vec<TransactionDetails>, Error>
fn iter_txs(&self, include_raw: bool) -> Result<Vec<TransactionDetails>, Error>
Return the list of transactions metadata
Sourcefn get_script_pubkey_from_path(
&self,
keychain: KeychainKind,
child: u32,
) -> Result<Option<ScriptBuf>, Error>
fn get_script_pubkey_from_path( &self, keychain: KeychainKind, child: u32, ) -> Result<Option<ScriptBuf>, Error>
Fetch a script_pubkey given the child number of a keychain.
Sourcefn get_path_from_script_pubkey(
&self,
script: &Script,
) -> Result<Option<(KeychainKind, u32)>, Error>
fn get_path_from_script_pubkey( &self, script: &Script, ) -> Result<Option<(KeychainKind, u32)>, Error>
Fetch the keychain and child number of a given script_pubkey
Sourcefn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>
fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>
Fetch a raw transaction given its Txid
Sourcefn get_tx(
&self,
txid: &Txid,
include_raw: bool,
) -> Result<Option<TransactionDetails>, Error>
fn get_tx( &self, txid: &Txid, include_raw: bool, ) -> Result<Option<TransactionDetails>, Error>
Fetch the transaction metadata and optionally also the raw transaction
Sourcefn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>
fn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>
Return the last derivation index for a keychain.
Sourcefn increment_last_index(&mut self, keychain: KeychainKind) -> Result<u32, Error>
fn increment_last_index(&mut self, keychain: KeychainKind) -> Result<u32, Error>
Increment the last derivation index for a keychain and return it
It should insert and return 0
if not present in the database
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.