Skip to content

Commit 79fbb32

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 d2b0f65 commit 79fbb32

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
@@ -749,7 +749,7 @@ where T: Readable + Eq + Hash
749749
}
750750

751751
// Vectors
752-
macro_rules! impl_for_vec {
752+
macro_rules! impl_writeable_for_vec {
753753
($ty: ty $(, $name: ident)*) => {
754754
impl<$($name : Writeable),*> Writeable for Vec<$ty> {
755755
#[inline]
@@ -761,7 +761,10 @@ macro_rules! impl_for_vec {
761761
Ok(())
762762
}
763763
}
764-
764+
}
765+
}
766+
macro_rules! impl_readable_for_vec {
767+
($ty: ty $(, $name: ident)*) => {
765768
impl<$($name : Readable),*> Readable for Vec<$ty> {
766769
#[inline]
767770
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
@@ -802,9 +805,12 @@ impl Readable for Vec<u8> {
802805
}
803806
}
804807

805-
impl_for_vec!(ecdsa::Signature);
806-
impl_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
807-
impl_for_vec!((A, B), A, B);
808+
impl_writeable_for_vec!(ecdsa::Signature);
809+
impl_readable_for_vec!(ecdsa::Signature);
810+
impl_writeable_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
811+
impl_readable_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
812+
impl_writeable_for_vec!((A, B), A, B);
813+
impl_readable_for_vec!((A, B), A, B);
808814

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

0 commit comments

Comments
 (0)