Skip to content

Commit

Permalink
version check
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejka committed Oct 31, 2024
1 parent e34939a commit 566f9cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/consensus/src/validation/locktime.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ pub fn validate_relative_locktime(
let lock_time = value * 512;
let absolute_lock_time = *input.previous_output.median_time_past + lock_time;
if absolute_lock_time > median_time_past {
println!("{:?}", input.previous_output);
// println!("sequence: {}", *input.sequence);
// println!("txid: {}", input.previous_output.txid);
// println!("input: {:?}", input);
// println!("{}", value);
// println!("absolute_lock_time: {}", absolute_lock_time);
// println!("median_time_past: {}", median_time_past);
return Result::Err(
format!(
"Relative time-based lock time is not respected: current MTP: {}, outpoint MTP: {}, lock time: {} seconds",
Expand Down
2 changes: 1 addition & 1 deletion packages/consensus/src/validation/transaction.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn validate_transaction(
}
}

if !is_input_final(*input.sequence) {
if *tx.version >= 2 && !is_input_final(*input.sequence) {
inner_result = validate_relative_locktime(input, block_height, median_time_past);
if inner_result.is_err() {
break;
Expand Down

0 comments on commit 566f9cf

Please sign in to comment.