pub trait MakeCpfp {
// Required methods
fn make_signed_p2a_cpfp(
&mut self,
tx: &Transaction,
fees: MakeCpfpFees,
) -> Result<Transaction, CpfpError>;
fn store_signed_p2a_cpfp(
&mut self,
tx: &Transaction,
) -> Result<(), CpfpError>;
}Expand description
Ability to create and persist CPFP transactions for spending P2A outputs.
Required Methods§
Sourcefn make_signed_p2a_cpfp(
&mut self,
tx: &Transaction,
fees: MakeCpfpFees,
) -> Result<Transaction, CpfpError>
fn make_signed_p2a_cpfp( &mut self, tx: &Transaction, fees: MakeCpfpFees, ) -> Result<Transaction, CpfpError>
Creates a signed Child Pays for Parent (CPFP) transaction using a Pay-to-Anchor (P2A) output to broadcast unilateral exits and other TRUC transactions.
For more information please see BIP431.
§Arguments
tx- A parentTransactionthat is guaranteed to have one P2A output which implementations must spend so that both the parent and child transactions can be broadcast to the network as a v3 transaction package.fees- Informs the implementation how fees should be paid by the child transaction. Note that an effective fee rate should be calculated using the weight of both the parent and child transactions.
§Returns
Returns a Result containing:
Transaction- The signed CPFP transaction ready to be broadcasted to the network with the given parent transaction if construction and signing were successful.CpfpError- An error indicating the reason for failure in constructing the CPFP transaction (e.g., insufficient funds, invalid parent transaction, or signing failure).
Sourcefn store_signed_p2a_cpfp(&mut self, tx: &Transaction) -> Result<(), CpfpError>
fn store_signed_p2a_cpfp(&mut self, tx: &Transaction) -> Result<(), CpfpError>
Persist the signed CPFP transaction so it can be rebroadcast or retrieved as needed.