|
40 | 40 | //! Nodes without channels are disconnected and connected as needed to ensure that deterministic
|
41 | 41 | //! blinded paths are used.
|
42 | 42 |
|
| 43 | +use bitcoin::network::constants::Network; |
43 | 44 | use core::time::Duration;
|
44 | 45 | use crate::blinded_path::BlindedPath;
|
45 | 46 | use crate::events::{Event, MessageSendEventsProvider, PaymentPurpose};
|
@@ -667,6 +668,32 @@ fn fails_creating_refund_without_blinded_paths() {
|
667 | 668 | assert!(nodes[0].node.list_recent_payments().is_empty());
|
668 | 669 | }
|
669 | 670 |
|
| 671 | +/// Fails creating an invoice request when the offer contains an unsupported chain. |
| 672 | +#[test] |
| 673 | +fn fails_creating_invoice_request_for_unsupported_chain() { |
| 674 | + let chanmon_cfgs = create_chanmon_cfgs(2); |
| 675 | + let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); |
| 676 | + let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); |
| 677 | + let nodes = create_network(2, &node_cfgs, &node_chanmgrs); |
| 678 | + |
| 679 | + create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 10_000_000, 1_000_000_000); |
| 680 | + |
| 681 | + let alice = &nodes[0]; |
| 682 | + let bob = &nodes[1]; |
| 683 | + |
| 684 | + let offer = alice.node |
| 685 | + .create_offer_builder("coffee".to_string()).unwrap() |
| 686 | + .clear_chains() |
| 687 | + .chain(Network::Signet) |
| 688 | + .build().unwrap(); |
| 689 | + |
| 690 | + let payment_id = PaymentId([1; 32]); |
| 691 | + match bob.node.pay_for_offer(&offer, None, None, None, payment_id, Retry::Attempts(0), None) { |
| 692 | + Ok(_) => panic!("Expected error"), |
| 693 | + Err(e) => assert_eq!(e, Bolt12SemanticError::UnsupportedChain), |
| 694 | + } |
| 695 | +} |
| 696 | + |
670 | 697 | /// Fails creating an invoice request when a blinded reply path cannot be created without exposing
|
671 | 698 | /// the node's id.
|
672 | 699 | #[test]
|
|
0 commit comments