Skip to content

Commit a64b00f

Browse files
committed
f sec key size constant
1 parent 7e9cfd6 commit a64b00f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/util/ser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use core::cmp;
1919

2020
use bitcoin::secp256k1::Signature;
2121
use bitcoin::secp256k1::key::{PublicKey, SecretKey};
22-
use bitcoin::secp256k1::constants::{PUBLIC_KEY_SIZE, COMPACT_SIGNATURE_SIZE};
22+
use bitcoin::secp256k1::constants::{PUBLIC_KEY_SIZE, SECRET_KEY_SIZE, COMPACT_SIGNATURE_SIZE};
2323
use bitcoin::blockdata::script::Script;
2424
use bitcoin::blockdata::transaction::{OutPoint, Transaction, TxOut};
2525
use bitcoin::consensus;
@@ -589,19 +589,19 @@ impl Readable for PublicKey {
589589

590590
impl Writeable for SecretKey {
591591
fn write<W: Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
592-
let mut ser = [0; 32];
592+
let mut ser = [0; SECRET_KEY_SIZE];
593593
ser.copy_from_slice(&self[..]);
594594
ser.write(w)
595595
}
596596
#[inline]
597597
fn serialized_length(&self) -> usize {
598-
32
598+
SECRET_KEY_SIZE
599599
}
600600
}
601601

602602
impl Readable for SecretKey {
603603
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
604-
let buf: [u8; 32] = Readable::read(r)?;
604+
let buf: [u8; SECRET_KEY_SIZE] = Readable::read(r)?;
605605
match SecretKey::from_slice(&buf) {
606606
Ok(key) => Ok(key),
607607
Err(_) => return Err(DecodeError::InvalidValue),

0 commit comments

Comments
 (0)