projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #303 from TheBlueMatt/2019-01-log-more
[rust-lightning]
/
src
/
util
/
ser.rs
diff --git
a/src/util/ser.rs
b/src/util/ser.rs
index 78fd4c1ce8ab8a77e5e747c390d12520205a68e2..d832c7018825e75df028bd2e2b8ea538962cc0e3 100644
(file)
--- a/
src/util/ser.rs
+++ b/
src/util/ser.rs
@@
-6,7
+6,7
@@
use std::io::{Read, Write};
use std::collections::HashMap;
use std::hash::Hash;
use std::collections::HashMap;
use std::hash::Hash;
-use secp256k1::
{Secp256k1, Signature}
;
+use secp256k1::
Signature
;
use secp256k1::key::{PublicKey, SecretKey};
use bitcoin::util::hash::Sha256dHash;
use bitcoin::blockdata::script::Script;
use secp256k1::key::{PublicKey, SecretKey};
use bitcoin::util::hash::Sha256dHash;
use bitcoin::blockdata::script::Script;
@@
-203,6
+203,10
@@
macro_rules! impl_array {
}
//TODO: performance issue with [u8; size] with impl_array!()
}
//TODO: performance issue with [u8; size] with impl_array!()
+impl_array!(3); // for rgb
+impl_array!(4); // for IPv4
+impl_array!(10); // for OnionV2
+impl_array!(16); // for IPv6
impl_array!(32); // for channel id & hmac
impl_array!(33); // for PublicKey
impl_array!(64); // for Signature
impl_array!(32); // for channel id & hmac
impl_array!(33); // for PublicKey
impl_array!(64); // for Signature
@@
-311,7
+315,7
@@
impl Writeable for PublicKey {
impl<R: Read> Readable<R> for PublicKey {
fn read(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 33] = Readable::read(r)?;
impl<R: Read> Readable<R> for PublicKey {
fn read(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 33] = Readable::read(r)?;
- match PublicKey::from_slice(&
Secp256k1::without_caps(), &
buf) {
+ match PublicKey::from_slice(&buf) {
Ok(key) => Ok(key),
Err(_) => return Err(DecodeError::InvalidValue),
}
Ok(key) => Ok(key),
Err(_) => return Err(DecodeError::InvalidValue),
}
@@
-329,7
+333,7
@@
impl Writeable for SecretKey {
impl<R: Read> Readable<R> for SecretKey {
fn read(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 32] = Readable::read(r)?;
impl<R: Read> Readable<R> for SecretKey {
fn read(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 32] = Readable::read(r)?;
- match SecretKey::from_slice(&
Secp256k1::without_caps(), &
buf) {
+ match SecretKey::from_slice(&buf) {
Ok(key) => Ok(key),
Err(_) => return Err(DecodeError::InvalidValue),
}
Ok(key) => Ok(key),
Err(_) => return Err(DecodeError::InvalidValue),
}
@@
-351,14
+355,14
@@
impl<R: Read> Readable<R> for Sha256dHash {
impl Writeable for Signature {
fn write<W: Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
impl Writeable for Signature {
fn write<W: Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
- self.serialize_compact(
&Secp256k1::without_caps()
).write(w)
+ self.serialize_compact().write(w)
}
}
impl<R: Read> Readable<R> for Signature {
fn read(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 64] = Readable::read(r)?;
}
}
impl<R: Read> Readable<R> for Signature {
fn read(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 64] = Readable::read(r)?;
- match Signature::from_compact(&
Secp256k1::without_caps(), &
buf) {
+ match Signature::from_compact(&buf) {
Ok(sig) => Ok(sig),
Err(_) => return Err(DecodeError::InvalidValue),
}
Ok(sig) => Ok(sig),
Err(_) => return Err(DecodeError::InvalidValue),
}