From: Jeffrey Czyz Date: Tue, 1 Feb 2022 23:35:47 +0000 (-0600) Subject: f - Put channel_liquidities into TLV X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=4b36119d87b255c30536d9322407e2478b7b6869;p=rust-lightning f - Put channel_liquidities into TLV --- 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, + }) } }