Skip to content

Commit 88150bb

Browse files
TheBlueMattjoostjager
authored andcommitted
try to test
1 parent 8501acf commit 88150bb

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

lightning/src/ln/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,8 @@ mod offers_tests;
9999
#[cfg(test)]
100100
#[allow(unused_mut)]
101101
mod dual_funding_tests;
102+
#[cfg(all(not(taproot), test))]
103+
#[allow(unused_mut)]
104+
mod upgrade_downgrade_tests;
102105

103106
pub use self::peer_channel_encryptor::LN_MAX_MSG_LEN;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// This file is Copyright its original authors, visible in version control
2+
// history.
3+
//
4+
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
5+
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
7+
// You may not use this file except in accordance with one or both of these
8+
// licenses.
9+
10+
//! Tests which test upgrading from previous versions of LDK or downgrading to previous versions of
11+
//! LDK.
12+
13+
use crate::ln::functional_test_utils::*;
14+
use crate::ln::msgs::ChannelMessageHandler;
15+
use crate::types::payment::PaymentPreimage;
16+
use crate::util::ser::Writeable;
17+
18+
#[test]
19+
fn simple_upgrade() {
20+
let chanmon_cfgs = create_chanmon_cfgs(2);
21+
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
22+
23+
let (persister, chain_monitor);
24+
let nodes_0_deserialized;
25+
26+
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
27+
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
28+
29+
let chan_id = create_announced_chan_between_nodes(&nodes, 0, 1).2;
30+
31+
let payment_preimage = route_payment(&nodes[0], &[&nodes[1]], 1_000_000);
32+
let preimage = PaymentPreimage(payment_preimage.0.0);
33+
34+
nodes[0].node.peer_disconnected(nodes[1].node.get_our_node_id());
35+
nodes[1].node.peer_disconnected(nodes[0].node.get_our_node_id());
36+
37+
let node_a = nodes[0].node.encode();
38+
let mon_a = get_monitor!(nodes[0], chan_id).encode();
39+
40+
reload_node!(nodes[0], test_default_channel_config(), &node_a, &[&mon_a], persister, chain_monitor, nodes_0_deserialized);
41+
42+
reconnect_nodes(ReconnectArgs::new(&nodes[0], &nodes[1]));
43+
44+
claim_payment(&nodes[0], &[&nodes[1]], preimage);
45+
}

0 commit comments

Comments
 (0)