Skip to content

Commit 9402554

Browse files
committed
Don't serialize FixedPenaltyScorer parameters
Serializing scorer parameters makes it difficult to experiment with different settings.
1 parent 979939b commit 9402554

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lightning/src/routing/scoring.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ pub struct FixedPenaltyScorer {
197197
penalty_msat: u64,
198198
}
199199

200-
impl_writeable_tlv_based!(FixedPenaltyScorer, {
201-
(0, penalty_msat, required),
202-
});
203-
204200
impl FixedPenaltyScorer {
205201
/// Creates a new scorer using `penalty_msat`.
206202
pub fn with_penalty(penalty_msat: u64) -> Self {
@@ -218,6 +214,22 @@ impl Score for FixedPenaltyScorer {
218214
fn payment_path_successful(&mut self, _path: &[&RouteHop]) {}
219215
}
220216

217+
impl Writeable for FixedPenaltyScorer {
218+
#[inline]
219+
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
220+
write_tlv_fields!(w, {});
221+
Ok(())
222+
}
223+
}
224+
225+
impl ReadableArgs<u64> for FixedPenaltyScorer {
226+
#[inline]
227+
fn read<R: Read>(r: &mut R, penalty_msat: u64) -> Result<Self, DecodeError> {
228+
read_tlv_fields!(r, {});
229+
Ok(Self { penalty_msat })
230+
}
231+
}
232+
221233
/// [`Score`] implementation that provides reasonable default behavior.
222234
///
223235
/// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with

0 commit comments

Comments
 (0)