Remove BuildTxLockPsbt and GetNetwork traits

These traits were only used once within the `TxLock` constructor.
Looking at the rest of the codebase, we don't really seem to follow
any abstractions here where the protocol shouldn't know about the
exact types that is being passed in.

As such, these types are just noise and might as well be removed in
favor of simplicity.
This commit is contained in:
Thomas Eizinger 2021-02-26 10:14:43 +11:00
parent 6c38d66864
commit 67fe01a2ef
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
4 changed files with 14 additions and 44 deletions

View file

@ -22,9 +22,7 @@ pub use wallet::Wallet;
use crate::execution_params::ExecutionParams;
use ::bitcoin::{
hashes::{hex::ToHex, Hash},
secp256k1,
util::psbt::PartiallySignedTransaction,
SigHash,
secp256k1, SigHash,
};
use anyhow::{anyhow, bail, Result};
use async_trait::async_trait;
@ -203,15 +201,6 @@ pub fn build_shared_output_descriptor(A: Point, B: Point) -> Descriptor<bitcoin:
Descriptor::Wsh(Wsh::new(miniscript).expect("a valid descriptor"))
}
#[async_trait]
pub trait BuildTxLockPsbt {
async fn build_tx_lock_psbt(
&self,
output_address: Address,
output_amount: Amount,
) -> Result<PartiallySignedTransaction>;
}
#[async_trait]
pub trait SignTxLock {
async fn sign_tx_lock(&self, tx_lock: TxLock) -> Result<Transaction>;
@ -251,11 +240,6 @@ pub trait GetRawTransaction {
async fn get_raw_transaction(&self, txid: Txid) -> Result<Transaction>;
}
#[async_trait]
pub trait GetNetwork {
async fn get_network(&self) -> Network;
}
pub fn recover(S: PublicKey, sig: Signature, encsig: EncryptedSignature) -> Result<SecretKey> {
let adaptor = Adaptor::<HashTranscript<Sha256>, Deterministic<Sha256>>::default();