Skip to content

Commit 3d76d02

Browse files
committed
Pass correct fields to evaluate_[after|older]
We are passing the wrong fields into `evaluate_after` and `evaluate_older`. 'after' is associated with _absolute_ timelocks, this means 'height'. 'older' is associated with _relative_ timelocks, this means 'height'.
1 parent b9c9d5b commit 3d76d02

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/interpreter/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,15 @@ where
605605
Terminal::After(ref n) => {
606606
debug_assert_eq!(node_state.n_evaluated, 0);
607607
debug_assert_eq!(node_state.n_satisfied, 0);
608-
let res = self.stack.evaluate_after(n, self.age);
608+
let res = self.stack.evaluate_after(n, self.height);
609609
if res.is_some() {
610610
return res;
611611
}
612612
}
613613
Terminal::Older(ref n) => {
614614
debug_assert_eq!(node_state.n_evaluated, 0);
615615
debug_assert_eq!(node_state.n_satisfied, 0);
616-
let res = self.stack.evaluate_older(n, self.height);
616+
let res = self.stack.evaluate_older(n, self.age);
617617
if res.is_some() {
618618
return res;
619619
}

src/interpreter/stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ impl<'txin> Stack<'txin> {
232232
pub(super) fn evaluate_after(
233233
&mut self,
234234
n: &u32,
235-
age: u32,
235+
lock_time: u32,
236236
) -> Option<Result<SatisfiedConstraint, Error>> {
237-
if age >= *n {
237+
if lock_time >= *n {
238238
self.push(Element::Satisfied);
239239
Some(Ok(SatisfiedConstraint::AbsoluteTimelock { time: *n }))
240240
} else {
@@ -251,9 +251,9 @@ impl<'txin> Stack<'txin> {
251251
pub(super) fn evaluate_older(
252252
&mut self,
253253
n: &u32,
254-
height: u32,
254+
age: u32,
255255
) -> Option<Result<SatisfiedConstraint, Error>> {
256-
if height >= *n {
256+
if age >= *n {
257257
self.push(Element::Satisfied);
258258
Some(Ok(SatisfiedConstraint::RelativeTimelock { time: *n }))
259259
} else {

0 commit comments

Comments
 (0)