pub struct CommitmentOutputs {
pub receiver_outputs: DeterministicOutputsForOneContext,
pub sender_outputs: DeterministicOutputsForOneContext,
}Expand description
Commitment outputs for a specific balance distribution Contains the deterministic outputs for both sender (Alice) and receiver (Charlie) at a specific balance point in the channel
Fields§
§receiver_outputs: DeterministicOutputsForOneContextReceiver’s (Charlie’s) deterministic outputs
sender_outputs: DeterministicOutputsForOneContextSender’s (Alice’s) deterministic outputs
Implementations§
Source§impl CommitmentOutputs
impl CommitmentOutputs
Sourcepub fn new(
receiver_outputs: DeterministicOutputsForOneContext,
sender_outputs: DeterministicOutputsForOneContext,
) -> Self
pub fn new( receiver_outputs: DeterministicOutputsForOneContext, sender_outputs: DeterministicOutputsForOneContext, ) -> Self
Create new commitment outputs
Sourcepub fn for_balance(
receiver_balance: u64,
params: &ChannelParameters,
) -> Result<Self>
pub fn for_balance( receiver_balance: u64, params: &ChannelParameters, ) -> Result<Self>
Create commitment outputs for a given receiver balance
Given the receiver’s (Charlie’s) desired final balance, this creates:
- One DeterministicOutputsForOneContext for the receiver (Charlie)
- One DeterministicOutputsForOneContext for the sender (Alice) with the remainder
The process:
- Use inverse function to find nominal value for receiver’s deterministic outputs
- Calculate sender’s nominal value as: amount_after_stage1 - receiver_nominal
- Create both sets of outputs wrapped in CommitmentOutputs
Parameters:
- receiver_balance: The desired final balance for the receiver (after stage 2 fees)
- params: Channel parameters
Returns CommitmentOutputs containing both receiver and sender outputs
Sourcepub fn create_swap_request(
&self,
funding_proofs: Vec<Proof>,
override_keyset_id: Option<Id>,
) -> Result<SwapRequest, Error>
pub fn create_swap_request( &self, funding_proofs: Vec<Proof>, override_keyset_id: Option<Id>, ) -> Result<SwapRequest, Error>
Create an unsigned swap request from this commitment
Takes the funding proofs and creates a SwapRequest with:
- Inputs: all funding proofs
- Outputs: all outputs sorted by amount (stable) for privacy
The swap request is unsigned and needs to be signed by the sender (Alice) before sending
Sourcepub fn unblind_all(
&self,
blind_signatures: Vec<BlindSignature>,
active_keys: &Keys,
) -> Result<Vec<ProofWithMetadata>, Error>
pub fn unblind_all( &self, blind_signatures: Vec<BlindSignature>, active_keys: &Keys, ) -> Result<Vec<ProofWithMetadata>, Error>
Unblind all outputs from a swap response
Takes the blind signatures from the swap response and returns
a vector of ProofWithMetadata containing each proof along with
its amount, index, and ownership flag.
The caller can filter by is_receiver to separate receiver/sender proofs.
Sourcepub async fn restore_all_blind_signatures<M>(
&self,
mint_connection: &M,
) -> Result<Vec<BlindSignature>, Error>where
M: MintConnection + ?Sized,
pub async fn restore_all_blind_signatures<M>(
&self,
mint_connection: &M,
) -> Result<Vec<BlindSignature>, Error>where
M: MintConnection + ?Sized,
Restore blind signatures from the mint using NUT-09
This allows recovering the blind signatures for a commitment transaction without needing to have received them from the original swap. Since outputs are deterministic, we can recreate the blinded messages and ask the mint to restore the corresponding blind signatures.
Returns the blind signatures in the same order as create_swap_request: sorted by amount (stable) for privacy
Trait Implementations§
Source§impl Clone for CommitmentOutputs
impl Clone for CommitmentOutputs
Source§fn clone(&self) -> CommitmentOutputs
fn clone(&self) -> CommitmentOutputs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more