use bitcoin::secp256k1::key::{SecretKey,PublicKey};
use bitcoin::secp256k1;
+use ln::{PaymentHash, PaymentPreimage};
use ln::msgs::DecodeError;
use ln::chan_utils;
use ln::chan_utils::{CounterpartyCommitmentSecrets, HTLCOutputInCommitment, HTLCType, ChannelTransactionParameters, HolderCommitmentTransaction};
-use ln::channelmanager::{BestBlock, HTLCSource, PaymentPreimage, PaymentHash};
+use ln::channelmanager::{BestBlock, HTLCSource};
use ln::onchaintx::{OnchainTxHandler, InputDescriptors};
use chain;
use chain::WatchedOutput;
use util::events::Event;
use std::collections::{HashMap, HashSet};
-use std::{cmp, mem};
+use core::{cmp, mem};
use std::io::Error;
-use std::ops::Deref;
+use core::ops::Deref;
use std::sync::Mutex;
/// An update generated by the underlying Channel itself which contains some new information the
/// then we allow the `ChannelManager` to send a `ChannelMonitorUpdate` with this update ID,
/// with the update providing said payment preimage. No other update types are allowed after
/// force-close.
-pub const CLOSED_CHANNEL_UPDATE_ID: u64 = std::u64::MAX;
+pub const CLOSED_CHANNEL_UPDATE_ID: u64 = core::u64::MAX;
impl Writeable for ChannelMonitorUpdate {
fn write<W: Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
fn read<R: ::std::io::Read>(r: &mut R) -> Result<Self, DecodeError> {
let update_id: u64 = Readable::read(r)?;
let len: u64 = Readable::read(r)?;
- let mut updates = Vec::with_capacity(cmp::min(len as usize, MAX_ALLOC_SIZE / ::std::mem::size_of::<ChannelMonitorUpdateStep>()));
+ let mut updates = Vec::with_capacity(cmp::min(len as usize, MAX_ALLOC_SIZE / ::core::mem::size_of::<ChannelMonitorUpdateStep>()));
for _ in 0..len {
updates.push(Readable::read(r)?);
}
/// HTLC-Success transaction.
/// In other words, this is an upper bound on how many blocks we think it can take us to get a
/// transaction confirmed (and we use it in a few more, equivalent, places).
-pub(crate) const CLTV_CLAIM_BUFFER: u32 = 6;
+pub(crate) const CLTV_CLAIM_BUFFER: u32 = 18;
/// Number of blocks by which point we expect our counterparty to have seen new blocks on the
/// network and done a full update_fail_htlc/commitment_signed dance (+ we've updated all our
/// copies of ChannelMonitors, including watchtowers). We could enforce the contract by failing
},
}
-const SERIALIZATION_VERSION: u8 = 1;
-const MIN_SERIALIZATION_VERSION: u8 = 1;
-
#[cfg_attr(any(test, feature = "fuzztarget", feature = "_test_utils"), derive(PartialEq))]
#[derive(Clone)]
pub(crate) enum ChannelMonitorUpdateStep {
// Used to track on-chain events (i.e., transactions part of channels confirmed on chain) on
// which to take actions once they reach enough confirmations. Each entry includes the
// transaction's id and the height when the transaction was confirmed on chain.
- onchain_events_waiting_threshold_conf: Vec<OnchainEventEntry>,
+ onchain_events_awaiting_threshold_conf: Vec<OnchainEventEntry>,
// If we get serialized out and re-read, we need to make sure that the chain monitoring
// interface knows about the TXOs that we want to be notified of spends of. We could probably
secp_ctx: Secp256k1<secp256k1::All>, //TODO: dedup this a bit...
}
+/// Transaction outputs to watch for on-chain spends.
+pub type TransactionOutputs = (Txid, Vec<(u32, TxOut)>);
+
#[cfg(any(test, feature = "fuzztarget", feature = "_test_utils"))]
/// Used only in testing and fuzztarget to check serialization roundtrips don't change the
/// underlying object
self.payment_preimages != other.payment_preimages ||
self.pending_monitor_events != other.pending_monitor_events ||
self.pending_events.len() != other.pending_events.len() || // We trust events to round-trip properly
- self.onchain_events_waiting_threshold_conf != other.onchain_events_waiting_threshold_conf ||
+ self.onchain_events_awaiting_threshold_conf != other.onchain_events_awaiting_threshold_conf ||
self.outputs_to_watch != other.outputs_to_watch ||
self.lockdown_from_offchain != other.lockdown_from_offchain ||
self.holder_tx_signed != other.holder_tx_signed
impl<Signer: Sign> Writeable for ChannelMonitor<Signer> {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
- //TODO: We still write out all the serialization here manually instead of using the fancy
- //serialization framework we have, we should migrate things over to it.
- writer.write_all(&[SERIALIZATION_VERSION; 1])?;
- writer.write_all(&[MIN_SERIALIZATION_VERSION; 1])?;
-
self.inner.lock().unwrap().write(writer)
}
}
+const SERIALIZATION_VERSION: u8 = 1;
+const MIN_SERIALIZATION_VERSION: u8 = 1;
+
impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
+ write_ver_prefix!(writer, SERIALIZATION_VERSION, MIN_SERIALIZATION_VERSION);
+
self.latest_update_id.write(writer)?;
// Set in initial Channel-object creation, so should always be set by now:
self.best_block.block_hash().write(writer)?;
writer.write_all(&byte_utils::be32_to_array(self.best_block.height()))?;
- writer.write_all(&byte_utils::be64_to_array(self.onchain_events_waiting_threshold_conf.len() as u64))?;
- for ref entry in self.onchain_events_waiting_threshold_conf.iter() {
+ writer.write_all(&byte_utils::be64_to_array(self.onchain_events_awaiting_threshold_conf.len() as u64))?;
+ for ref entry in self.onchain_events_awaiting_threshold_conf.iter() {
entry.txid.write(writer)?;
writer.write_all(&byte_utils::be32_to_array(entry.height))?;
match entry.event {
self.lockdown_from_offchain.write(writer)?;
self.holder_tx_signed.write(writer)?;
+ write_tlv_fields!(writer, {}, {});
+
Ok(())
}
}
pending_monitor_events: Vec::new(),
pending_events: Vec::new(),
- onchain_events_waiting_threshold_conf: Vec::new(),
+ onchain_events_awaiting_threshold_conf: Vec::new(),
outputs_to_watch,
onchain_tx_handler,
broadcaster: B,
fee_estimator: F,
logger: L,
- ) -> Vec<(Txid, Vec<(u32, TxOut)>)>
+ ) -> Vec<TransactionOutputs>
where
B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
/// outputs to watch. See [`block_connected`] for details.
///
/// Used instead of [`block_connected`] by clients that are notified of transactions rather than
- /// blocks. May be called before or after [`update_best_block`] for transactions in the
- /// corresponding block. See [`update_best_block`] for further calling expectations.
+ /// blocks. See [`chain::Confirm`] for calling expectations.
///
/// [`block_connected`]: Self::block_connected
- /// [`update_best_block`]: Self::update_best_block
pub fn transactions_confirmed<B: Deref, F: Deref, L: Deref>(
&self,
header: &BlockHeader,
broadcaster: B,
fee_estimator: F,
logger: L,
- ) -> Vec<(Txid, Vec<(u32, TxOut)>)>
+ ) -> Vec<TransactionOutputs>
where
B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
/// Processes a transaction that was reorganized out of the chain.
///
/// Used instead of [`block_disconnected`] by clients that are notified of transactions rather
- /// than blocks. May be called before or after [`update_best_block`] for transactions in the
- /// corresponding block. See [`update_best_block`] for further calling expectations.
+ /// than blocks. See [`chain::Confirm`] for calling expectations.
///
/// [`block_disconnected`]: Self::block_disconnected
- /// [`update_best_block`]: Self::update_best_block
pub fn transaction_unconfirmed<B: Deref, F: Deref, L: Deref>(
&self,
txid: &Txid,
/// [`block_connected`] for details.
///
/// Used instead of [`block_connected`] by clients that are notified of transactions rather than
- /// blocks. May be called before or after [`transactions_confirmed`] for the corresponding
- /// block.
- ///
- /// Must be called after new blocks become available for the most recent block. Intermediary
- /// blocks, however, may be safely skipped. In the event of a chain re-organization, this only
- /// needs to be called for the most recent block assuming `transaction_unconfirmed` is called
- /// for any affected transactions.
+ /// blocks. See [`chain::Confirm`] for calling expectations.
///
/// [`block_connected`]: Self::block_connected
- /// [`transactions_confirmed`]: Self::transactions_confirmed
- /// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
- pub fn update_best_block<B: Deref, F: Deref, L: Deref>(
+ pub fn best_block_updated<B: Deref, F: Deref, L: Deref>(
&self,
header: &BlockHeader,
height: u32,
broadcaster: B,
fee_estimator: F,
logger: L,
- ) -> Vec<(Txid, Vec<(u32, TxOut)>)>
+ ) -> Vec<TransactionOutputs>
where
B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
{
- self.inner.lock().unwrap().update_best_block(
+ self.inner.lock().unwrap().best_block_updated(
header, height, broadcaster, fee_estimator, logger)
}
+
+ /// Returns the set of txids that should be monitored for re-organization out of the chain.
+ pub fn get_relevant_txids(&self) -> Vec<Txid> {
+ let inner = self.inner.lock().unwrap();
+ let mut txids: Vec<Txid> = inner.onchain_events_awaiting_threshold_conf
+ .iter()
+ .map(|entry| entry.txid)
+ .chain(inner.onchain_tx_handler.get_relevant_txids().into_iter())
+ .collect();
+ txids.sort_unstable();
+ txids.dedup();
+ txids
+ }
}
impl<Signer: Sign> ChannelMonitorImpl<Signer> {
L::Target: Logger,
{
for tx in self.get_latest_holder_commitment_txn(logger).iter() {
+ log_info!(logger, "Broadcasting local {}", log_tx!(tx));
broadcaster.broadcast_transaction(tx);
}
self.pending_monitor_events.push(MonitorEvent::CommitmentTxBroadcasted(self.funding_info.0));
/// HTLC-Success/HTLC-Timeout transactions.
/// Return updates for HTLC pending in the channel and failed automatically by the broadcast of
/// revoked counterparty commitment tx
- fn check_spend_counterparty_transaction<L: Deref>(&mut self, tx: &Transaction, height: u32, logger: &L) -> (Vec<ClaimRequest>, (Txid, Vec<(u32, TxOut)>)) where L::Target: Logger {
+ fn check_spend_counterparty_transaction<L: Deref>(&mut self, tx: &Transaction, height: u32, logger: &L) -> (Vec<ClaimRequest>, TransactionOutputs) where L::Target: Logger {
// Most secp and related errors trying to create keys means we have no hope of constructing
// a spend transaction...so we return no transactions to broadcast
let mut claimable_outpoints = Vec::new();
if let Some(ref outpoints) = self.counterparty_claimable_outpoints.get($txid) {
for &(ref htlc, ref source_option) in outpoints.iter() {
if let &Some(ref source) = source_option {
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
if entry.height != height { return true; }
match entry.event {
OnchainEvent::HTLCUpdate { ref htlc_update } => {
},
};
log_info!(logger, "Failing HTLC with payment_hash {} from {} counterparty commitment tx due to broadcast of revoked counterparty commitment transaction, waiting for confirmation (at height {})", log_bytes!(htlc.payment_hash.0), $commitment_tx, entry.confirmation_threshold());
- self.onchain_events_waiting_threshold_conf.push(entry);
+ self.onchain_events_awaiting_threshold_conf.push(entry);
}
}
}
}
}
log_trace!(logger, "Failing HTLC with payment_hash {} from {} counterparty commitment tx due to broadcast of counterparty commitment transaction", log_bytes!(htlc.payment_hash.0), $commitment_tx);
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
if entry.height != height { return true; }
match entry.event {
OnchainEvent::HTLCUpdate { ref htlc_update } => {
_ => true,
}
});
- self.onchain_events_waiting_threshold_conf.push(OnchainEventEntry {
+ self.onchain_events_awaiting_threshold_conf.push(OnchainEventEntry {
txid: *$txid,
height,
event: OnchainEvent::HTLCUpdate {
}
/// Attempts to claim a counterparty HTLC-Success/HTLC-Timeout's outputs using the revocation key
- fn check_spend_counterparty_htlc<L: Deref>(&mut self, tx: &Transaction, commitment_number: u64, height: u32, logger: &L) -> (Vec<ClaimRequest>, Option<(Txid, Vec<(u32, TxOut)>)>) where L::Target: Logger {
+ fn check_spend_counterparty_htlc<L: Deref>(&mut self, tx: &Transaction, commitment_number: u64, height: u32, logger: &L) -> (Vec<ClaimRequest>, Option<TransactionOutputs>) where L::Target: Logger {
let htlc_txid = tx.txid();
if tx.input.len() != 1 || tx.output.len() != 1 || tx.input[0].witness.len() != 5 {
return (Vec::new(), None)
for &(ref htlc, _, _) in holder_tx.htlc_outputs.iter() {
if let Some(transaction_output_index) = htlc.transaction_output_index {
- claim_requests.push(ClaimRequest { absolute_timelock: ::std::u32::MAX, aggregable: false, outpoint: BitcoinOutPoint { txid: holder_tx.txid, vout: transaction_output_index as u32 },
+ claim_requests.push(ClaimRequest { absolute_timelock: ::core::u32::MAX, aggregable: false, outpoint: BitcoinOutPoint { txid: holder_tx.txid, vout: transaction_output_index as u32 },
witness_data: InputMaterial::HolderHTLC {
preimage: if !htlc.offered {
if let Some(preimage) = self.payment_preimages.get(&htlc.payment_hash) {
/// Attempts to claim any claimable HTLCs in a commitment transaction which was not (yet)
/// revoked using data in holder_claimable_outpoints.
/// Should not be used if check_spend_revoked_transaction succeeds.
- fn check_spend_holder_transaction<L: Deref>(&mut self, tx: &Transaction, height: u32, logger: &L) -> (Vec<ClaimRequest>, (Txid, Vec<(u32, TxOut)>)) where L::Target: Logger {
+ fn check_spend_holder_transaction<L: Deref>(&mut self, tx: &Transaction, height: u32, logger: &L) -> (Vec<ClaimRequest>, TransactionOutputs) where L::Target: Logger {
let commitment_txid = tx.txid();
let mut claim_requests = Vec::new();
let mut watch_outputs = Vec::new();
macro_rules! wait_threshold_conf {
($source: expr, $commitment_tx: expr, $payment_hash: expr) => {
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
if entry.height != height { return true; }
match entry.event {
OnchainEvent::HTLCUpdate { ref htlc_update } => {
event: OnchainEvent::HTLCUpdate { htlc_update: ($source, $payment_hash) },
};
log_trace!(logger, "Failing HTLC with payment_hash {} from {} holder commitment tx due to broadcast of transaction, waiting confirmation (at height{})", log_bytes!($payment_hash.0), $commitment_tx, entry.confirmation_threshold());
- self.onchain_events_waiting_threshold_conf.push(entry);
+ self.onchain_events_awaiting_threshold_conf.push(entry);
}
}
return res
}
- pub fn block_connected<B: Deref, F: Deref, L: Deref>(&mut self, header: &BlockHeader, txdata: &TransactionData, height: u32, broadcaster: B, fee_estimator: F, logger: L)-> Vec<(Txid, Vec<(u32, TxOut)>)>
+ pub fn block_connected<B: Deref, F: Deref, L: Deref>(&mut self, header: &BlockHeader, txdata: &TransactionData, height: u32, broadcaster: B, fee_estimator: F, logger: L) -> Vec<TransactionOutputs>
where B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
self.transactions_confirmed(header, txdata, height, broadcaster, fee_estimator, logger)
}
- fn update_best_block<B: Deref, F: Deref, L: Deref>(
+ fn best_block_updated<B: Deref, F: Deref, L: Deref>(
&mut self,
header: &BlockHeader,
height: u32,
broadcaster: B,
fee_estimator: F,
logger: L,
- ) -> Vec<(Txid, Vec<(u32, TxOut)>)>
+ ) -> Vec<TransactionOutputs>
where
B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
self.block_confirmed(height, vec![], vec![], vec![], broadcaster, fee_estimator, logger)
} else {
self.best_block = BestBlock::new(block_hash, height);
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.height <= height);
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height <= height);
self.onchain_tx_handler.block_disconnected(height + 1, broadcaster, fee_estimator, logger);
Vec::new()
}
broadcaster: B,
fee_estimator: F,
logger: L,
- ) -> Vec<(Txid, Vec<(u32, TxOut)>)>
+ ) -> Vec<TransactionOutputs>
where
B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
&mut self,
height: u32,
txn_matched: Vec<&Transaction>,
- mut watch_outputs: Vec<(Txid, Vec<(u32, TxOut)>)>,
+ mut watch_outputs: Vec<TransactionOutputs>,
mut claimable_outpoints: Vec<ClaimRequest>,
broadcaster: B,
fee_estimator: F,
logger: L,
- ) -> Vec<(Txid, Vec<(u32, TxOut)>)>
+ ) -> Vec<TransactionOutputs>
where
B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
}
// Find which on-chain events have reached their confirmation threshold.
- let onchain_events_waiting_threshold_conf =
- self.onchain_events_waiting_threshold_conf.drain(..).collect::<Vec<_>>();
+ let onchain_events_awaiting_threshold_conf =
+ self.onchain_events_awaiting_threshold_conf.drain(..).collect::<Vec<_>>();
let mut onchain_events_reaching_threshold_conf = Vec::new();
- for entry in onchain_events_waiting_threshold_conf {
+ for entry in onchain_events_awaiting_threshold_conf {
if entry.has_reached_confirmation_threshold(height) {
onchain_events_reaching_threshold_conf.push(entry);
} else {
- self.onchain_events_waiting_threshold_conf.push(entry);
+ self.onchain_events_awaiting_threshold_conf.push(entry);
}
}
// Used to check for duplicate HTLC resolutions.
#[cfg(debug_assertions)]
- let unmatured_htlcs: Vec<_> = self.onchain_events_waiting_threshold_conf
+ let unmatured_htlcs: Vec<_> = self.onchain_events_awaiting_threshold_conf
.iter()
.filter_map(|entry| match &entry.event {
OnchainEvent::HTLCUpdate { htlc_update } => Some(htlc_update.0.clone()),
//We may discard:
//- htlc update there as failure-trigger tx (revoked commitment tx, non-revoked commitment tx, HTLC-timeout tx) has been disconnected
//- maturing spendable output has transaction paying us has been disconnected
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.height < height);
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height < height);
self.onchain_tx_handler.block_disconnected(height, broadcaster, fee_estimator, logger);
F::Target: FeeEstimator,
L::Target: Logger,
{
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.txid != *txid);
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.txid != *txid);
self.onchain_tx_handler.transaction_unconfirmed(txid, broadcaster, fee_estimator, logger);
}
}));
}
} else {
- self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
+ self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
if entry.height != height { return true; }
match entry.event {
OnchainEvent::HTLCUpdate { ref htlc_update } => {
event: OnchainEvent::HTLCUpdate { htlc_update: (source, payment_hash) },
};
log_info!(logger, "Failing HTLC with payment_hash {} timeout by a spend tx, waiting for confirmation (at height{})", log_bytes!(payment_hash.0), entry.confirmation_threshold());
- self.onchain_events_waiting_threshold_conf.push(entry);
+ self.onchain_events_awaiting_threshold_conf.push(entry);
}
}
}
fn is_paying_spendable_output<L: Deref>(&mut self, tx: &Transaction, height: u32, logger: &L) where L::Target: Logger {
let mut spendable_output = None;
for (i, outp) in tx.output.iter().enumerate() { // There is max one spendable output for any channel tx, including ones generated by us
- if i > ::std::u16::MAX as usize {
+ if i > ::core::u16::MAX as usize {
// While it is possible that an output exists on chain which is greater than the
// 2^16th output in a given transaction, this is only possible if the output is not
// in a lightning transaction and was instead placed there by some third party who
event: OnchainEvent::MaturingOutput { descriptor: spendable_output.clone() },
};
log_trace!(logger, "Maturing {} until {}", log_spendable!(spendable_output), entry.confirmation_threshold());
- self.onchain_events_waiting_threshold_conf.push(entry);
+ self.onchain_events_awaiting_threshold_conf.push(entry);
}
}
}
/// transaction and losing money. This is a risk because previous channel states
/// are toxic, so it's important that whatever channel state is persisted is
/// kept up-to-date.
-pub trait Persist<ChannelSigner: Sign>: Send + Sync {
+pub trait Persist<ChannelSigner: Sign> {
/// Persist a new channel's data. The data can be stored any way you want, but
/// the identifier provided by Rust-Lightning is the channel's outpoint (and
/// it is up to you to maintain a correct mapping between the outpoint and the
}
}
+impl<Signer: Sign, T: Deref, F: Deref, L: Deref> chain::Confirm for (ChannelMonitor<Signer>, T, F, L)
+where
+ T::Target: BroadcasterInterface,
+ F::Target: FeeEstimator,
+ L::Target: Logger,
+{
+ fn transactions_confirmed(&self, header: &BlockHeader, txdata: &TransactionData, height: u32) {
+ self.0.transactions_confirmed(header, txdata, height, &*self.1, &*self.2, &*self.3);
+ }
+
+ fn transaction_unconfirmed(&self, txid: &Txid) {
+ self.0.transaction_unconfirmed(txid, &*self.1, &*self.2, &*self.3);
+ }
+
+ fn best_block_updated(&self, header: &BlockHeader, height: u32) {
+ self.0.best_block_updated(header, height, &*self.1, &*self.2, &*self.3);
+ }
+
+ fn get_relevant_txids(&self) -> Vec<Txid> {
+ self.0.get_relevant_txids()
+ }
+}
+
const MAX_ALLOC_SIZE: usize = 64*1024;
impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
}
}
- let _ver: u8 = Readable::read(reader)?;
- let min_ver: u8 = Readable::read(reader)?;
- if min_ver > SERIALIZATION_VERSION {
- return Err(DecodeError::UnknownVersion);
- }
+ let _ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
let latest_update_id: u64 = Readable::read(reader)?;
let commitment_transaction_number_obscure_factor = <U48 as Readable>::read(reader)?.0;
let best_block = BestBlock::new(Readable::read(reader)?, Readable::read(reader)?);
let waiting_threshold_conf_len: u64 = Readable::read(reader)?;
- let mut onchain_events_waiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
+ let mut onchain_events_awaiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
for _ in 0..waiting_threshold_conf_len {
let txid = Readable::read(reader)?;
let height = Readable::read(reader)?;
},
_ => return Err(DecodeError::InvalidValue),
};
- onchain_events_waiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
+ onchain_events_awaiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
}
let outputs_to_watch_len: u64 = Readable::read(reader)?;
let lockdown_from_offchain = Readable::read(reader)?;
let holder_tx_signed = Readable::read(reader)?;
+ read_tlv_fields!(reader, {}, {});
+
let mut secp_ctx = Secp256k1::new();
secp_ctx.seeded_randomize(&keys_manager.get_secure_random_bytes());
pending_monitor_events,
pending_events,
- onchain_events_waiting_threshold_conf,
+ onchain_events_awaiting_threshold_conf,
outputs_to_watch,
onchain_tx_handler,
use hex;
use chain::channelmonitor::ChannelMonitor;
use chain::transaction::OutPoint;
- use ln::channelmanager::{BestBlock, PaymentPreimage, PaymentHash};
+ use ln::{PaymentPreimage, PaymentHash};
+ use ln::channelmanager::BestBlock;
use ln::onchaintx::{OnchainTxHandler, InputDescriptors};
use ln::chan_utils;
use ln::chan_utils::{HTLCOutputInCommitment, ChannelPublicKeys, ChannelTransactionParameters, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters};