X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fonion_route_tests.rs;h=05b108fbf25e678e18f16cc36fb7c7a87793d44f;hb=cd4dc39a8c4732bea1a3221617f86e34dfb7efb8;hp=f3681946d194f614583c64488bb809103fccc9ec;hpb=73f601fd3d1c9defe553392264ca6dbcc53e4334;p=rust-lightning diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index f3681946..05b108fb 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -12,7 +12,7 @@ //! returned errors decode to the correct thing. use chain::channelmonitor::{CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS}; -use ln::{PaymentPreimage, PaymentHash, PaymentSecret}; +use ln::{PaymentHash, PaymentSecret}; use ln::channelmanager::{HTLCForwardInfo, CLTV_FAR_FAR_AWAY}; use ln::onion_utils; use routing::network_graph::NetworkUpdate; @@ -26,7 +26,6 @@ use util::config::UserConfig; use bitcoin::hash_types::BlockHash; -use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hashes::Hash; use bitcoin::secp256k1; @@ -477,6 +476,11 @@ fn test_onion_failure() { bogus_route.paths[0][route_len-1].fee_msat = amt_to_forward; run_onion_failure_test("amount_below_minimum", 0, &nodes, &bogus_route, &payment_hash, &payment_secret, |_| {}, ||{}, true, Some(UPDATE|11), Some(NetworkUpdate::ChannelUpdateMessage{msg: ChannelUpdate::dummy(short_channel_id)}), Some(short_channel_id)); + // Clear pending payments so that the following positive test has the correct payment hash. + for node in nodes.iter() { + node.node.clear_pending_payments(); + } + // Test a positive test-case with one extra msat, meeting the minimum. bogus_route.paths[0][route_len-1].fee_msat = amt_to_forward + 1; let preimage = send_along_route(&nodes[0], bogus_route, &[&nodes[1], &nodes[2]], amt_to_forward+1).0;