X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=c6302b9062d8525bf2d1b7b974e8f45415676ba8;hb=9e5800927a6bdc46e4119765f07d374732b43cc5;hp=91af4202d28be148a7e333673fbb486089e5a061;hpb=2087032e7a823f6c63a64dac951e0f4843bc4667;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 91af4202..c6302b90 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -22,7 +22,7 @@ use bitcoin::hash_types::{Txid, BlockHash}; use bitcoin::secp256k1::{SecretKey, PublicKey, Secp256k1, Signature}; -use std::time::{SystemTime, UNIX_EPOCH}; +use std::time::Duration; use std::sync::Mutex; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::{cmp, mem}; @@ -40,10 +40,10 @@ impl Writer for TestVecWriter { } pub struct TestFeeEstimator { - pub sat_per_kw: u64, + pub sat_per_kw: u32, } impl chaininterface::FeeEstimator for TestFeeEstimator { - fn get_est_sat_per_1000_weight(&self, _confirmation_target: ConfirmationTarget) -> u64 { + fn get_est_sat_per_1000_weight(&self, _confirmation_target: ConfirmationTarget) -> u32 { self.sat_per_kw } } @@ -344,7 +344,7 @@ impl keysinterface::KeysInterface for TestKeysInterface { impl TestKeysInterface { pub fn new(seed: &[u8; 32], network: Network) -> Self { - let now = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time went backwards"); + let now = Duration::from_secs(genesis_block(network).header.time as u64); Self { backing: keysinterface::KeysManager::new(seed, network, now.as_secs(), now.subsec_nanos()), override_session_priv: Mutex::new(None),