pub trait TestFvk: Clone {
type Nullifier: Copy;
type OutgoingViewingKey;
// Required methods
fn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey;
fn ovk_bytes(&self, scope: Scope) -> [u8; 32];
fn add_spend<R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
nf: Self::Nullifier,
rng: &mut R,
);
fn add_output<P: Parameters, R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
params: &P,
height: BlockHeight,
sender_ovk: Option<&Self::OutgoingViewingKey>,
recipient_address_type: AddressType,
value: Zatoshis,
initial_sapling_tree_size: u32,
rng: &mut R,
) -> Self::Nullifier;
fn add_logical_action<P: Parameters, R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
params: &P,
height: BlockHeight,
nf_to_reveal_in_spend: Self::Nullifier,
sender_ovk: Option<&Self::OutgoingViewingKey>,
recipient_address_type: AddressType,
value: Zatoshis,
initial_sapling_tree_size: u32,
rng: &mut R,
) -> Self::Nullifier;
}test-dependencies only.Expand description
Trait used by tests that require a full viewing key.
Required Associated Types§
Sourcetype Nullifier: Copy
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).
Sourcetype OutgoingViewingKey
type OutgoingViewingKey
The type of outgoing viewing key corresponding to this full viewing key;
Required Methods§
Sourcefn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey
fn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey
Returns the Self::OutgoingViewingKey corresponding to this full viewing key, for the
given scope.
Sourcefn ovk_bytes(&self, scope: Scope) -> [u8; 32]
fn ovk_bytes(&self, scope: Scope) -> [u8; 32]
Returns the bytes of the Self::OutgoingViewingKey corresponding to this full viewing
key, for the given scope.
Sourcefn add_spend<R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
nf: Self::Nullifier,
rng: &mut R,
)
fn add_spend<R: Rng + 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.
Sourcefn add_output<P: Parameters, R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
params: &P,
height: BlockHeight,
sender_ovk: Option<&Self::OutgoingViewingKey>,
recipient_address_type: AddressType,
value: Zatoshis,
initial_sapling_tree_size: u32,
rng: &mut R,
) -> Self::Nullifier
fn add_output<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier
Adds a single output to the given CompactTx, where the output will be discovered when
scanning with an incoming viewing key corresponding to this FVK. Its outputs will also be
discoverable when scanning with the provided OVK, if any.
recipient_address_type allows configuring what shielded address to produce from this FVK
as the recipient of the newly created output.
Returns the nullifier of the newly created note, so that tests can readily have it on hand for the purpose of spending that note.
Sourcefn add_logical_action<P: Parameters, R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
params: &P,
height: BlockHeight,
nf_to_reveal_in_spend: Self::Nullifier,
sender_ovk: Option<&Self::OutgoingViewingKey>,
recipient_address_type: AddressType,
value: Zatoshis,
initial_sapling_tree_size: u32,
rng: &mut R,
) -> Self::Nullifier
fn add_logical_action<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, nf_to_reveal_in_spend: Self::Nullifier, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier
Adds both a spend and an output to the given CompactTx, where the output will be
discovered when scanning with the incoming viewing key corresponding to this FVK. Its
outputs will also be discoverable when scanning with the provided OVK, if any.
- 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.
recipient_address_type allows configuring what shielded address to produce from this FVK as the
recipient of the newly created output.
Returns the nullifier full the newly created note which will need to be revealed when that note is later spent.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl TestFvk for FullViewingKey
Available on crate feature orchard only.
impl TestFvk for FullViewingKey
orchard only.type Nullifier = Nullifier
type OutgoingViewingKey = OutgoingViewingKey
fn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey
fn ovk_bytes(&self, scope: Scope) -> [u8; 32]
fn add_spend<R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, nullifier_to_reveal: Self::Nullifier, rng: &mut R, )
fn add_output<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, _: &P, _: BlockHeight, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, _: u32, rng: &mut R, ) -> Self::Nullifier
fn add_logical_action<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, _: &P, _: BlockHeight, nf_to_reveal_in_spend: Self::Nullifier, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, _: u32, rng: &mut R, ) -> Self::Nullifier
Source§impl<A: TestFvk> TestFvk for &A
impl<A: TestFvk> TestFvk for &A
type Nullifier = <A as TestFvk>::Nullifier
type OutgoingViewingKey = <A as TestFvk>::OutgoingViewingKey
fn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey
fn ovk_bytes(&self, scope: Scope) -> [u8; 32]
fn add_spend<R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, nf: Self::Nullifier, rng: &mut R, )
fn add_output<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier
fn add_logical_action<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, nf_to_reveal_in_spend: Self::Nullifier, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier
Implementors§
Source§impl TestFvk for IronwoodFvk
Available on crate feature orchard only.
impl TestFvk for IronwoodFvk
orchard only.