Split get_tx into its own trait

to make supporting verify_tx easier
This commit is contained in:
LLFourn
2022-02-23 10:38:35 +11:00
parent dcd90f8b61
commit c0e75fc1a8
10 changed files with 65 additions and 69 deletions

View File

@@ -68,10 +68,6 @@ impl Blockchain for ElectrumBlockchain {
.collect()
}
fn get_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error> {
Ok(self.client.transaction_get(txid).map(Option::Some)?)
}
fn broadcast(&self, tx: &Transaction) -> Result<(), Error> {
Ok(self.client.transaction_broadcast(tx).map(|_| ())?)
}
@@ -94,6 +90,12 @@ impl GetHeight for ElectrumBlockchain {
}
}
impl GetTx for ElectrumBlockchain {
fn get_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error> {
Ok(self.client.transaction_get(txid).map(Option::Some)?)
}
}
impl WalletSync for ElectrumBlockchain {
fn wallet_setup<D: BatchDatabase>(
&self,