Struct revault_tx::transactions::UnvaultTransaction
source · [−]pub struct UnvaultTransaction(_);
Expand description
The unvaulting transaction, spending a deposit and being eventually spent by a spend transaction (if not revaulted).
Implementations
sourceimpl UnvaultTransaction
impl UnvaultTransaction
sourcepub fn new(
deposit_input: DepositTxIn,
unvault_descriptor: &DerivedUnvaultDescriptor,
cpfp_descriptor: &DerivedCpfpDescriptor
) -> Result<UnvaultTransaction, TransactionCreationError>
pub fn new(
deposit_input: DepositTxIn,
unvault_descriptor: &DerivedUnvaultDescriptor,
cpfp_descriptor: &DerivedCpfpDescriptor
) -> Result<UnvaultTransaction, TransactionCreationError>
An unvault transaction always spends one deposit output and contains one CPFP output in addition to the unvault one. It’s always created using a fixed feerate and the CPFP output value is fixed as well.
BIP174 Creator and Updater roles.
sourcepub fn spend_unvault_txin(
&self,
unvault_descriptor: &DerivedUnvaultDescriptor
) -> UnvaultTxIn
pub fn spend_unvault_txin(
&self,
unvault_descriptor: &DerivedUnvaultDescriptor
) -> UnvaultTxIn
Get the Unvault txo to be referenced in a spending transaction
sourcepub fn revault_unvault_txin(
&self,
unvault_descriptor: &DerivedUnvaultDescriptor
) -> UnvaultTxIn
pub fn revault_unvault_txin(
&self,
unvault_descriptor: &DerivedUnvaultDescriptor
) -> UnvaultTxIn
Get the Unvault txo to be referenced in a revocation transaction
sourcepub fn from_raw_psbt(
raw_psbt: &[u8]
) -> Result<Self, TransactionSerialisationError>
pub fn from_raw_psbt(
raw_psbt: &[u8]
) -> Result<Self, TransactionSerialisationError>
Parse an Unvault transaction from a PSBT
Trait Implementations
sourceimpl Clone for UnvaultTransaction
impl Clone for UnvaultTransaction
sourcefn clone(&self) -> UnvaultTransaction
fn clone(&self) -> UnvaultTransaction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl CpfpableTransaction for UnvaultTransaction
impl CpfpableTransaction for UnvaultTransaction
sourcefn max_weight(&self) -> u64
fn max_weight(&self) -> u64
Get the size of this transaction, assuming fully-satisfied inputs. If the transaction is already finalized, returns the exact size in witness units. Otherwise computes the maximum reasonable weight of a satisfaction. Read more
sourcefn cpfp_txin(
&self,
cpfp_descriptor: &CpfpDescriptor,
secp: &Secp256k1<impl Verification>
) -> Option<CpfpTxIn>
fn cpfp_txin(
&self,
cpfp_descriptor: &CpfpDescriptor,
secp: &Secp256k1<impl Verification>
) -> Option<CpfpTxIn>
Return the txin refering to the output to spend to CPFP this transaction, if any.
sourcefn max_feerate(&self) -> u64
fn max_feerate(&self) -> u64
Get the feerate of this transaction, assuming fully-satisfied inputs. If the transaction is already finalized, returns the exact feerate. Otherwise computes the maximum reasonable weight of a satisfaction and returns the feerate based on this estimation. Read more
sourceimpl Debug for UnvaultTransaction
impl Debug for UnvaultTransaction
sourceimpl Display for UnvaultTransaction
impl Display for UnvaultTransaction
sourceimpl FromStr for UnvaultTransaction
impl FromStr for UnvaultTransaction
sourceimpl PartialEq<UnvaultTransaction> for UnvaultTransaction
impl PartialEq<UnvaultTransaction> for UnvaultTransaction
sourcefn eq(&self, other: &UnvaultTransaction) -> bool
fn eq(&self, other: &UnvaultTransaction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &UnvaultTransaction) -> bool
fn ne(&self, other: &UnvaultTransaction) -> bool
This method tests for !=
.
sourceimpl RevaultPresignedTransaction for UnvaultTransaction
impl RevaultPresignedTransaction for UnvaultTransaction
sourcefn sig_hash(&self) -> Result<SigHash, InputSatisfactionError>
fn sig_hash(&self) -> Result<SigHash, InputSatisfactionError>
Get the sighash for the single input of a presigned Revault transaction.
sourcefn sig_hash_cached(
&self,
cache: &mut SigHashCache<&Transaction>
) -> Result<SigHash, InputSatisfactionError>
fn sig_hash_cached(
&self,
cache: &mut SigHashCache<&Transaction>
) -> Result<SigHash, InputSatisfactionError>
Cached version of [RevaultPresignedTransaction::signature_hash]
sourcefn add_sig<C: Verification>(
&mut self,
pubkey: PublicKey,
signature: Signature,
secp: &Secp256k1<C>
) -> Result<Option<Vec<u8>>, InputSatisfactionError>
fn add_sig<C: Verification>(
&mut self,
pubkey: PublicKey,
signature: Signature,
secp: &Secp256k1<C>
) -> Result<Option<Vec<u8>>, InputSatisfactionError>
Add a signature to the single input of a presigned Revault transaction. Read more
sourcefn signatures(&self) -> &BTreeMap<BitcoinPubKey, Vec<u8>>
fn signatures(&self) -> &BTreeMap<BitcoinPubKey, Vec<u8>>
Get the signatures for the single input of this presigned Revault transaction.
impl StructuralPartialEq for UnvaultTransaction
Auto Trait Implementations
impl RefUnwindSafe for UnvaultTransaction
impl Send for UnvaultTransaction
impl Sync for UnvaultTransaction
impl Unpin for UnvaultTransaction
impl UnwindSafe for UnvaultTransaction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> RevaultTransaction for T where
T: PrivateInnerMut + Debug + Clone + PartialEq<T>,
impl<T> RevaultTransaction for T where
T: PrivateInnerMut + Debug + Clone + PartialEq<T>,
sourcefn is_finalizable(&self, ctx: &Secp256k1<impl Verification>) -> bool
fn is_finalizable(&self, ctx: &Secp256k1<impl Verification>) -> bool
Check the transaction is valid (fully-signed) and can be finalized. Slighty more efficient than calling RevaultTransaction::finalize on a clone as it gets rid of the belt-and-suspenders checks.
sourcefn is_finalized(&self) -> bool
fn is_finalized(&self) -> bool
Check if the transaction was already finalized.
sourcefn verify_inputs(&self) -> Result<(), Error>
fn verify_inputs(&self) -> Result<(), Error>
Verify all PSBT inputs against libbitcoinconsensus
sourcefn into_bitcoin_serialized(self) -> Vec<u8, Global>
fn into_bitcoin_serialized(self) -> Vec<u8, Global>
Get the network-serialized (inner) transaction. You likely want to be sure the transaction [RevaultTransaction.is_finalized] before serializing it.
The BIP174 Transaction Extractor (without any check, which are done in [RevaultTransaction.finalize]).
sourcefn as_psbt_serialized(&self) -> Vec<u8, Global>
fn as_psbt_serialized(&self) -> Vec<u8, Global>
Get the BIP174-serialized (inner) transaction.
sourcefn as_psbt_string(&self) -> String
fn as_psbt_string(&self) -> String
Get the BIP174-serialized (inner) transaction encoded in base64.
sourcefn from_psbt_str(psbt_str: &str) -> Result<T, TransactionSerialisationError>
fn from_psbt_str(psbt_str: &str) -> Result<T, TransactionSerialisationError>
Create a RevaultTransaction from a base64-encoded BIP174-serialized transaction.
sourcefn from_psbt_serialized(
raw_psbt: &[u8]
) -> Result<T, TransactionSerialisationError>
fn from_psbt_serialized(
raw_psbt: &[u8]
) -> Result<T, TransactionSerialisationError>
Create a RevaultTransaction from a base64-encoded BIP174-serialized transaction.
sourcefn into_tx(self) -> Transaction
fn into_tx(self) -> Transaction
Extract the inner transaction of the inner PSBT. You likely want to be sure the transaction [RevaultTransaction.is_finalized] before serializing it.
The BIP174 Transaction Extractor (without any check, which are done in [RevaultTransaction.finalize]).
sourcefn signature_hash(
&self,
input_index: usize
) -> Result<SigHash, InputSatisfactionError>
fn signature_hash(
&self,
input_index: usize
) -> Result<SigHash, InputSatisfactionError>
Get the sighash for an input of a Revault transaction. Will deduce the scriptCode from the previous witness script. NOTE: transactions are always signed with the SIGHASH_ALL flag. Read more
sourcefn signature_hash_cached(
&self,
input_index: usize,
cache: &mut SigHashCache<&Transaction>
) -> Result<SigHash, InputSatisfactionError>
fn signature_hash_cached(
&self,
input_index: usize,
cache: &mut SigHashCache<&Transaction>
) -> Result<SigHash, InputSatisfactionError>
Cached version of RevaultTransaction::signature_hash
sourcefn add_signature<C>(
&mut self,
input_index: usize,
pubkey: PublicKey,
signature: Signature,
secp: &Secp256k1<C>
) -> Result<Option<Vec<u8, Global>>, InputSatisfactionError> where
C: Verification,
fn add_signature<C>(
&mut self,
input_index: usize,
pubkey: PublicKey,
signature: Signature,
secp: &Secp256k1<C>
) -> Result<Option<Vec<u8, Global>>, InputSatisfactionError> where
C: Verification,
Add a signature in order to eventually satisfy this input. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more