Type Alias RedeemNode

Source
pub type RedeemNode<J> = Node<Redeem<J>>;

Aliased Type§

pub struct RedeemNode<J> { /* private fields */ }

Implementations§

Source§

impl<J: Jet> RedeemNode<J>

Source

pub fn amr(&self) -> Amr

Accessor for the node’s AMR

Source

pub fn ihr(&self) -> Ihr

Accessor for the node’s IHR

Source

pub fn arrow(&self) -> &FinalArrow

Accessor for the node’s type arrow

Source

pub fn bounds(&self) -> NodeBounds

Accessor for the node’s bit machine bounds

Source

pub fn unfinalize(&self) -> Result<Arc<CommitNode<J>>, Error>

Convert a RedeemNode back to a CommitNode by forgetting witnesses and cached data.

Source

pub fn to_construct_node(&self) -> Arc<ConstructNode<J>>

Convert a RedeemNode back into a ConstructNode by loosening the finalized types, witness data and disconnected branches.

Source

pub fn prune( &self, env: &J::Environment, ) -> Result<Arc<RedeemNode<J>>, ExecutionError>

Prune the redeem program for the given transaction environment.

Pruning works as follows:

  1. Run the redeem program on the Bit Machine.
  2. Mark all (un)used case branches using the IHR of the case node.
  3. Rebuild the program and omit unused branches.

The pruning result depends on the witness data (which is already part of the redeem program) and on the transaction environment. These two inputs determine which case branches are used and which are not. Pruning must be done for each transaction environment separately, starting from the same original, unpruned program. Pruning is a lossy process, so pruning an already pruned program is not sound.

Pruning fails if the original, unpruned program fails to run on the Bit Machine (step 1). In this case, the witness data needs to be revised. The other pruning steps (2 & 3) never fail.

Source

pub fn decode<I1, I2>( program: BitIter<I1>, witness: BitIter<I2>, ) -> Result<Arc<Self>, DecodeError>
where I1: Iterator<Item = u8>, I2: Iterator<Item = u8>,

Decode a Simplicity program from bits, including the witness data.

Source

pub fn encode<W1, W2>( &self, prog: &mut BitWriter<W1>, witness: &mut BitWriter<W2>, ) -> Result<usize>
where W1: Write, W2: Write,

👎Deprecated since 0.5.0: use Self::encode_with_witness instead

Encode the program to bits.

Includes witness data. Returns the number of written bits.

Source

pub fn encode_to_vec(&self) -> (Vec<u8>, Vec<u8>)

👎Deprecated since 0.5.0: use Self::to_vec_with_witness instead

Encode the program and witness data to byte vectors.