Skip to content

Commit

Permalink
chore: Set maturity time of dummy contract to the future
Browse files Browse the repository at this point in the history
The maturity time was hard coded to Feb 3rd 2024 which has expired now and was breaking our ln-dlc-node tests.

This change dynamically calculates a maturity time 7 days in the future.
  • Loading branch information
holzeis committed Feb 3, 2024
1 parent 97799db commit 2214ad2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/ln-dlc-node/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use std::string::ToString;
use std::sync::Arc;
use std::sync::Once;
use std::time::Duration;
use time::OffsetDateTime;
use tokio::sync::watch;
use tokio::task::block_in_place;

Expand Down Expand Up @@ -449,6 +450,9 @@ fn dummy_contract_input(
let n_cets = 100;
let rounding_mod = total_collateral / (n_cets + 1);

let maturity_time = OffsetDateTime::now_utc() + time::Duration::days(7);
let maturity_time = maturity_time.unix_timestamp() as u64;

ContractInput {
offer_collateral,
accept_collateral,
Expand Down Expand Up @@ -527,7 +531,7 @@ fn dummy_contract_input(
}),
oracles: OracleInput {
public_keys: vec![oracle_pk],
event_id: "btcusd1706899460".to_string(),
event_id: format!("btcusd{maturity_time}"),
threshold: 1,
},
}],
Expand Down

0 comments on commit 2214ad2

Please sign in to comment.