Skip to content

Commit 4b65f82

Browse files
Split impl_for_vec ser macro into read/write variants
We need to (de)serialize vecs of BlindedPaths differently based on whether we're writing or reading, used in the next commit
1 parent 27ea6e1 commit 4b65f82

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lightning/src/util/ser.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ where T: Readable + Eq + Hash
746746
}
747747

748748
// Vectors
749-
macro_rules! impl_for_vec {
749+
macro_rules! impl_writeable_for_vec {
750750
($ty: ty $(, $name: ident)*) => {
751751
impl<$($name : Writeable),*> Writeable for Vec<$ty> {
752752
#[inline]
@@ -758,7 +758,10 @@ macro_rules! impl_for_vec {
758758
Ok(())
759759
}
760760
}
761-
761+
}
762+
}
763+
macro_rules! impl_readable_for_vec {
764+
($ty: ty $(, $name: ident)*) => {
762765
impl<$($name : Readable),*> Readable for Vec<$ty> {
763766
#[inline]
764767
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
@@ -799,9 +802,12 @@ impl Readable for Vec<u8> {
799802
}
800803
}
801804

802-
impl_for_vec!(ecdsa::Signature);
803-
impl_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
804-
impl_for_vec!((A, B), A, B);
805+
impl_writeable_for_vec!(ecdsa::Signature);
806+
impl_readable_for_vec!(ecdsa::Signature);
807+
impl_writeable_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
808+
impl_readable_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
809+
impl_writeable_for_vec!((A, B), A, B);
810+
impl_readable_for_vec!((A, B), A, B);
805811

806812
impl Writeable for Script {
807813
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {

0 commit comments

Comments
 (0)