pub struct Verifier<C: CitreaClientT> {
pub citrea_client: C,
/* private fields */
}
Fields§
§citrea_client: C
Implementations§
Source§impl<C> Verifier<C>where
C: CitreaClientT,
impl<C> Verifier<C>where
C: CitreaClientT,
Sourcepub async fn create_watchtower_challenge(
&self,
transaction_data: TransactionRequestData,
commit_data: &[u8],
) -> Result<(TransactionType, Transaction, RbfSigningInfo), BridgeError>
pub async fn create_watchtower_challenge( &self, transaction_data: TransactionRequestData, commit_data: &[u8], ) -> Result<(TransactionType, Transaction, RbfSigningInfo), BridgeError>
Creates and signs the watchtower challenge with the given commit data.
§Arguments
transaction_data
- Data to identify the deposit and kickoff.commit_data
- Commit data for the watchtower challenge.
§Returns
A tuple of: 1. TransactionType: WatchtowerChallenge 2. Transaction: Signed watchtower challenge transaction 3. RbfSigningInfo: Rbf signing info for the watchtower challenge (for re-signing the transaction after a rbf input is added to the tx)
Sourcepub async fn create_and_sign_unspent_kickoff_connector_txs(
&self,
round_idx: RoundIndex,
operator_xonly_pk: XOnlyPublicKey,
) -> Result<Vec<(TransactionType, Transaction)>, BridgeError>
pub async fn create_and_sign_unspent_kickoff_connector_txs( &self, round_idx: RoundIndex, operator_xonly_pk: XOnlyPublicKey, ) -> Result<Vec<(TransactionType, Transaction)>, BridgeError>
Creates and signs all the unspent kickoff connector (using the previously saved signatures from operator during setup) transactions for a single round of an operator.
§Arguments
round_idx
- Index of the round.operator_xonly_pk
- Operator’s x-only public key.
§Returns
A vector of tuples: 1. TransactionType: UnspentKickoff(idx) for idx’th kickoff in the round 2. Transaction: Signed unspent kickoff connector transaction
Source§impl<C> Verifier<C>where
C: CitreaClientT,
impl<C> Verifier<C>where
C: CitreaClientT,
pub async fn new(config: BridgeConfig) -> Result<Self, BridgeError>
pub async fn set_operator( &self, collateral_funding_outpoint: OutPoint, operator_xonly_pk: XOnlyPublicKey, wallet_reimburse_address: Address, operator_winternitz_public_keys: Vec<PublicKey>, unspent_kickoff_sigs: Vec<Signature>, ) -> Result<(), BridgeError>
pub async fn nonce_gen( &self, num_nonces: u32, ) -> Result<(u32, Vec<PublicNonce>), BridgeError>
pub async fn deposit_sign( &self, deposit_data: DepositData, session_id: u32, agg_nonce_rx: Receiver<AggregatedNonce>, ) -> Result<Receiver<PartialSignature>, BridgeError>
Sourcepub async fn deposit_finalize(
&self,
deposit_data: &mut DepositData,
session_id: u32,
sig_receiver: Receiver<Signature>,
agg_nonce_receiver: Receiver<AggregatedNonce>,
operator_sig_receiver: Receiver<Signature>,
) -> Result<(PartialSignature, PartialSignature), BridgeError>
pub async fn deposit_finalize( &self, deposit_data: &mut DepositData, session_id: u32, sig_receiver: Receiver<Signature>, agg_nonce_receiver: Receiver<AggregatedNonce>, operator_sig_receiver: Receiver<Signature>, ) -> Result<(PartialSignature, PartialSignature), BridgeError>
TODO: This function should be split in to multiple functions
pub async fn sign_optimistic_payout( &self, nonce_session_id: u32, agg_nonce: AggregatedNonce, deposit_id: u32, input_signature: Signature, input_outpoint: OutPoint, output_script_pubkey: ScriptBuf, output_amount: Amount, ) -> Result<PartialSignature, BridgeError>
pub async fn set_operator_keys( &self, deposit_data: DepositData, keys: OperatorKeys, operator_xonly_pk: XOnlyPublicKey, ) -> Result<(), BridgeError>
Sourcepub async fn handle_kickoff<'a>(
&'a self,
dbtx: DatabaseTransaction<'a, '_>,
kickoff_witness: Witness,
deposit_data: DepositData,
kickoff_data: KickoffData,
challenged_before: bool,
) -> Result<bool, BridgeError>
pub async fn handle_kickoff<'a>( &'a self, dbtx: DatabaseTransaction<'a, '_>, kickoff_witness: Witness, deposit_data: DepositData, kickoff_data: KickoffData, challenged_before: bool, ) -> Result<bool, BridgeError>
Checks if the kickoff is malicious and sends the appropriate txs if it is. Returns true if the kickoff is malicious.
Trait Implementations§
Source§impl<C> BlockHandler for Verifier<C>where
C: CitreaClientT,
impl<C> BlockHandler for Verifier<C>where
C: CitreaClientT,
Source§fn handle_new_block<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
dbtx: DatabaseTransaction<'life1, 'life2>,
block_id: u32,
block: Block,
height: u32,
) -> Pin<Box<dyn Future<Output = Result<(), BridgeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_new_block<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
dbtx: DatabaseTransaction<'life1, 'life2>,
block_id: u32,
block: Block,
height: u32,
) -> Pin<Box<dyn Future<Output = Result<(), BridgeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl<C> NamedEntity for Verifier<C>where
C: CitreaClientT,
impl<C> NamedEntity for Verifier<C>where
C: CitreaClientT,
Source§const ENTITY_NAME: &'static str = "verifier"
const ENTITY_NAME: &'static str = "verifier"
Auto Trait Implementations§
impl<C> Freeze for Verifier<C>where
C: Freeze,
impl<C> !RefUnwindSafe for Verifier<C>
impl<C> Send for Verifier<C>
impl<C> Sync for Verifier<C>
impl<C> Unpin for Verifier<C>where
C: Unpin,
impl<C> !UnwindSafe for Verifier<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
fn exact_into(self) -> U
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, U> RoundingInto<U> for Twhere
U: RoundingFrom<T>,
impl<T, U> RoundingInto<U> for Twhere
U: RoundingFrom<T>,
fn rounding_into(self, rm: RoundingMode) -> (U, Ordering)
§impl<T, U> SaturatingInto<U> for Twhere
U: SaturatingFrom<T>,
impl<T, U> SaturatingInto<U> for Twhere
U: SaturatingFrom<T>,
fn saturating_into(self) -> U
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.