Skip to content

Commit d908ed0

Browse files
committed
Rename onchain_events_waiting_threshold_conf
1 parent b33d92f commit d908ed0

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ pub(crate) struct ChannelMonitorImpl<Signer: Sign> {
708708
// Used to track on-chain events (i.e., transactions part of channels confirmed on chain) on
709709
// which to take actions once they reach enough confirmations. Each entry includes the
710710
// transaction's id and the height when the transaction was confirmed on chain.
711-
onchain_events_waiting_threshold_conf: Vec<OnchainEventEntry>,
711+
onchain_events_awaiting_threshold_conf: Vec<OnchainEventEntry>,
712712

713713
// If we get serialized out and re-read, we need to make sure that the chain monitoring
714714
// interface knows about the TXOs that we want to be notified of spends of. We could probably
@@ -790,7 +790,7 @@ impl<Signer: Sign> PartialEq for ChannelMonitorImpl<Signer> {
790790
self.payment_preimages != other.payment_preimages ||
791791
self.pending_monitor_events != other.pending_monitor_events ||
792792
self.pending_events.len() != other.pending_events.len() || // We trust events to round-trip properly
793-
self.onchain_events_waiting_threshold_conf != other.onchain_events_waiting_threshold_conf ||
793+
self.onchain_events_awaiting_threshold_conf != other.onchain_events_awaiting_threshold_conf ||
794794
self.outputs_to_watch != other.outputs_to_watch ||
795795
self.lockdown_from_offchain != other.lockdown_from_offchain ||
796796
self.holder_tx_signed != other.holder_tx_signed
@@ -959,8 +959,8 @@ impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
959959
self.best_block.block_hash().write(writer)?;
960960
writer.write_all(&byte_utils::be32_to_array(self.best_block.height()))?;
961961

962-
writer.write_all(&byte_utils::be64_to_array(self.onchain_events_waiting_threshold_conf.len() as u64))?;
963-
for ref entry in self.onchain_events_waiting_threshold_conf.iter() {
962+
writer.write_all(&byte_utils::be64_to_array(self.onchain_events_awaiting_threshold_conf.len() as u64))?;
963+
for ref entry in self.onchain_events_awaiting_threshold_conf.iter() {
964964
entry.txid.write(writer)?;
965965
writer.write_all(&byte_utils::be32_to_array(entry.height))?;
966966
match entry.event {
@@ -1080,7 +1080,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
10801080
pending_monitor_events: Vec::new(),
10811081
pending_events: Vec::new(),
10821082

1083-
onchain_events_waiting_threshold_conf: Vec::new(),
1083+
onchain_events_awaiting_threshold_conf: Vec::new(),
10841084
outputs_to_watch,
10851085

10861086
onchain_tx_handler,
@@ -1393,7 +1393,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
13931393
/// re-organization out of the chain.
13941394
pub fn get_relevant_txids(&self) -> Vec<Txid> {
13951395
let inner = self.inner.lock().unwrap();
1396-
let mut txids: Vec<Txid> = inner.onchain_events_waiting_threshold_conf
1396+
let mut txids: Vec<Txid> = inner.onchain_events_awaiting_threshold_conf
13971397
.iter()
13981398
.map(|entry| entry.txid)
13991399
.chain(inner.onchain_tx_handler.get_relevant_txids().into_iter())
@@ -1760,7 +1760,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17601760
if let Some(ref outpoints) = self.counterparty_claimable_outpoints.get($txid) {
17611761
for &(ref htlc, ref source_option) in outpoints.iter() {
17621762
if let &Some(ref source) = source_option {
1763-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
1763+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
17641764
if entry.height != height { return true; }
17651765
match entry.event {
17661766
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -1777,7 +1777,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17771777
},
17781778
};
17791779
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());
1780-
self.onchain_events_waiting_threshold_conf.push(entry);
1780+
self.onchain_events_awaiting_threshold_conf.push(entry);
17811781
}
17821782
}
17831783
}
@@ -1826,7 +1826,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
18261826
}
18271827
}
18281828
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);
1829-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
1829+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
18301830
if entry.height != height { return true; }
18311831
match entry.event {
18321832
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -1835,7 +1835,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
18351835
_ => true,
18361836
}
18371837
});
1838-
self.onchain_events_waiting_threshold_conf.push(OnchainEventEntry {
1838+
self.onchain_events_awaiting_threshold_conf.push(OnchainEventEntry {
18391839
txid: *$txid,
18401840
height,
18411841
event: OnchainEvent::HTLCUpdate {
@@ -1982,7 +1982,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19821982

19831983
macro_rules! wait_threshold_conf {
19841984
($source: expr, $commitment_tx: expr, $payment_hash: expr) => {
1985-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
1985+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
19861986
if entry.height != height { return true; }
19871987
match entry.event {
19881988
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -1997,7 +1997,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19971997
event: OnchainEvent::HTLCUpdate { htlc_update: ($source, $payment_hash) },
19981998
};
19991999
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());
2000-
self.onchain_events_waiting_threshold_conf.push(entry);
2000+
self.onchain_events_awaiting_threshold_conf.push(entry);
20012001
}
20022002
}
20032003

@@ -2131,7 +2131,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
21312131
self.block_confirmed(height, vec![], vec![], vec![], broadcaster, fee_estimator, logger)
21322132
} else {
21332133
self.best_block = BestBlock::new(block_hash, height);
2134-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.height <= height);
2134+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height <= height);
21352135
self.onchain_tx_handler.block_disconnected(height + 1, broadcaster, fee_estimator, logger);
21362136
Vec::new()
21372137
}
@@ -2239,20 +2239,20 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
22392239
}
22402240

