+// This file is Copyright its original authors, visible in version control
+// history.
+//
+// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
+// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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};
}
}
- impl<R: ::std::io::Read> ::util::ser::Readable<R> for $st {
- fn read(r: &mut R) -> Result<Self, ::ln::msgs::DecodeError> {
+ impl ::util::ser::Readable for $st {
+ fn read<R: ::std::io::Read>(r: &mut R) -> Result<Self, ::ln::msgs::DecodeError> {
Ok(Self {
$($field: ::util::ser::Readable::read(r)?),*
})
}
}
- impl<R: ::std::io::Read> Readable<R> for $st {
- fn read(r: &mut R) -> Result<Self, DecodeError> {
+ impl ::util::ser::Readable for $st {
+ fn read<R: ::std::io::Read>(r: &mut R) -> Result<Self, DecodeError> {
Ok(Self {
$($field: Readable::read(r)?),*
})
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
(0xdeadbeef1badbeef, 0x1bad1dea, Some(0x01020304)));
}
- impl<R: Read> Readable<R> for (PublicKey, u64, u64) {
+ impl Readable for (PublicKey, u64, u64) {
#[inline]
- fn read(reader: &mut R) -> Result<(PublicKey, u64, u64), DecodeError> {
+ fn read<R: Read>(reader: &mut R) -> Result<(PublicKey, u64, u64), DecodeError> {
Ok((Readable::read(reader)?, Readable::read(reader)?, Readable::read(reader)?))
}
}