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.
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.
Sourcepub fn new(
input_vtxos: &'a [V],
offboard_tx: &'a Transaction,
) -> Result<Self, OffboardForfeitError>
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.
Sourcepub fn validate_offboard_tx(
&self,
req: &OffboardRequest,
) -> Result<(), InvalidOffboardTxError>
pub fn validate_offboard_tx( &self, req: &OffboardRequest, ) -> Result<(), InvalidOffboardTxError>
Validate offboard tx matches offboard request
Source§impl<'a, V> OffboardForfeitContext<'a, V>
impl<'a, V> OffboardForfeitContext<'a, V>
Sourcepub fn user_sign_forfeits(
&self,
keys: &[impl Borrow<Keypair>],
server_nonces: &[PublicNonce],
) -> Result<OffboardForfeitSignatures, OffboardForfeitError>
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.
Sourcepub 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>
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.