match event {
Event::PaymentPathFailed {
- payment_id, payment_hash, rejected_by_dest, path, short_channel_id, retry, ..
+ payment_id, payment_hash, payment_failed_permanently, path, short_channel_id, retry, ..
} => {
if let Some(short_channel_id) = short_channel_id {
let path = path.iter().collect::<Vec<_>>();
if payment_id.is_none() {
log_trace!(self.logger, "Payment {} has no id; not retrying", log_bytes!(payment_hash.0));
- } else if *rejected_by_dest {
+ } else if *payment_failed_permanently {
log_trace!(self.logger, "Payment {} rejected by destination; not retrying", log_bytes!(payment_hash.0));
self.payer.abandon_payment(payment_id.unwrap());
} else if retry.is_none() {
use utils::create_invoice_from_channelmanager_and_duration_since_epoch;
use bitcoin_hashes::sha256::Hash as Sha256;
use lightning::ln::PaymentPreimage;
- use lightning::ln::features::{ChannelFeatures, NodeFeatures, InitFeatures};
+ use lightning::ln::channelmanager;
+ use lightning::ln::features::{ChannelFeatures, NodeFeatures};
use lightning::ln::functional_test_utils::*;
use lightning::ln::msgs::{ChannelMessageHandler, ErrorAction, LightningError};
use lightning::routing::gossip::{EffectiveCapacity, NodeId};
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat / 2),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat / 2),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: true,
+ payment_failed_permanently: true,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path,
short_channel_id,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat / 2),
short_channel_id: None,
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
- create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
- create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
+ create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, channelmanager::provided_init_features(), channelmanager::provided_init_features());
+ create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, channelmanager::provided_init_features(), channelmanager::provided_init_features());
let chans = nodes[0].node.list_usable_channels();
let mut route = Route {
paths: vec![
vec![RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chans[0].short_channel_id.unwrap(),
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 10_000,
cltv_expiry_delta: 100,
}],
vec![RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chans[1].short_channel_id.unwrap(),
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 100_000_001, // Our default max-HTLC-value is 10% of the channel value, which this is one more than
cltv_expiry_delta: 100,
}],
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
- create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
- create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
+ create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, channelmanager::provided_init_features(), channelmanager::provided_init_features());
+ create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, channelmanager::provided_init_features(), channelmanager::provided_init_features());
let chans = nodes[0].node.list_usable_channels();
let mut route = Route {
paths: vec![
vec![RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chans[0].short_channel_id.unwrap(),
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 100_000_001, // Our default max-HTLC-value is 10% of the channel value, which this is one more than
cltv_expiry_delta: 100,
}],
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
- let chan_1_scid = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 10_000_000, 0, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
- let chan_2_scid = create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 10_000_000, 0, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
+ let chan_1_scid = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 10_000_000, 0, channelmanager::provided_init_features(), channelmanager::provided_init_features()).0.contents.short_channel_id;
+ let chan_2_scid = create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 10_000_000, 0, channelmanager::provided_init_features(), channelmanager::provided_init_features()).0.contents.short_channel_id;
let mut route = Route {
paths: vec![
vec![RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chan_1_scid,
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 0,
cltv_expiry_delta: 100,
}, RouteHop {
pubkey: nodes[2].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chan_2_scid,
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 100_000_000,
cltv_expiry_delta: 100,
}],
vec![RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chan_1_scid,
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 0,
cltv_expiry_delta: 100,
}, RouteHop {
pubkey: nodes[2].node.get_our_node_id(),
- node_features: NodeFeatures::known(),
+ node_features: channelmanager::provided_node_features(),
short_channel_id: chan_2_scid,
- channel_features: ChannelFeatures::known(),
+ channel_features: channelmanager::provided_channel_features(),
fee_msat: 100_000_000,
cltv_expiry_delta: 100,
}]
// treated this as "HTLC complete" and dropped the retry counter, causing us to retry again
// if the final HTLC failed.
expected_events.borrow_mut().push_back(&|ev: &Event| {
- if let Event::PaymentPathFailed { rejected_by_dest, all_paths_failed, .. } = ev {
- assert!(!rejected_by_dest);
+ if let Event::PaymentPathFailed { payment_failed_permanently, all_paths_failed, .. } = ev {
+ assert!(!payment_failed_permanently);
assert!(all_paths_failed);
} else { panic!("Unexpected event"); }
});
commitment_signed_dance!(nodes[0], nodes[1], &bs_fail_update.commitment_signed, false, true);
expected_events.borrow_mut().push_back(&|ev: &Event| {
- if let Event::PaymentPathFailed { rejected_by_dest, all_paths_failed, .. } = ev {
- assert!(!rejected_by_dest);
+ if let Event::PaymentPathFailed { payment_failed_permanently, all_paths_failed, .. } = ev {
+ assert!(!payment_failed_permanently);
assert!(all_paths_failed);
} else { panic!("Unexpected event"); }
});