Skip to content

Commit 524c532

Browse files
committed
Rename onchain_events_waiting_threshold_conf
1 parent 5e8b683 commit 524c532

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,
@@ -1392,7 +1392,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
13921392
/// Returns the set of txids that should be monitored for re-organization out of the chain.
13931393
pub fn get_relevant_txids(&self) -> Vec<Txid> {
13941394
let inner = self.inner.lock().unwrap();
1395-
let mut txids: Vec<Txid> = inner.onchain_events_waiting_threshold_conf
1395+
let mut txids: Vec<Txid> = inner.onchain_events_awaiting_threshold_conf
13961396
.iter()
13971397
.map(|entry| entry.txid)
13981398
.chain(inner.onchain_tx_handler.get_relevant_txids().into_iter())
@@ -1759,7 +1759,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17591759
if let Some(ref outpoints) = self.counterparty_claimable_outpoints.get($txid) {
17601760
for &(ref htlc, ref source_option) in outpoints.iter() {
17611761
if let &Some(ref source) = source_option {
1762-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
1762+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
17631763
if entry.height != height { return true; }
17641764
match entry.event {
17651765
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -1776,7 +1776,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17761776
},
17771777
};
17781778
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());
1779-
self.onchain_events_waiting_threshold_conf.push(entry);
1779+
self.onchain_events_awaiting_threshold_conf.push(entry);
17801780
}
17811781
}
17821782
}
@@ -1825,7 +1825,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
18251825
}
18261826
}
18271827
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);
1828-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
1828+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
18291829
if entry.height != height { return true; }
18301830
match entry.event {
18311831
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -1834,7 +1834,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
18341834
_ => true,
18351835
}
18361836
});
1837-
self.onchain_events_waiting_threshold_conf.push(OnchainEventEntry {
1837+
self.onchain_events_awaiting_threshold_conf.push(OnchainEventEntry {
18381838
txid: *$txid,
18391839
height,
18401840
event: OnchainEvent::HTLCUpdate {
@@ -1981,7 +1981,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19811981

19821982
macro_rules! wait_threshold_conf {
19831983
($source: expr, $commitment_tx: expr, $payment_hash: expr) => {
1984-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
1984+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
19851985
if entry.height != height { return true; }
19861986
match entry.event {
19871987
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -1996,7 +1996,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19961996
event: OnchainEvent::HTLCUpdate { htlc_update: ($source, $payment_hash) },
19971997
};
19981998
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());
1999-
self.onchain_events_waiting_threshold_conf.push(entry);
1999+
self.onchain_events_awaiting_threshold_conf.push(entry);
20002000
}
20012001
}
20022002

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

22402240
// Find which on-chain events have reached their confirmation threshold.
2241-
let onchain_events_waiting_threshold_conf =
2242-
self.onchain_events_waiting_threshold_conf.drain(..).collect::<Vec<_>>();
2241+
let onchain_events_awaiting_threshold_conf =
2242+
self.onchain_events_awaiting_threshold_conf.drain(..).collect::<Vec<_>>();
22432243
let mut onchain_events_reaching_threshold_conf = Vec::new();
2244-
for entry in onchain_events_waiting_threshold_conf {
2244+
for entry in onchain_events_awaiting_threshold_conf {
22452245
if entry.has_reached_confirmation_threshold(height) {
22462246
onchain_events_reaching_threshold_conf.push(entry);
22472247
} else {
2248-
self.onchain_events_waiting_threshold_conf.push(entry);
2248+
self.onchain_events_awaiting_threshold_conf.push(entry);
22492249
}
22502250
}
22512251

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

23372337
self.onchain_tx_handler.block_disconnected(height, broadcaster, fee_estimator, logger);
23382338

@@ -2350,7 +2350,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
23502350
F::Target: FeeEstimator,
23512351
L::Target: Logger,
23522352
{
2353-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| entry.txid != *txid);
2353+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.txid != *txid);
23542354
self.onchain_tx_handler.transaction_unconfirmed(txid, broadcaster, fee_estimator, logger);
23552355
}
23562356

@@ -2579,7 +2579,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
25792579
}));
25802580
}
25812581
} else {
2582-
self.onchain_events_waiting_threshold_conf.retain(|ref entry| {
2582+
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
25832583
if entry.height != height { return true; }
25842584
match entry.event {
25852585
OnchainEvent::HTLCUpdate { ref htlc_update } => {
@@ -2594,7 +2594,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
25942594
event: OnchainEvent::HTLCUpdate { htlc_update: (source, payment_hash) },
25952595
};
25962596
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());
2597-
self.onchain_events_waiting_threshold_conf.push(entry);
2597+
self.onchain_events_awaiting_threshold_conf.push(entry);
25982598
}
25992599
}
26002600
}
@@ -2659,7 +2659,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
26592659
event: OnchainEvent::MaturingOutput { descriptor: spendable_output.clone() },
26602660
};
26612661
log_trace!(logger, "Maturing {} until {}", log_spendable!(spendable_output), entry.confirmation_threshold());
2662-
self.onchain_events_waiting_threshold_conf.push(entry);
2662+
self.onchain_events_awaiting_threshold_conf.push(entry);
26632663
}
26642664
}
26652665
}
@@ -2925,7 +2925,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
29252925
let best_block = BestBlock::new(Readable::read(reader)?, Readable::read(reader)?);
29262926

29272927
let waiting_threshold_conf_len: u64 = Readable::read(reader)?;
2928-
let mut onchain_events_waiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
2928+
let mut onchain_events_awaiting_threshold_conf = Vec::with_capacity(cmp::min(waiting_threshold_conf_len as usize, MAX_ALLOC_SIZE / 128));
29292929
for _ in 0..waiting_threshold_conf_len {
29302930
let txid = Readable::read(reader)?;
29312931
let height = Readable::read(reader)?;
@@ -2945,7 +2945,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
29452945
},
29462946
_ => return Err(DecodeError::InvalidValue),
29472947
};
2948-
onchain_events_waiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
2948+
onchain_events_awaiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
29492949
}
29502950

29512951
let outputs_to_watch_len: u64 = Readable::read(reader)?;
@@ -3006,7 +3006,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
30063006
pending_monitor_events,
30073007
pending_events,
30083008

3009-
onchain_events_waiting_threshold_conf,
3009+
onchain_events_awaiting_threshold_conf,
30103010
outputs_to_watch,
30113011

30123012
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)