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
use ln::channel::{Channel,Sign,InboundHTLCOutput,OutboundHTLCOutput,InboundHTLCState,OutboundHTLCState,HTLCOutputInCommitment,HTLCCandidate,HTLCInitiator,TxCreationKeys};
4701
4761
use ln::channel::MAX_FUNDING_SATOSHIS;
4702
4762
use ln::features::InitFeatures;
4703
-
use ln::msgs::{OptionalField,DataLossProtect,DecodeError};
4763
+
use ln::msgs::{ChannelUpdate,DataLossProtect,DecodeError,OptionalField,UnsignedChannelUpdate};
4704
4764
use ln::chan_utils;
4705
4765
use ln::chan_utils::{ChannelPublicKeys,HolderCommitmentTransaction,CounterpartyChannelTransactionParameters,HTLC_SUCCESS_TX_WEIGHT,HTLC_TIMEOUT_TX_WEIGHT};
4706
4766
use chain::chaininterface::{FeeEstimator,ConfirmationTarget};
@@ -4711,6 +4771,7 @@ mod tests {
4711
4771
use util::test_utils;
4712
4772
use util::logger::Logger;
4713
4773
use bitcoin::secp256k1::{Secp256k1,Message,Signature,All};
4774
+
use bitcoin::secp256k1::ffi::SignatureasFFISignature;
4714
4775
use bitcoin::secp256k1::key::{SecretKey,PublicKey};
4715
4776
use bitcoin::hashes::sha256::HashasSha256;
4716
4777
use bitcoin::hashes::Hash;
@@ -4967,6 +5028,54 @@ mod tests {
4967
5028
}
4968
5029
}
4969
5030
5031
+
#[test]
5032
+
fnchannel_update(){
5033
+
let feeest = TestFeeEstimator{fee_est:15000};
5034
+
let secp_ctx = Secp256k1::new();
5035
+
let seed = [42;32];
5036
+
let network = Network::Testnet;
5037
+
let chain_hash = genesis_block(network).header.block_hash();
5038
+
let keys_provider = test_utils::TestKeysInterface::new(&seed, network);
5039
+
5040
+
// Create a channel.
5041
+
let node_b_node_id = PublicKey::from_secret_key(&secp_ctx,&SecretKey::from_slice(&[42;32]).unwrap());
Copy file name to clipboardExpand all lines: lightning/src/ln/channelmanager.rs
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,9 @@ use chain::Watch;
39
39
use chain::chaininterface::{BroadcasterInterface,FeeEstimator};
40
40
use chain::channelmonitor::{ChannelMonitor,ChannelMonitorUpdate,ChannelMonitorUpdateStep,ChannelMonitorUpdateErr,HTLC_FAIL_BACK_BUFFER,CLTV_CLAIM_BUFFER,LATENCY_GRACE_PERIOD_BLOCKS,ANTI_REORG_DELAY,MonitorEvent,CLOSED_CHANNEL_UPDATE_ID};
41
41
use chain::transaction::{OutPoint,TransactionData};
42
+
// Since this struct is returned in `list_channels` methods, expose it here in case users want to
43
+
// construct one themselves.
44
+
pubuse ln::channel::CounterpartyForwardingInfo;
42
45
use ln::channel::{Channel,ChannelError};
43
46
use ln::features::{InitFeatures,NodeFeatures};
44
47
use routing::router::{Route,RouteHop};
@@ -574,6 +577,10 @@ pub struct ChannelDetails {
574
577
/// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
575
578
/// the peer is connected, and (c) no monitor update failure is pending resolution.
576
579
pubis_live:bool,
580
+
581
+
/// Information on the fees and requirements that the counterparty requires when forwarding
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[2],None,Some(&our_chans.iter().collect::<Vec<_>>()),&Vec::new(),100,42,Arc::clone(&logger)).unwrap();
1795
1797
assert_eq!(route.paths[0].len(),2);
@@ -1837,6 +1839,7 @@ mod tests {
1837
1839
outbound_capacity_msat:250_000_000,
1838
1840
inbound_capacity_msat:0,
1839
1841
is_live:true,
1842
+
counterparty_forwarding_info:None,
1840
1843
}];
1841
1844
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[2],None,Some(&our_chans.iter().collect::<Vec<_>>()),&Vec::new(),100,42,Arc::clone(&logger)).unwrap();
1842
1845
assert_eq!(route.paths[0].len(),2);
@@ -1901,6 +1904,7 @@ mod tests {
1901
1904
outbound_capacity_msat:250_000_000,
1902
1905
inbound_capacity_msat:0,
1903
1906
is_live:true,
1907
+
counterparty_forwarding_info:None,
1904
1908
}];
1905
1909
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[2],None,Some(&our_chans.iter().collect::<Vec<_>>()),&Vec::new(),100,42,Arc::clone(&logger)).unwrap();
1906
1910
assert_eq!(route.paths[0].len(),2);
@@ -2037,6 +2041,7 @@ mod tests {
2037
2041
outbound_capacity_msat:250_000_000,
2038
2042
inbound_capacity_msat:0,
2039
2043
is_live:true,
2044
+
counterparty_forwarding_info:None,
2040
2045
}];
2041
2046
letmut last_hops = last_hops(&nodes);
2042
2047
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[6],None,Some(&our_chans.iter().collect::<Vec<_>>()),&last_hops.iter().collect::<Vec<_>>(),100,42,Arc::clone(&logger)).unwrap();
@@ -2165,6 +2170,7 @@ mod tests {
2165
2170
outbound_capacity_msat:100000,
2166
2171
inbound_capacity_msat:100000,
2167
2172
is_live:true,
2173
+
counterparty_forwarding_info:None,
2168
2174
}];
2169
2175
let route = get_route(&source_node_id,&NetworkGraph::new(genesis_block(Network::Testnet).header.block_hash()),&target_node_id,None,Some(&our_chans.iter().collect::<Vec<_>>()),&last_hops.iter().collect::<Vec<_>>(),100,42,Arc::new(test_utils::TestLogger::new())).unwrap();
0 commit comments