22412241
// Find which on-chain events have reached their confirmation threshold.
2242-
let onchain_events_waiting_threshold_conf =
2243-
self.onchain_events_waiting_threshold_conf.drain(..).collect::<Vec<_>>();
2242+
let onchain_events_awaiting_threshold_conf =
2243+
self.onchain_events_awaiting_threshold_conf.drain(..).collect::<Vec<_>>();
22442244
let mut onchain_events_reaching_threshold_conf = Vec::new();
2245-
for entry in onchain_events_waiting_threshold_conf {
2245+
for entry in onchain_events_awaiting_threshold_conf {
22462246
if entry.has_reached_confirmation_threshold(height) {
22472247
onchain_events_reaching_threshold_conf.push(entry);
22482248
} else {
2249-
self.onchain_events_waiting_threshold_conf.push(entry);
2249+
self.onchain_events_awaiting_threshold_conf.push(entry);
22502250
}
22512251
}
22522252

22532253
// Used to check for duplicate HTLC resolutions.
22542254
#[cfg(debug_assertions)]
2255-
let unconfirmed_htlcs: Vec<_> = self.onchain_events_waiting_threshold_conf
2255+
let unconfirmed_htlcs: Vec<_> = self.onchain_events_awaiting_threshold_conf
22562256
.iter()
22572257
.filter_map(|entry| match &entry.event {
22582258
OnchainEvent::HTLCUpdate { htlc_update } => Some(htlc_update.0.clone()),
@@ -2323,7 +2323,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
23232323
//We may discard:
23242324
//- htlc update there as failure-trigger tx (revoked commitment tx, non-revoked commitment tx, HTLC-timeout tx) has been disconnected
23252325
//- maturing spendable output has transaction paying us has been disconnected
2326-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.height < height);
2326+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height < height);
23272327

23282328
self.onchain_tx_handler.block_disconnected(height, broadcaster, fee_estimator, logger);
23292329

@@ -2341,7 +2341,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
23412341
F::Target: FeeEstimator,
23422342
L::Target: Logger,
23432343
{
2344-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.txid != *txid);
2344+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.txid != *txid);
23452345
self.onchain_tx_handler.transaction_unconfirmed(txid, broadcaster, fee_estimator, logger);
23462346
}
23472347

