Skip to content

Commit 884160c

Browse files
committed
Convert Event vec storage away from vec_type
* `PaymentPathFailed::path` was added without an optional compat wrapper in e5310dd. * `PaymentPathSuccessful::path` has always been written since the event was added in 2c4f16d. * `Probe{Failed,Successful}::path` have always been written since the events were added in eb8bce0.
1 parent a04bf84 commit 884160c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lightning/src/events/mod.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ impl Writeable for Event {
909909
(2, payment_failed_permanently, required),
910910
(3, false, required), // all_paths_failed in LDK versions prior to 0.0.114
911911
(4, path.blinded_tail, option),
912-
(5, path.hops, vec_type),
912+
(5, path.hops, required_vec),
913913
(7, short_channel_id, option),
914914
(9, None::<RouteParameters>, option), // retry in LDK versions prior to 0.0.115
915915
(11, payment_id, option),
@@ -977,7 +977,7 @@ impl Writeable for Event {
977977
write_tlv_fields!(writer, {
978978
(0, payment_id, required),
979979
(2, payment_hash, option),
980-
(4, path.hops, vec_type),
980+
(4, path.hops, required_vec),
981981
(6, path.blinded_tail, option),
982982
})
983983
},
@@ -1008,7 +1008,7 @@ impl Writeable for Event {
10081008
write_tlv_fields!(writer, {
10091009
(0, payment_id, required),
10101010
(2, payment_hash, required),
1011-
(4, path.hops, vec_type),
1011+
(4, path.hops, required_vec),
10121012
(6, path.blinded_tail, option),
10131013
})
10141014
},
@@ -1017,7 +1017,7 @@ impl Writeable for Event {
10171017
write_tlv_fields!(writer, {
10181018
(0, payment_id, required),
10191019
(2, payment_hash, required),
1020-
(4, path.hops, vec_type),
1020+
(4, path.hops, required_vec),
10211021
(6, short_channel_id, option),
10221022
(8, path.blinded_tail, option),
10231023
})
@@ -1162,7 +1162,9 @@ impl MaybeReadable for Event {
11621162
(1, network_update, upgradable_option),
11631163
(2, payment_failed_permanently, required),
11641164
(4, blinded_tail, option),
1165-
(5, path, vec_type),
1165+
// Added as a part of LDK 0.0.101 and always filled in since.
1166+
// Defaults to an empty Vec, though likely should have been `Option`al.
1167+
(5, path, optional_vec),
11661168
(7, short_channel_id, option),
11671169
(11, payment_id, option),
11681170
(13, failure_opt, upgradable_option),
@@ -1279,13 +1281,13 @@ impl MaybeReadable for Event {
12791281
_init_and_read_tlv_fields!(reader, {
12801282
(0, payment_id, required),
12811283
(2, payment_hash, option),
1282-
(4, path, vec_type),
1284+
(4, path, required_vec),
12831285
(6, blinded_tail, option),
12841286
});
12851287
Ok(Some(Event::PaymentPathSuccessful {
12861288
payment_id: payment_id.0.unwrap(),
12871289
payment_hash,
1288-
path: Path { hops: path.unwrap(), blinded_tail },
1290+
path: Path { hops: path, blinded_tail },
12891291
}))
12901292
};
12911293
f()
@@ -1338,13 +1340,13 @@ impl MaybeReadable for Event {
13381340
_init_and_read_tlv_fields!(reader, {
13391341
(0, payment_id, required),
13401342
(2, payment_hash, required),
1341-
(4, path, vec_type),
1343+
(4, path, required_vec),
13421344
(6, blinded_tail, option),
13431345
});
13441346
Ok(Some(Event::ProbeSuccessful {
13451347
payment_id: payment_id.0.unwrap(),
13461348
payment_hash: payment_hash.0.unwrap(),
1347-
path: Path { hops: path.unwrap(), blinded_tail },
1349+
path: Path { hops: path, blinded_tail },
13481350
}))
13491351
};
13501352
f()
@@ -1354,14 +1356,14 @@ impl MaybeReadable for Event {
13541356
_init_and_read_tlv_fields!(reader, {
13551357
(0, payment_id, required),
13561358
(2, payment_hash, required),
1357-
(4, path, vec_type),
1359+
(4, path, required_vec),
13581360
(6, short_channel_id, option),
13591361
(8, blinded_tail, option),
13601362
});
13611363
Ok(Some(Event::ProbeFailed {
13621364
payment_id: payment_id.0.unwrap(),
13631365
payment_hash: payment_hash.0.unwrap(),
1364-
path: Path { hops: path.unwrap(), blinded_tail },
1366+
path: Path { hops: path, blinded_tail },
13651367
short_channel_id,
13661368
}))
13671369
};

0 commit comments

Comments
 (0)