pub type RedeemNode<J> = Node<Redeem<J>>;
Aliased Type§
pub struct RedeemNode<J> { /* private fields */ }
Implementations§
Source§impl<J: Jet> RedeemNode<J>
impl<J: Jet> RedeemNode<J>
Sourcepub fn arrow(&self) -> &FinalArrow
pub fn arrow(&self) -> &FinalArrow
Accessor for the node’s type arrow
Sourcepub fn bounds(&self) -> NodeBounds
pub fn bounds(&self) -> NodeBounds
Accessor for the node’s bit machine bounds
Sourcepub fn unfinalize(&self) -> Result<Arc<CommitNode<J>>, Error>
pub fn unfinalize(&self) -> Result<Arc<CommitNode<J>>, Error>
Convert a RedeemNode
back to a CommitNode
by forgetting witnesses
and cached data.
Sourcepub fn to_construct_node(&self) -> Arc<ConstructNode<J>> ⓘ
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.
Sourcepub fn prune(
&self,
env: &J::Environment,
) -> Result<Arc<RedeemNode<J>>, ExecutionError>
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:
- Run the redeem program on the Bit Machine.
- Mark all (un)used case branches using the IHR of the case node.
- 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.
Sourcepub fn decode<I1, I2>(
program: BitIter<I1>,
witness: BitIter<I2>,
) -> Result<Arc<Self>, DecodeError>
pub fn decode<I1, I2>( program: BitIter<I1>, witness: BitIter<I2>, ) -> Result<Arc<Self>, DecodeError>
Decode a Simplicity program from bits, including the witness data.