pub struct Signer(/* private fields */);Expand description
Implements the BIP-370 Signer role.
Implementations§
Source§impl Signer
impl Signer
Sourcepub fn new(psbt: Psbt) -> Result<Self, DetermineLockTimeError>
pub fn new(psbt: Psbt) -> Result<Self, DetermineLockTimeError>
Creates a Signer.
An updater can only update a PSBT that has a valid combination of lock times.
Sourcepub fn id(&self) -> Result<Txid, DetermineLockTimeError>
pub fn id(&self) -> Result<Txid, DetermineLockTimeError>
Returns this PSBT’s unique identification.
Sourcepub fn unsigned_tx(&self) -> Transaction
pub fn unsigned_tx(&self) -> Transaction
Creates an unsigned transaction from the inner Psbt.
Sourcepub fn sign<C, K>(
self,
k: &K,
secp: &Secp256k1<C>,
) -> Result<(Psbt, SigningKeys), (SigningKeys, SigningErrors)>
pub fn sign<C, K>( self, k: &K, secp: &Secp256k1<C>, ) -> Result<(Psbt, SigningKeys), (SigningKeys, SigningErrors)>
Attempts to create all the required signatures for this PSBT using k.
NOTE: Taproot inputs are, as yet, not supported by this function. We currently only attempt to sign ECDSA inputs.
If you just want to sign an input with one specific key consider using sighash_ecdsa. This
function does not support scripts that contain OP_CODESEPARATOR.
§Returns
Either Ok(SigningKeys) or Err((SigningKeys, SigningErrors)), where
- SigningKeys: A map of input index -> pubkey associated with secret key used to sign.
- SigningKeys: A map of input index -> the error encountered while attempting to sign.
If an error is returned some signatures may already have been added to the PSBT. Since
partial_sigs is a BTreeMap it is safe to retry, previous sigs will be overwritten.
Sourcepub fn ecdsa_clear_tx_modifiable(&mut self, ty: EcdsaSighashType)
pub fn ecdsa_clear_tx_modifiable(&mut self, ty: EcdsaSighashType)
Sets the PSBT_GLOBAL_TX_MODIFIABLE as required after signing an ECDSA input.
For PSBTv2s, a signer must update the PSBT_GLOBAL_TX_MODIFIABLE field after signing inputs so that it accurately reflects the state of the PSBT.