From 4b36119d87b255c30536d9322407e2478b7b6869 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Tue, 1 Feb 2022 17:35:47 -0600 Subject: [PATCH] f - Put channel_liquidities into TLV --- lightning/src/routing/scoring.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index c7f36c895..4fef17f9b 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -719,8 +719,9 @@ impl> Score for ProbabilisticScorer { impl> Writeable for ProbabilisticScorer { #[inline] fn write(&self, w: &mut W) -> Result<(), io::Error> { - self.channel_liquidities.write(w)?; - write_tlv_fields!(w, {}); + write_tlv_fields!(w, { + (0, self.channel_liquidities, required) + }); Ok(()) } } @@ -732,13 +733,15 @@ for ProbabilisticScorer { r: &mut R, args: (ProbabilisticScoringParameters, G) ) -> Result { let (params, network_graph) = args; - let res = Ok(Self { + let mut channel_liquidities = HashMap::new(); + read_tlv_fields!(r, { + (0, channel_liquidities, required) + }); + Ok(Self { params, network_graph, - channel_liquidities: Readable::read(r)?, - }); - read_tlv_fields!(r, {}); - res + channel_liquidities, + }) } } -- 2.39.5