Trait TestFvk

Source
pub trait TestFvk: Clone {
    type Nullifier: Copy;

    // Required methods
    fn sapling_ovk(&self) -> Option<OutgoingViewingKey>;
    fn orchard_ovk(&self, scope: Scope) -> Option<OutgoingViewingKey>;
    fn add_spend<R: RngCore + CryptoRng>(
        &self,
        ctx: &mut CompactTx,
        nf: Self::Nullifier,
        rng: &mut R,
    );
    fn add_output<P: Parameters, R: RngCore + CryptoRng>(
        &self,
        ctx: &mut CompactTx,
        params: &P,
        height: BlockHeight,
        req: AddressType,
        value: Zatoshis,
        initial_sapling_tree_size: u32,
        rng: &mut R,
    ) -> Self::Nullifier;
    fn add_logical_action<P: Parameters, R: RngCore + CryptoRng>(
        &self,
        ctx: &mut CompactTx,
        params: &P,
        height: BlockHeight,
        nf: Self::Nullifier,
        req: AddressType,
        value: Zatoshis,
        initial_sapling_tree_size: u32,
        rng: &mut R,
    ) -> Self::Nullifier;
}
Available on crate feature test-dependencies only.
Expand description

Trait used by tests that require a full viewing key.

Required Associated Types§

Source

type Nullifier: Copy

The type of nullifier corresponding to the kind of note that this full viewing key can detect (and that its corresponding spending key can spend).

Required Methods§

Source

fn sapling_ovk(&self) -> Option<OutgoingViewingKey>

Returns the Sapling outgoing viewing key corresponding to this full viewing key, if any.

Source

fn orchard_ovk(&self, scope: Scope) -> Option<OutgoingViewingKey>

Available on crate feature orchard only.

Returns the Orchard outgoing viewing key corresponding to this full viewing key, if any.

Source

fn add_spend<R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, nf: Self::Nullifier, rng: &mut R, )

Adds a single spend to the given CompactTx of a note previously received by this full viewing key.

Source

fn add_output<P: Parameters, R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, req: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier

Adds a single output to the given CompactTx that will be received by this full viewing key.

req allows configuring how the full viewing key will detect the output.

Source

fn add_logical_action<P: Parameters, R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, nf: Self::Nullifier, req: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier

Adds both a spend and an output to the given CompactTx.

  • If this is a Sapling full viewing key, the transaction will gain both a Spend and an Output.
  • If this is an Orchard full viewing key, the transaction will gain an Action.

req allows configuring how the full viewing key will detect the output.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TestFvk for FullViewingKey

Available on crate feature orchard only.
Source§

type Nullifier = Nullifier

Source§

fn sapling_ovk(&self) -> Option<OutgoingViewingKey>

Source§

fn orchard_ovk(&self, scope: Scope) -> Option<OutgoingViewingKey>

Source§

fn add_spend<R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, revealed_spent_note_nullifier: Self::Nullifier, rng: &mut R, )

Source§

fn add_output<P: Parameters, R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, _: &P, _: BlockHeight, req: AddressType, value: Zatoshis, _: u32, rng: &mut R, ) -> Self::Nullifier

Source§

fn add_logical_action<P: Parameters, R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, _: &P, _: BlockHeight, revealed_spent_note_nullifier: Self::Nullifier, address_type: AddressType, value: Zatoshis, _: u32, rng: &mut R, ) -> Self::Nullifier

Source§

impl<A: TestFvk> TestFvk for &A

Source§

type Nullifier = <A as TestFvk>::Nullifier

Source§

fn sapling_ovk(&self) -> Option<OutgoingViewingKey>

Source§

fn orchard_ovk(&self, scope: Scope) -> Option<OutgoingViewingKey>

Available on crate feature orchard only.
Source§

fn add_spend<R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, nf: Self::Nullifier, rng: &mut R, )

Source§

fn add_output<P: Parameters, R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, req: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier

Source§

fn add_logical_action<P: Parameters, R: RngCore + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, nf: Self::Nullifier, req: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier

Implementors§