Skip to content

Commit 028c081

Browse files
committed
f expose
1 parent 0fbcfd4 commit 028c081

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ use crate::routing::gossip::{P2PGossipSync, NetworkGraph, NetworkUpdate};
2828
use crate::routing::router::{self, PaymentParameters, Route, RouteParameters};
2929
use crate::sign::{EntropySource, RandomBytes};
3030
use crate::util::config::{MaxDustHTLCExposure, UserConfig};
31-
#[cfg(any(test, feature = "_test_utils"))]
3231
use crate::util::logger::Logger;
3332
use crate::util::scid_utils;
3433
use crate::util::test_channel_signer::TestChannelSigner;
35-
#[cfg(any(test, feature = "_test_utils"))]
3634
use crate::util::test_channel_signer::SignerOp;
3735
use crate::util::test_utils;
3836
use crate::util::test_utils::{TestChainMonitor, TestScorer, TestKeysInterface};
@@ -515,8 +513,7 @@ impl<'a, 'b, 'c> Node<'a, 'b, 'c> {
515513
/// Toggles this node's signer to be available for the given signer operation.
516514
/// This is useful for testing behavior for restoring an async signer that previously
517515
/// could not return a signature immediately.
518-
#[cfg(any(test, feature = "_test_utils"))]
519-
pub fn enable_channel_signer_op(&self, peer_id: &PublicKey, chan_id: &ChannelId, signer_op: SignerOp) {
516+
pub fn enable_channel_signer_op(&self, peer_id: &PublicKey, chan_id: &ChannelId, signer_op: SignerOp) {
520517
self.set_channel_signer_ops(peer_id, chan_id, signer_op, true);
521518
}
522519

@@ -535,8 +532,7 @@ impl<'a, 'b, 'c> Node<'a, 'b, 'c> {
535532
/// will behave normally, returning `Ok`. When set to `false`, and the channel signer will
536533
/// act like an off-line remote signer, returning `Err`. This applies to the signer in all
537534
/// relevant places, i.e. the channel manager, chain monitor, and the keys manager.
538-
#[cfg(any(test, feature = "_test_utils"))]
539-
fn set_channel_signer_ops(&self, peer_id: &PublicKey, chan_id: &ChannelId, signer_op: SignerOp, available: bool) {
535+
fn set_channel_signer_ops(&self, peer_id: &PublicKey, chan_id: &ChannelId, signer_op: SignerOp, available: bool) {
540536
use crate::sign::ChannelSigner;
541537
log_debug!(self.logger, "Setting channel signer for {} as available={}", chan_id, available);
542538

@@ -1002,7 +998,6 @@ pub fn remove_first_msg_event_to_node(msg_node_id: &PublicKey, msg_events: &mut
1002998
}
1003999
}
10041000

1005-
#[cfg(any(test, feature = "_externalize_tests"))]
10061001
macro_rules! get_channel_ref {
10071002
($node: expr, $counterparty_node: expr, $per_peer_state_lock: ident, $peer_state_lock: ident, $channel_id: expr) => {
10081003
{
@@ -1013,7 +1008,6 @@ macro_rules! get_channel_ref {
10131008
}
10141009
}
10151010

1016-
#[cfg(any(test, feature = "_externalize_tests"))]
10171011
macro_rules! get_feerate {
10181012
($node: expr, $counterparty_node: expr, $channel_id: expr) => {
10191013
{
@@ -1025,7 +1019,6 @@ macro_rules! get_feerate {
10251019
}
10261020
}
10271021

1028-
#[cfg(any(test, feature = "_externalize_tests"))]
10291022
macro_rules! get_channel_type_features {
10301023
($node: expr, $counterparty_node: expr, $channel_id: expr) => {
10311024
{
@@ -1172,7 +1165,6 @@ pub fn _reload_node<'a, 'b, 'c>(node: &'a Node<'a, 'b, 'c>, default_config: User
11721165
node_deserialized
11731166
}
11741167

1175-
#[cfg(any(test, feature = "_externalize_tests"))]
11761168
macro_rules! reload_node {
11771169
($node: expr, $new_config: expr, $chanman_encoded: expr, $monitors_encoded: expr, $persister: ident, $new_chain_monitor: ident, $new_channelmanager: ident) => {
11781170
let chanman_encoded = $chanman_encoded;
@@ -2011,7 +2003,6 @@ macro_rules! expect_pending_htlcs_forwardable_and_htlc_handling_failed {
20112003
}}
20122004
}
20132005

2014-
#[cfg(any(test, feature = "_externalize_tests"))]
20152006
macro_rules! expect_pending_htlcs_forwardable_from_events {
20162007
($node: expr, $events: expr, $ignore: expr) => {{
20172008
assert_eq!($events.len(), 1);
@@ -2209,7 +2200,6 @@ macro_rules! get_route {
22092200
}}
22102201
}
22112202

2212-
#[cfg(any(test, feature = "_test_utils"))]
22132203
#[macro_export]
22142204
macro_rules! get_route_and_payment_hash {
22152205
($send_node: expr, $recv_node: expr, $recv_value: expr) => {{
@@ -2345,7 +2335,6 @@ macro_rules! expect_payment_sent {
23452335
}
23462336
}
23472337

2348-
#[cfg(any(test, feature = "_test_utils"))]
23492338
#[macro_export]
23502339
macro_rules! expect_payment_path_successful {
23512340
($node: expr) => {
@@ -2433,7 +2422,6 @@ macro_rules! expect_payment_forwarded {
24332422
}
24342423
}
24352424

2436-
#[cfg(any(test, feature = "_test_utils"))]
24372425
#[macro_export]
24382426
macro_rules! expect_channel_shutdown_state {
24392427
($node: expr, $chan_id: expr, $state: path) => {
@@ -2468,7 +2456,6 @@ pub fn expect_channel_ready_event<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, ex
24682456
}
24692457
}
24702458

2471-
#[cfg(any(test, feature = "_test_utils"))]
24722459
pub fn expect_probe_successful_events(node: &Node, mut probe_results: Vec<(PaymentHash, PaymentId)>) {
24732460
let mut events = node.node.get_and_clear_pending_events();
24742461

@@ -2528,7 +2515,6 @@ impl<'a> PaymentFailedConditions<'a> {
25282515
}
25292516
}
25302517

2531-
#[cfg(any(test, feature = "_externalize_tests"))]
25322518
macro_rules! expect_payment_failed_with_update {
25332519
($node: expr, $expected_payment_hash: expr, $payment_failed_permanently: expr, $scid: expr, $chan_closed: expr) => {
25342520
$crate::ln::functional_test_utils::expect_payment_failed_conditions(
@@ -2538,7 +2524,6 @@ macro_rules! expect_payment_failed_with_update {
25382524
}
25392525
}
25402526

2541-
#[cfg(any(test, feature = "_externalize_tests"))]
25422527
macro_rules! expect_payment_failed {
25432528
($node: expr, $expected_payment_hash: expr, $payment_failed_permanently: expr $(, $expected_error_code: expr, $expected_error_data: expr)*) => {
25442529
#[allow(unused_mut)]
@@ -2557,14 +2542,11 @@ pub fn expect_payment_failed_conditions_event<'a, 'b, 'c, 'd, 'e>(
25572542
if conditions.expected_mpp_parts_remain { assert_eq!(payment_failed_events.len(), 1); } else { assert_eq!(payment_failed_events.len(), 2); }
25582543
let expected_payment_id = match &payment_failed_events[0] {
25592544
Event::PaymentPathFailed { payment_hash, payment_failed_permanently, payment_id, failure,
2560-
#[cfg(any(test, feature = "_test_utils"))]
2561-
error_code,
2562-
#[cfg(any(test, feature = "_test_utils"))]
2563-
error_data, .. } => {
2545+
error_code,
2546+
error_data, .. } => {
25642547
assert_eq!(*payment_hash, expected_payment_hash, "unexpected payment_hash");
25652548
assert_eq!(*payment_failed_permanently, expected_payment_failed_permanently, "unexpected payment_failed_permanently value");
2566-
#[cfg(any(test, feature = "_test_utils"))]
2567-
{
2549+
{
25682550
assert!(error_code.is_some(), "expected error_code.is_some() = true");
25692551
assert!(error_data.is_some(), "expected error_data.is_some() = true");
25702552
if let Some((code, data)) = conditions.expected_htlc_error_data {
@@ -3627,7 +3609,6 @@ pub fn get_announce_close_broadcast_events<'a, 'b, 'c>(nodes: &Vec<Node<'a, 'b,
36273609
handle_announce_close_broadcast_events(nodes, a, b, false, "Channel closed because commitment or closing transaction was confirmed on chain.");
36283610
}
36293611

3630-
#[cfg(any(test, feature = "_externalize_tests"))]
36313612
macro_rules! get_channel_value_stat {
36323613
($node: expr, $counterparty_node: expr, $channel_id: expr) => {{
36333614
let peer_state_lock = $node.node.per_peer_state.read().unwrap();

lightning/src/ln/functional_tests.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,6 @@ pub fn channel_reserve_in_flight_removes() {
22672267
claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_3);
22682268
}
22692269

2270-
#[cfg(any(test, feature = "_test_utils"))]
22712270
enum PostFailBackAction {
22722271
TimeoutOnChain,
22732272
ClaimOnChain,
@@ -2283,7 +2282,6 @@ fn test_fail_back_before_backwards_timeout() {
22832282
do_test_fail_back_before_backwards_timeout(PostFailBackAction::ClaimOffChain);
22842283
}
22852284

2286-
#[cfg(any(test, feature = "_test_utils"))]
22872285
fn do_test_fail_back_before_backwards_timeout(post_fail_back_action: PostFailBackAction) {
22882286
// Test that we fail an HTLC upstream if we are still waiting for confirmation downstream
22892287
// just before the upstream timeout expires

lightning/src/routing/router.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ pub(crate) struct FixedRouter {
198198

199199
#[cfg(any(test, feature = "_test_utils"))]
200200
impl FixedRouter {
201-
#[cfg(any(test, feature = "_test_utils"))]
202201
pub(crate) fn new(route: Route) -> Self {
203202
Self { route: Mutex::new(Some(route)) }
204203
}

0 commit comments

Comments
 (0)