X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fser_macros.rs;h=ceabcc1ddbeb385666c909943842d01d61887b91;hb=20a25967efd1b331f7faed3629617164fa1b40ec;hp=766d4ee2d78ff90a774049e8cc13d9731b490d18;hpb=3c9e8c9d773db3ffaf18bec01bde56e32b871a5f;p=rust-lightning diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index 766d4ee2..ceabcc1d 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -1,3 +1,12 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + macro_rules! encode_tlv { ($stream: expr, {$(($type: expr, $field: expr)),*}) => { { use util::ser::{BigSize, LengthCalculatingWriter}; @@ -116,8 +125,8 @@ macro_rules! impl_writeable { } } - impl ::util::ser::Readable for $st { - fn read(r: &mut R) -> Result { + impl ::util::ser::Readable for $st { + fn read(r: &mut R) -> Result { Ok(Self { $($field: ::util::ser::Readable::read(r)?),* }) @@ -137,8 +146,8 @@ macro_rules! impl_writeable_len_match { } } - impl Readable for $st { - fn read(r: &mut R) -> Result { + impl ::util::ser::Readable for $st { + fn read(r: &mut R) -> Result { Ok(Self { $($field: Readable::read(r)?),* }) @@ -152,7 +161,7 @@ mod tests { use std::io::{Cursor, Read}; use ln::msgs::DecodeError; use util::ser::{Readable, Writeable, HighZeroBytesDroppedVarInt, VecWriter}; - use secp256k1::PublicKey; + use bitcoin::secp256k1::PublicKey; // The BOLT TLV test cases don't include any tests which use our "required-value" logic since // the encoding layer in the BOLTs has no such concept, though it makes our macros easier to @@ -219,9 +228,9 @@ mod tests { (0xdeadbeef1badbeef, 0x1bad1dea, Some(0x01020304))); } - impl Readable for (PublicKey, u64, u64) { + impl Readable for (PublicKey, u64, u64) { #[inline] - fn read(reader: &mut R) -> Result<(PublicKey, u64, u64), DecodeError> { + fn read(reader: &mut R) -> Result<(PublicKey, u64, u64), DecodeError> { Ok((Readable::read(reader)?, Readable::read(reader)?, Readable::read(reader)?)) } }