Skip to main content

OffboardForfeitContext

Struct OffboardForfeitContext 

Source
pub struct OffboardForfeitContext<'a, V> { /* private fields */ }

Implementations§

Source§

impl<'a, V> OffboardForfeitContext<'a, V>

Construction and validation work with any VTXO representation: they only need the number of inputs, so the client can validate a prepared offboard tx with bare wallet vtxos. Only signing and finishing need the full form; those methods are bounded on AsRef<Vtxo<Full>> below.

Source

pub fn new( input_vtxos: &'a [V], offboard_tx: &'a Transaction, ) -> Result<Self, OffboardForfeitError>

Create a new OffboardForfeitContext with given input VTXOs and offboard tx

Fails with OffboardForfeitError::NoInputs if there are no input VTXOs. Every other method relies on that, so this is the only place it has to be checked.

Source

pub fn validate_offboard_tx( &self, req: &OffboardRequest, ) -> Result<(), InvalidOffboardTxError>

Validate offboard tx matches offboard request

Source§

impl<'a, V> OffboardForfeitContext<'a, V>
where V: AsRef<Vtxo<Full>>,

Source

pub fn user_sign_forfeits( &self, keys: &[impl Borrow<Keypair>], server_nonces: &[PublicNonce], ) -> Result<OffboardForfeitSignatures, OffboardForfeitError>

Sign forfeit transactions for all input VTXOs

Provide the keys for the VTXO pubkeys in order of the input VTXOs.

server_nonces comes from the server, so a wrong count is an error and not a panic: the caller can’t keep a peer from sending a malformed response, only reject it.

Call Self::validate_offboard_tx first; it reports a malformed offboard tx in full detail, where this only names what it needed.

Source

pub fn finish( &self, server_key: &Keypair, server_pub_nonces: &[PublicNonce], server_sec_nonces: Vec<SecretNonce>, user_pub_nonces: &[PublicNonce], user_partial_sigs: &[PartialSignature], ) -> Result<OffboardForfeitResult, OffboardForfeitError>

Check the user’s partial signatures and finalize the forfeit txs

user_pub_nonces and user_partial_sigs come from the user, so wrong counts are errors and not panics: the server has to be able to reject a malformed request without going down.

Call Self::validate_offboard_tx first; it reports a malformed offboard tx in full detail, where this only names what it needed.

Auto Trait Implementations§

§

impl<'a, V> Freeze for OffboardForfeitContext<'a, V>
where &'a [V]: Freeze,

§

impl<'a, V> RefUnwindSafe for OffboardForfeitContext<'a, V>
where &'a [V]: RefUnwindSafe,

§

impl<'a, V> Send for OffboardForfeitContext<'a, V>
where &'a [V]: Send,

§

impl<'a, V> Sync for OffboardForfeitContext<'a, V>
where &'a [V]: Sync,

§

impl<'a, V> Unpin for OffboardForfeitContext<'a, V>
where &'a [V]: Unpin,

§

impl<'a, V> UnsafeUnpin for OffboardForfeitContext<'a, V>
where &'a [V]: UnsafeUnpin,

§

impl<'a, V> UnwindSafe for OffboardForfeitContext<'a, V>
where &'a [V]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V