Skip to content

Commit

Permalink
Drop need to store pending inbound payments
Browse files Browse the repository at this point in the history
and replace payment_secret with encrypted metadata

See docs on verify_inbound_payment for details
  • Loading branch information
valentinewallace committed Dec 1, 2021
1 parent 7e84c5c commit 1e575f8
Show file tree
Hide file tree
Showing 4 changed files with 293 additions and 19 deletions.
15 changes: 14 additions & 1 deletion lightning/src/chain/keysinterface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use ln::script::ShutdownScript;

use prelude::*;
use core::sync::atomic::{AtomicUsize, Ordering};
use io::{self, Error};
use io::{self, Error, Read};
use ln::msgs::{DecodeError, MAX_VALUE_MSAT};

/// Used as initial key material, to be expanded into multiple secret keys (but not to be used
Expand All @@ -49,6 +49,19 @@ use ln::msgs::{DecodeError, MAX_VALUE_MSAT};
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct KeyMaterial(pub [u8;32]);

impl Writeable for KeyMaterial {
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
self.0.write(w)
}
}

impl Readable for KeyMaterial {
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
let buf: [u8; 32] = Readable::read(r)?;
Ok(KeyMaterial(buf))
}
}

/// Information about a spendable output to a P2WSH script. See
/// SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
#[derive(Clone, Debug, PartialEq)]
Expand Down
Loading

0 comments on commit 1e575f8

Please sign in to comment.