mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Add a test for Router's should_request_full_sync
This commit is contained in:
parent
71021fc9d8
commit
72de9cc178
1 changed files with 14 additions and 1 deletions
|
@ -1051,7 +1051,7 @@ mod tests {
|
||||||
use ln::channelmanager;
|
use ln::channelmanager;
|
||||||
use ln::router::{Router,NodeInfo,NetworkMap,ChannelInfo,DirectionalChannelInfo,RouteHint};
|
use ln::router::{Router,NodeInfo,NetworkMap,ChannelInfo,DirectionalChannelInfo,RouteHint};
|
||||||
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
|
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
|
||||||
use ln::msgs::{LightningError, ErrorAction};
|
use ln::msgs::{ErrorAction, LightningError, RoutingMessageHandler};
|
||||||
use util::test_utils;
|
use util::test_utils;
|
||||||
use util::test_utils::TestVecWriter;
|
use util::test_utils::TestVecWriter;
|
||||||
use util::logger::Logger;
|
use util::logger::Logger;
|
||||||
|
@ -1845,4 +1845,17 @@ mod tests {
|
||||||
assert!(<NetworkMap>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap() == *network);
|
assert!(<NetworkMap>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap() == *network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn request_full_sync_finite_times() {
|
||||||
|
let (secp_ctx, _, router) = create_router();
|
||||||
|
let node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&hex::decode("0202020202020202020202020202020202020202020202020202020202020202").unwrap()[..]).unwrap());
|
||||||
|
|
||||||
|
assert!(router.should_request_full_sync(&node_id));
|
||||||
|
assert!(router.should_request_full_sync(&node_id));
|
||||||
|
assert!(router.should_request_full_sync(&node_id));
|
||||||
|
assert!(router.should_request_full_sync(&node_id));
|
||||||
|
assert!(router.should_request_full_sync(&node_id));
|
||||||
|
assert!(!router.should_request_full_sync(&node_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue