Skip to content

Commit

Permalink
Merge pull request #2327 from randomsleep/fix_is_bond
Browse files Browse the repository at this point in the history
fix: is_bond and is_unbond match credits.aleo
  • Loading branch information
howardwu authored Jan 30, 2024
2 parents bffa886 + 71df26e commit 76b76b5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ledger/block/src/transition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,22 @@ impl<N: Network> Transition<N> {
}

impl<N: Network> Transition<N> {
/// Returns `true` if this is a `bond` transition.
/// Returns `true` if this is a `bond_public` transition.
#[inline]
pub fn is_bond(&self) -> bool {
self.program_id.to_string() == "credits.aleo" && self.function_name.to_string() == "bond"
pub fn is_bond_public(&self) -> bool {
self.inputs.len() == 2
&& self.outputs.is_empty()
&& self.program_id.to_string() == "credits.aleo"
&& self.function_name.to_string() == "bond_public"
}

/// Returns `true` if this is an `unbond` transition.
/// Returns `true` if this is an `unbond_public` transition.
#[inline]
pub fn is_unbond(&self) -> bool {
self.program_id.to_string() == "credits.aleo" && self.function_name.to_string() == "unbond"
pub fn is_unbond_public(&self) -> bool {
self.inputs.len() == 2
&& self.outputs.is_empty()
&& self.program_id.to_string() == "credits.aleo"
&& self.function_name.to_string() == "unbond_public"
}

/// Returns `true` if this is a `fee_private` transition.
Expand Down

0 comments on commit 76b76b5

Please sign in to comment.