cfg-gate async signing logic
[rust-lightning] / lightning / src / ln / priv_short_conf_tests.rs
index eb25ee961e1dd7e0db3f17de8d1c4a7197be09fc..85e757204fe5205c7534f614a71c1085535e25c5 100644 (file)
@@ -30,7 +30,7 @@ use core::default::Default;
 
 use crate::ln::functional_test_utils::*;
 
-use bitcoin::blockdata::constants::genesis_block;
+use bitcoin::blockdata::constants::ChainHash;
 use bitcoin::network::constants::Network;
 
 #[test]
@@ -67,7 +67,7 @@ fn test_priv_forwarding_rejection() {
        }]);
        let last_hops = vec![route_hint];
        let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), TEST_FINAL_CLTV)
-               .with_bolt11_features(nodes[2].node.invoice_features()).unwrap()
+               .with_bolt11_features(nodes[2].node.bolt11_invoice_features()).unwrap()
                .with_route_hints(last_hops).unwrap();
        let (route, our_payment_hash, our_payment_preimage, our_payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 10_000);
 
@@ -246,7 +246,7 @@ fn test_routed_scid_alias() {
                htlc_minimum_msat: None,
        }])];
        let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
-               .with_bolt11_features(nodes[2].node.invoice_features()).unwrap()
+               .with_bolt11_features(nodes[2].node.bolt11_invoice_features()).unwrap()
                .with_route_hints(hop_hints).unwrap();
        let (route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 100_000);
        assert_eq!(route.paths[0].hops[1].short_channel_id, last_hop[0].inbound_scid_alias.unwrap());
@@ -290,7 +290,7 @@ fn test_scid_privacy_on_pub_channel() {
        let mut scid_privacy_cfg = test_default_channel_config();
        scid_privacy_cfg.channel_handshake_config.announced_channel = true;
        scid_privacy_cfg.channel_handshake_config.negotiate_scid_privacy = true;
-       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(scid_privacy_cfg)).unwrap();
+       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, Some(scid_privacy_cfg)).unwrap();
        let mut open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
 
        assert!(!open_channel.channel_type.as_ref().unwrap().supports_scid_privacy()); // we ignore `negotiate_scid_privacy` on pub channels
@@ -314,7 +314,7 @@ fn test_scid_privacy_negotiation() {
        let mut scid_privacy_cfg = test_default_channel_config();
        scid_privacy_cfg.channel_handshake_config.announced_channel = false;
        scid_privacy_cfg.channel_handshake_config.negotiate_scid_privacy = true;
-       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(scid_privacy_cfg)).unwrap();
+       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, Some(scid_privacy_cfg)).unwrap();
 
        let init_open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
        assert!(init_open_channel.channel_type.as_ref().unwrap().supports_scid_privacy());
@@ -360,7 +360,7 @@ fn test_inbound_scid_privacy() {
        let mut no_announce_cfg = test_default_channel_config();
        no_announce_cfg.channel_handshake_config.announced_channel = false;
        no_announce_cfg.channel_handshake_config.negotiate_scid_privacy = true;
-       nodes[1].node.create_channel(nodes[2].node.get_our_node_id(), 100_000, 10_000, 42, Some(no_announce_cfg)).unwrap();
+       nodes[1].node.create_channel(nodes[2].node.get_our_node_id(), 100_000, 10_000, 42, None, Some(no_announce_cfg)).unwrap();
        let mut open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[2].node.get_our_node_id());
 
        assert!(open_channel.channel_type.as_ref().unwrap().requires_scid_privacy());
@@ -412,7 +412,7 @@ fn test_inbound_scid_privacy() {
                htlc_minimum_msat: None,
        }])];
        let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
-               .with_bolt11_features(nodes[2].node.invoice_features()).unwrap()
+               .with_bolt11_features(nodes[2].node.bolt11_invoice_features()).unwrap()
                .with_route_hints(hop_hints.clone()).unwrap();
        let (route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 100_000);
        assert_eq!(route.paths[0].hops[1].short_channel_id, last_hop[0].inbound_scid_alias.unwrap());
@@ -428,7 +428,7 @@ fn test_inbound_scid_privacy() {
        hop_hints[0].0[0].short_channel_id = last_hop[0].short_channel_id.unwrap();
 
        let payment_params_2 = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
-               .with_bolt11_features(nodes[2].node.invoice_features()).unwrap()
+               .with_bolt11_features(nodes[2].node.bolt11_invoice_features()).unwrap()
                .with_route_hints(hop_hints).unwrap();
        let (route_2, payment_hash_2, _, payment_secret_2) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params_2, 100_000);
        assert_eq!(route_2.paths[0].hops[1].short_channel_id, last_hop[0].short_channel_id.unwrap());
@@ -480,7 +480,7 @@ fn test_scid_alias_returned() {
                htlc_minimum_msat: None,
        }])];
        let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
-               .with_bolt11_features(nodes[2].node.invoice_features()).unwrap()
+               .with_bolt11_features(nodes[2].node.bolt11_invoice_features()).unwrap()
                .with_route_hints(hop_hints).unwrap();
        let (mut route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 10_000);
        assert_eq!(route.paths[0].hops[1].short_channel_id, nodes[2].node.list_usable_channels()[0].inbound_scid_alias.unwrap());
@@ -505,7 +505,7 @@ fn test_scid_alias_returned() {
 
        // Build the expected channel update
        let contents = msgs::UnsignedChannelUpdate {
-               chain_hash: genesis_block(Network::Testnet).header.block_hash(),
+               chain_hash: ChainHash::using_genesis_block(Network::Testnet),
                short_channel_id: last_hop[0].inbound_scid_alias.unwrap(),
                timestamp: 21,
                flags: 1,
@@ -591,7 +591,7 @@ fn test_0conf_channel_with_async_monitor() {
        create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 1_000_000, 0);
 
        chan_config.channel_handshake_config.announced_channel = false;
-       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(chan_config)).unwrap();
+       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, Some(chan_config)).unwrap();
        let open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
 
        nodes[1].node.handle_open_channel(&nodes[0].node.get_our_node_id(), &open_channel);
@@ -882,7 +882,7 @@ fn test_zero_conf_accept_reject() {
        let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
        let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
-       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None).unwrap();
+       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, None).unwrap();
        let mut open_channel_msg = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
 
        open_channel_msg.channel_type = Some(channel_type_features.clone());
@@ -909,7 +909,7 @@ fn test_zero_conf_accept_reject() {
 
        // 2.1 First try the non-0conf method to manually accept
        nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42,
-               Some(manually_accept_conf)).unwrap();
+               None, Some(manually_accept_conf)).unwrap();
        let mut open_channel_msg = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel,
                nodes[1].node.get_our_node_id());
 
@@ -941,7 +941,7 @@ fn test_zero_conf_accept_reject() {
 
        // 2.2 Try again with the 0conf method to manually accept
        nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42,
-               Some(manually_accept_conf)).unwrap();
+               None, Some(manually_accept_conf)).unwrap();
        let mut open_channel_msg = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel,
                nodes[1].node.get_our_node_id());
 
@@ -982,7 +982,7 @@ fn test_connect_before_funding() {
        let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(manually_accept_conf)]);
        let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
-       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100_000, 10_001, 42, None).unwrap();
+       nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100_000, 10_001, 42, None, None).unwrap();
        let open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
 
        nodes[1].node.handle_open_channel(&nodes[0].node.get_our_node_id(), &open_channel);