X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=2cac5a874a62f0b87770e642905527879ba058ff;hb=2e06efe2ffda522ba8d34213106244af2b608ccf;hp=f4b751663ee62a5e5991f19c44f15f69b18d2990;hpb=9d7bb73b599a7a9d8468a2f0c54d28f0ce6cf543;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index f4b751663..2cac5a874 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -21,6 +21,7 @@ use crate::ln::channelmanager; use crate::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures}; use crate::ln::{msgs, wire}; use crate::ln::script::ShutdownScript; +use crate::routing::router::{InFlightHtlcs, Route, RouteHop, RouteParameters, Router}; use crate::routing::scoring::FixedPenaltyScorer; use crate::util::enforcing_trait_impls::{EnforcingSigner, EnforcementState}; use crate::util::events; @@ -36,6 +37,7 @@ use bitcoin::network::constants::Network; use bitcoin::hash_types::{BlockHash, Txid}; use bitcoin::secp256k1::{SecretKey, PublicKey, Secp256k1, ecdsa::Signature, Scalar}; +use bitcoin::secp256k1::ecdh::SharedSecret; use bitcoin::secp256k1::ecdsa::RecoverableSignature; use regex; @@ -51,7 +53,6 @@ use crate::chain::keysinterface::{InMemorySigner, Recipient, KeyMaterial, Entrop #[cfg(feature = "std")] use std::time::{SystemTime, UNIX_EPOCH}; -use bitcoin::secp256k1::ecdh::SharedSecret; use bitcoin::Sequence; pub struct TestVecWriter(pub Vec); @@ -71,6 +72,24 @@ impl chaininterface::FeeEstimator for TestFeeEstimator { } } +pub struct TestRouter {} + +impl Router for TestRouter { + fn find_route( + &self, _payer: &PublicKey, _params: &RouteParameters, _first_hops: Option<&[&channelmanager::ChannelDetails]>, + _inflight_htlcs: InFlightHtlcs + ) -> Result { + Err(msgs::LightningError { + err: String::from("Not implemented"), + action: msgs::ErrorAction::IgnoreError + }) + } + fn notify_payment_path_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} + fn notify_payment_path_successful(&self, _path: &[&RouteHop]) {} + fn notify_payment_probe_successful(&self, _path: &[&RouteHop]) {} + fn notify_payment_probe_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} +} + pub struct OnlyReadsKeysInterface {} impl EntropySource for OnlyReadsKeysInterface {