From: Jeffrey Czyz Date: Mon, 21 Mar 2022 20:29:21 +0000 (-0500) Subject: Don't serialize FixedPenaltyScorer parameters X-Git-Tag: v0.0.106~6^2~4 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=188f919a15751f9549f8fcd273abcb4b8ddd4464;p=rust-lightning Don't serialize FixedPenaltyScorer parameters Serializing scorer parameters makes it difficult to experiment with different settings. --- 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