Refactor signer traits, add support for taproot signatures
This commit is contained in:
@@ -50,7 +50,7 @@ pub use utils::IsDust;
|
||||
|
||||
use address_validator::AddressValidator;
|
||||
use coin_selection::DefaultCoinSelectionAlgorithm;
|
||||
use signer::{SignOptions, Signer, SignerOrdering, SignersContainer};
|
||||
use signer::{SignOptions, SignerOrdering, SignersContainer, TransactionSigner};
|
||||
use tx_builder::{BumpFee, CreateTx, FeePolicy, TxBuilder, TxParams};
|
||||
use utils::{check_nlocktime, check_nsequence_rbf, After, Older, SecpCtx};
|
||||
|
||||
@@ -79,10 +79,10 @@ const CACHE_ADDR_BATCH_SIZE: u32 = 100;
|
||||
///
|
||||
/// 1. output *descriptors* from which it can derive addresses.
|
||||
/// 2. A [`Database`] where it tracks transactions and utxos related to the descriptors.
|
||||
/// 3. [`Signer`]s that can contribute signatures to addresses instantiated from the descriptors.
|
||||
/// 3. [`signer`]s that can contribute signatures to addresses instantiated from the descriptors.
|
||||
///
|
||||
/// [`Database`]: crate::database::Database
|
||||
/// [`Signer`]: crate::signer::Signer
|
||||
/// [`signer`]: crate::signer
|
||||
#[derive(Debug)]
|
||||
pub struct Wallet<D> {
|
||||
descriptor: ExtendedDescriptor,
|
||||
@@ -457,7 +457,7 @@ where
|
||||
&mut self,
|
||||
keychain: KeychainKind,
|
||||
ordering: SignerOrdering,
|
||||
signer: Arc<dyn Signer>,
|
||||
signer: Arc<dyn TransactionSigner>,
|
||||
) {
|
||||
let signers = match keychain {
|
||||
KeychainKind::External => Arc::make_mut(&mut self.signers),
|
||||
@@ -1036,13 +1036,7 @@ where
|
||||
.iter()
|
||||
.chain(self.change_signers.signers().iter())
|
||||
{
|
||||
if signer.sign_whole_tx() {
|
||||
signer.sign(psbt, None, &self.secp)?;
|
||||
} else {
|
||||
for index in 0..psbt.inputs.len() {
|
||||
signer.sign(psbt, Some(index), &self.secp)?;
|
||||
}
|
||||
}
|
||||
signer.sign_transaction(psbt, &self.secp)?;
|
||||
}
|
||||
|
||||
// attempt to finalize
|
||||
|
||||
Reference in New Issue
Block a user