@@ -2570,7 +2570,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
25702570
}));
25712571
}
25722572
} else {
2573-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
2573+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
25742574
if entry.height != height { return true; }
25752575
match entry.event {
25762576
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -2585,7 +2585,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
25852585
event: OnchainEvent::HTLCUpdate { htlc_update: (source, payment_hash) },
25862586
};
25872587
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());
2588-
self.onchain_events_waiting_threshold_conf.push(entry);
2588+
self.onchain_events_awaiting_threshold_conf.push(entry);
25892589
}
25902590
}
25912591
}
@@ -2650,7 +2650,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
26502650
event: OnchainEvent::MaturingOutput { descriptor: spendable_output.clone() },
26512651
};
26522652
log_trace!(logger, "Maturing {} until {}", log_spendable!(spendable_output), entry.confirmation_threshold());
2653-
self.onchain_events_waiting_threshold_conf.push(entry);
2653+
self.onchain_events_awaiting_threshold_conf.push(entry);
26542654
}
26552655
}
26562656
}
@@ -2916,7 +2916,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
29162916
let best_block = BestBlock::new(Readable::read(reader)?, Readable::read(reader)?);
29172917

29182918
let waiting_threshold_conf_len: u64 = Readable::read(reader)?;
2919-
let mut onchain_events_waiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
2919+
let mut onchain_events_awaiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
29202920
for _ in 0..waiting_threshold_conf_len {
29212921
let txid = Readable::read(reader)?;
29222922
let height = Readable::read(reader)?;
@@ -2936,7 +2936,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
29362936
},
29372937
_ => return Err(DecodeError::InvalidValue),
29382938
};
2939-
onchain_events_waiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
2939+
onchain_events_awaiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
29402940
}
29412941

29422942
let outputs_to_watch_len: u64 = Readable::read(reader)?;
@@ -2997,7 +2997,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
29972997
pending_monitor_events,
29982998
pending_events,
29992999

3000-
onchain_events_waiting_threshold_conf,
3000+
onchain_events_awaiting_threshold_conf,
30013001
outputs_to_watch,
30023002

30033003
onchain_tx_handler,

lightning/src/ln/onchaintx.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub struct OnchainTxHandler<ChannelSigner: Sign> {
301301
#[cfg(not(test))]
302302
claimable_outpoints: HashMap<BitcoinOutPoint, (Txid, u32)>,
303303

304-
onchain_events_waiting_threshold_conf: Vec<OnchainEventEntry>,
304+
onchain_events_awaiting_threshold_conf: Vec<OnchainEventEntry>,
305305

306306
latest_height: u32,
307307

@@ -338,8 +338,8 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
338338
claim_and_height.1.write(writer)?;
339339
}
340340

341-
writer.write_all(&byte_utils::be64_to_array(self.onchain_events_waiting_threshold_conf.len() as u64))?;
342-
for ref entry in self.onchain_events_waiting_threshold_conf.iter() {
341+
writer.write_all(&byte_utils::be64_to_array(self.onchain_events_awaiting_threshold_conf.len() as u64))?;
342+
for ref entry in self.onchain_events_awaiting_threshold_conf.iter() {
343343
entry.txid.write(writer)?;
344344
writer.write_all(&byte_utils::be32_to_array(entry.height))?;
345345
match entry.event {
@@ -396,7 +396,7 @@ impl<'a, K: KeysInterface> ReadableArgs<&'a K> for OnchainTxHandler<K::Signer> {
396396
claimable_outpoints.insert(outpoint, (ancestor_claim_txid, height));
397397
}
398398
let waiting_threshold_conf_len: u64 = Readable::read(reader)?;
399-
let mut onchain_events_waiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
399+
let mut onchain_events_awaiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
400400
for _ in 0..waiting_threshold_conf_len {
401401
let txid = Readable::read(reader)?;
402402
let height = Readable::read(reader)?;
@@ -417,7 +417,7 @@ impl<'a, K: KeysInterface> ReadableArgs<&'a K> for OnchainTxHandler<K::Signer> {
417417
}
418418
_ => return Err(DecodeError::InvalidValue),
419419
};
420-
onchain_events_waiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
420+
onchain_events_awaiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
421421
}
422422
let latest_height = Readable::read(reader)?;
423423

@@ -434,7 +434,7 @@ impl<'a, K: KeysInterface> ReadableArgs<&'a K> for OnchainTxHandler<K::Signer> {
434434
channel_transaction_parameters: channel_parameters,
435435
claimable_outpoints,
436436
pending_claim_requests,
437-
onchain_events_waiting_threshold_conf,
437+
onchain_events_awaiting_threshold_conf,
438438
latest_height,
439439
secp_ctx,
440440
})
@@ -453,7 +453,7 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
453453
channel_transaction_parameters: channel_parameters,
454454
pending_claim_requests: HashMap::new(),
455455
claimable_outpoints: HashMap::new(),
456-
onchain_events_waiting_threshold_conf: Vec::new(),
456+
onchain_events_awaiting_threshold_conf: Vec::new(),
457457
latest_height: 0,
458458

459459
secp_ctx,
@@ -776,8 +776,8 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
776776
height,
777777
event: OnchainEvent::Claim { claim_request: first_claim_txid_height.0.clone() }
778778
};
779-
if !self.onchain_events_waiting_threshold_conf.contains(&entry) {
780-
self.onchain_events_waiting_threshold_conf.push(entry);
779+
if !self.onchain_events_awaiting_threshold_conf.contains(&entry) {
780+
self.onchain_events_awaiting_threshold_conf.push(entry);
781781
}
782782
}
783783
}
@@ -816,16 +816,16 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
816816
height,
817817
event: OnchainEvent::ContentiousOutpoint { outpoint, input_material },
818818
};
819-
if !self.onchain_events_waiting_threshold_conf.contains(&entry) {
820-
self.onchain_events_waiting_threshold_conf.push(entry);
819+
if !self.onchain_events_awaiting_threshold_conf.contains(&entry) {
820+
self.onchain_events_awaiting_threshold_conf.push(entry);
821821
}
822822
}
823823
}
824824

