You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TestLogger now has two additional methods
1. `assert_log_contains` which checks the logged messsage
has entry which includes the specified string as a substring.
2. `aasert_log_regex` mostly same with above but it is more flexible
that caller specifies regex which has to be satisfied instead of
just a substring.
insane_open_helper(format!("funding must be smaller than {}. It was {}",MAX_FUNDING_SATOSHIS,MAX_FUNDING_SATOSHIS).as_str(), |mut msg| { msg.funding_satoshis = MAX_FUNDING_SATOSHIS; msg });
insane_open_helper("Bogus; channel reserve is less than dust limit", |mut msg| { msg.dust_limit_satoshis = msg.channel_reserve_satoshis + 1; msg });
103
+
insane_open_helper(r"Bogus; channel reserve\(\d+\) is less than dust limit \(\d+\)", |mut msg| { msg.dust_limit_satoshis = msg.channel_reserve_satoshis + 1; msg });
103
104
104
-
insane_open_helper("Minimum htlc value is full channel value", |mut msg| { msg.htlc_minimum_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis)*1000; msg });
105
+
insane_open_helper(r"Minimum htlc value \(\d+\) is full channel value \(\d+\)", |mut msg| { msg.htlc_minimum_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis)*1000; msg });
105
106
106
107
insane_open_helper("They wanted our payments to be delayed by a needlessly long period", |mut msg| { msg.to_self_delay = MAX_LOCAL_BREAKDOWN_TIMEOUT + 1; msg });
107
108
108
109
insane_open_helper("0 max_accpted_htlcs makes for a useless channel", |mut msg| { msg.max_accepted_htlcs = 0; msg });
let events = nodes[0].node.get_and_clear_pending_msg_events();
1272
1273
assert_eq!(events.len(),0);
1273
-
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us over the max HTLC value in flight our peer will accept".to_string(),1);
1274
+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us over the max HTLC value in flight our peer will accept".to_string(),1);
1274
1275
1275
1276
//TODO: Test that routes work again here as we've been notified that the channel is full
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us under local channel reserve value".to_string(),1);
1553
+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us under local channel reserve value".to_string(),1);
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us over the max HTLC value in flight our peer will accept".to_string(),1);
1936
+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us over the max HTLC value in flight our peer will accept".to_string(),1);
1936
1937
}
1937
1938
1938
1939
// channel reserve is bigger than their_max_htlc_value_in_flight_msat so loop to deplete
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us under local channel reserve value".to_string(),2);
2026
+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us under local channel reserve value".to_string(),2);
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us under local channel reserve value".to_string(),3);
2118
+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us under local channel reserve value".to_string(),3);
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
6515
6516
let route = get_route(&nodes[0].node.get_our_node_id(),&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[1].node.get_our_node_id(),None,&[],100000,TEST_FINAL_CLTV,&logger).unwrap();
let route = get_route(&nodes[0].node.get_our_node_id(),&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[1].node.get_our_node_id(),None,&[], max_in_flight+1,TEST_FINAL_CLTV,&logger).unwrap();
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us over the max HTLC value in flight our peer will accept".to_string(),1);
6545
+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(),"Cannot send value that would put us over the max HTLC value in flight our peer will accept".to_string(),1);
assert_eq!(check_closed_broadcast!(nodes[2],true).unwrap().data,"Got shutdown request with a scriptpubkey which did not match their previous scriptpubkey");
7332
+
assert!(regex::Regex::new(r"Got shutdown request with a scriptpubkey \([A-Fa-f0-9]+\) which did not match their previous scriptpubkey.").unwrap().is_match(check_closed_broadcast!(nodes[2],true).unwrap().data.as_str()));
7332
7333
check_added_monitors!(nodes[2],1);
7333
7334
7334
7335
// We test that in case of peer committing upfront to a script, if it doesn't change at closing, we sign
APIError::APIMisuseError{ err } => {assert_eq!(err,"Configured with an unreasonable our_to_self_delay putting user funds at risks");},
7413
+
APIError::APIMisuseError{ err } => {assert!(regex::Regex::new(r"Configured with an unreasonable our_to_self_delay \(\d+\) putting user funds at risks").unwrap().is_match(err.as_str()));},
ChannelError::Close(err) => {assert_eq!(err,"Configured with an unreasonable our_to_self_delay putting user funds at risks");},
7424
+
ChannelError::Close(err) => {assert!(regex::Regex::new(r"Configured with an unreasonable our_to_self_delay \(\d+\) putting user funds at risks").unwrap().is_match(err.as_str()));},
assert_eq!(msg.data,"They wanted our payments to be delayed by a needlessly long period");
7438
+
assert!(regex::Regex::new(r"They wanted our payments to be delayed by a needlessly long period\. upper limit: \d+\. actual: \d+").unwrap().is_match(msg.data.as_str()));
ChannelError::Close(err) => {assert_eq!(err,"They wanted our payments to be delayed by a needlessly long period");},
7450
+
ChannelError::Close(err) => {assert!(regex::Regex::new(r"They wanted our payments to be delayed by a needlessly long period\. upper limit: \d+\. actual: \d+").unwrap().is_match(err.as_str()));},
0 commit comments