From 188f919a15751f9549f8fcd273abcb4b8ddd4464 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Mon, 21 Mar 2022 15:29:21 -0500 Subject: [PATCH] Don't serialize FixedPenaltyScorer parameters Serializing scorer parameters makes it difficult to experiment with different settings. --- lightning/src/routing/scoring.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index d8b1740c1..2ccfba08d 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -197,10 +197,6 @@ pub struct FixedPenaltyScorer { penalty_msat: u64, } -impl_writeable_tlv_based!(FixedPenaltyScorer, { - (0, penalty_msat, required), -}); - impl FixedPenaltyScorer { /// Creates a new scorer using `penalty_msat`. pub fn with_penalty(penalty_msat: u64) -> Self { @@ -218,6 +214,22 @@ impl Score for FixedPenaltyScorer { fn payment_path_successful(&mut self, _path: &[&RouteHop]) {} } +impl Writeable for FixedPenaltyScorer { + #[inline] + fn write(&self, w: &mut W) -> Result<(), io::Error> { + write_tlv_fields!(w, {}); + Ok(()) + } +} + +impl ReadableArgs for FixedPenaltyScorer { + #[inline] + fn read(r: &mut R, penalty_msat: u64) -> Result { + read_tlv_fields!(r, {}); + Ok(Self { penalty_msat }) + } +} + /// [`Score`] implementation that provides reasonable default behavior. /// /// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with -- 2.39.5