825825
// After security delay, either our claim tx got enough confs or outpoint is definetely out of reach
826-
let onchain_events_waiting_threshold_conf =
827-
self.onchain_events_waiting_threshold_conf.drain(..).collect::<Vec<_>>();
828-
for entry in onchain_events_waiting_threshold_conf {
826+
let onchain_events_awaiting_threshold_conf =
827+
self.onchain_events_awaiting_threshold_conf.drain(..).collect::<Vec<_>>();
828+
for entry in onchain_events_awaiting_threshold_conf {
829829
if entry.has_reached_confirmation_threshold(height) {
830830
match entry.event {
831831
OnchainEvent::Claim { claim_request } => {
@@ -842,7 +842,7 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
842842
}
843843
}
844844
} else {
845-
self.onchain_events_waiting_threshold_conf.push(entry);
845+
self.onchain_events_awaiting_threshold_conf.push(entry);
846846
}
847847
}
848848

@@ -881,7 +881,7 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
881881
L::Target: Logger,
882882
{
883883
let mut height = None;
884-
for entry in self.onchain_events_waiting_threshold_conf.iter() {
884+
for entry in self.onchain_events_awaiting_threshold_conf.iter() {
885885
if entry.txid == *txid {
886886
height = Some(entry.height);
887887
break;
@@ -899,9 +899,9 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
899899
L::Target: Logger,
900900
{
901901
let mut bump_candidates = HashMap::new();
902-
let onchain_events_waiting_threshold_conf =
903-
self.onchain_events_waiting_threshold_conf.drain(..).collect::<Vec<_>>();
904-
for entry in onchain_events_waiting_threshold_conf {
902+
let onchain_events_awaiting_threshold_conf =
903+
self.onchain_events_awaiting_threshold_conf.drain(..).collect::<Vec<_>>();
904+
for entry in onchain_events_awaiting_threshold_conf {
905905
if entry.height >= height {
906906
//- our claim tx on a commitment tx output
907907
//- resurect outpoint back in its claimable set and regenerate tx
@@ -919,7 +919,7 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
919919
_ => {},
920920
}
921921
} else {
922-
self.onchain_events_waiting_threshold_conf.push(entry);
922+
self.onchain_events_awaiting_threshold_conf.push(entry);
923923
}
924924
}
925925
for (_, claim_material) in bump_candidates.iter_mut() {
@@ -946,7 +946,7 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
946946
}
947947

948948
pub(crate) fn get_relevant_txids(&self) -> Vec<Txid> {
949-
let mut txids: Vec<Txid> = self.onchain_events_waiting_threshold_conf
949+
let mut txids: Vec<Txid> = self.onchain_events_awaiting_threshold_conf
950950
.iter()
951951
.map(|entry| entry.txid)
952952
.collect();

0 commit comments

Comments
 (0)