Skip to content

Commit 3778178

Browse files
committed
f use consistent variable names
1 parent 475bbfa commit 3778178

File tree

9 files changed

+35
-35
lines changed

9 files changed

+35
-35
lines changed

lightning-block-sync/src/init.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ impl<'a, L: chain::Listen + ?Sized> chain::Listen for DynamicChainListener<'a, L
231231
unreachable!()
232232
}
233233

234-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
235-
self.0.blocks_disconnected(new_best_block)
234+
fn blocks_disconnected(&self, fork_point: BestBlock) {
235+
self.0.blocks_disconnected(fork_point)
236236
}
237237
}
238238

@@ -258,7 +258,7 @@ impl<'a, L: chain::Listen + ?Sized> chain::Listen for ChainListenerSet<'a, L> {
258258
}
259259
}
260260

261-
fn blocks_disconnected(&self, _new_best_block: BestBlock) {
261+
fn blocks_disconnected(&self, _fork_point: BestBlock) {
262262
unreachable!()
263263
}
264264
}

lightning-block-sync/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ where
405405
}
406406
}
407407
if let Some(block) = disconnected_blocks.last() {
408-
let best_block = BestBlock::new(block.header.prev_blockhash, block.height - 1);
409-
self.chain_listener.blocks_disconnected(best_block);
408+
let fork_point = BestBlock::new(block.header.prev_blockhash, block.height - 1);
409+
self.chain_listener.blocks_disconnected(fork_point);
410410
}
411411
}
412412

lightning-block-sync/src/test_utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl chain::Listen for NullChainListener {
204204
&self, _header: &Header, _txdata: &chain::transaction::TransactionData, _height: u32,
205205
) {
206206
}
207-
fn blocks_disconnected(&self, _new_best_block: BestBlock) {}
207+
fn blocks_disconnected(&self, _fork_point: BestBlock) {}
208208
}
209209

210210
pub struct MockChainListener {
@@ -265,17 +265,17 @@ impl chain::Listen for MockChainListener {
265265
}
266266
}
267267

268-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
268+
fn blocks_disconnected(&self, fork_point: BestBlock) {
269269
match self.expected_blocks_disconnected.borrow_mut().pop_front() {
270270
None => {
271271
panic!(
272272
"Unexpected block(s) disconnected {} at height {}",
273-
new_best_block.block_hash, new_best_block.height,
273+
fork_point.block_hash, fork_point.height,
274274
);
275275
},
276276
Some(disconnected_block) => {
277-
assert_eq!(new_best_block.block_hash, disconnected_block.header.prev_blockhash);
278-
assert_eq!(new_best_block.height, disconnected_block.height - 1);
277+
assert_eq!(fork_point.block_hash, disconnected_block.header.prev_blockhash);
278+
assert_eq!(fork_point.height, disconnected_block.height - 1);
279279
},
280280
}
281281
}

lightning-liquidity/src/manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,9 @@ where
583583
self.best_block_updated(header, height);
584584
}
585585

586-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
586+
fn blocks_disconnected(&self, fork_point: BestBlock) {
587587
if let Some(best_block) = self.best_block.write().unwrap().as_mut() {
588-
*best_block = new_best_block;
588+
*best_block = fork_point;
589589
}
590590

591591
// TODO: Call block_disconnected on all sub-modules that require it, e.g., LSPS1MessageHandler.

lightning/src/chain/chainmonitor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,17 +929,17 @@ where
929929
self.event_notifier.notify();
930930
}
931931

932-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
932+
fn blocks_disconnected(&self, fork_point: BestBlock) {
933933
let monitor_states = self.monitors.read().unwrap();
934934
log_debug!(
935935
self.logger,
936936
"Block(s) removed to height {} via blocks_disconnected. New best block is {}",
937-
new_best_block.height,
938-
new_best_block.block_hash,
937+
fork_point.height,
938+
fork_point.block_hash,
939939
);
940940
for monitor_state in monitor_states.values() {
941941
monitor_state.monitor.blocks_disconnected(
942-
new_best_block,
942+
fork_point,
943943
&*self.broadcaster,
944944
&*self.fee_estimator,
945945
&self.logger,

lightning/src/chain/channelmonitor.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,15 +2176,15 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
21762176
/// Determines if the disconnected block contained any transactions of interest and updates
21772177
/// appropriately.
21782178
pub fn blocks_disconnected<B: Deref, F: Deref, L: Deref>(
2179-
&self, new_best_block: BestBlock, broadcaster: B, fee_estimator: F, logger: &L,
2179+
&self, fork_point: BestBlock, broadcaster: B, fee_estimator: F, logger: &L,
21802180
) where
21812181
B::Target: BroadcasterInterface,
21822182
F::Target: FeeEstimator,
21832183
L::Target: Logger,
21842184
{
21852185
let mut inner = self.inner.lock().unwrap();
21862186
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
2187-
inner.blocks_disconnected(new_best_block, broadcaster, fee_estimator, &logger)
2187+
inner.blocks_disconnected(fork_point, broadcaster, fee_estimator, &logger)
21882188
}
21892189

21902190
/// Processes transactions confirmed in a block with the given header and height, returning new
@@ -5112,12 +5112,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
51125112

51135113
#[rustfmt::skip]
51145114
fn blocks_disconnected<B: Deref, F: Deref, L: Deref>(
5115-
&mut self, new_best_block: BestBlock, broadcaster: B, fee_estimator: F, logger: &WithChannelMonitor<L>
5115+
&mut self, fork_point: BestBlock, broadcaster: B, fee_estimator: F, logger: &WithChannelMonitor<L>
51165116
) where B::Target: BroadcasterInterface,
51175117
F::Target: FeeEstimator,
51185118
L::Target: Logger,
51195119
{
5120-
let new_height = new_best_block.height;
5120+
let new_height = fork_point.height;
51215121
log_trace!(logger, "Block(s) disconnected to height {}", new_height);
51225122

51235123
//We may discard:
@@ -5131,7 +5131,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
51315131
new_height + 1, broadcaster, conf_target, &self.destination_script, &bounded_fee_estimator, logger
51325132
);
51335133

5134-
self.best_block = new_best_block;
5134+
self.best_block = fork_point;
51355135
}
51365136

51375137
#[rustfmt::skip]
@@ -5576,8 +5576,8 @@ where
55765576
self.0.block_connected(header, txdata, height, &*self.1, &*self.2, &self.3);
55775577
}
55785578

5579-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
5580-
self.0.blocks_disconnected(new_best_block, &*self.1, &*self.2, &self.3);
5579+
fn blocks_disconnected(&self, fork_point: BestBlock) {
5580+
self.0.blocks_disconnected(fork_point, &*self.1, &*self.2, &self.3);
55815581
}
55825582
}
55835583

lightning/src/chain/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ impl<T: Listen> Listen for dyn core::ops::Deref<Target = T> {
398398
(**self).filtered_block_connected(header, txdata, height);
399399
}
400400

401-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
402-
(**self).blocks_disconnected(new_best_block);
401+
fn blocks_disconnected(&self, fork_point: BestBlock) {
402+
(**self).blocks_disconnected(fork_point);
403403
}
404404
}
405405

@@ -413,9 +413,9 @@ where
413413
self.1.filtered_block_connected(header, txdata, height);
414414
}
415415

416-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
417-
self.0.blocks_disconnected(new_best_block);
418-
self.1.blocks_disconnected(new_best_block);
416+
fn blocks_disconnected(&self, fork_point: BestBlock) {
417+
self.0.blocks_disconnected(fork_point);
418+
self.1.blocks_disconnected(fork_point);
419419
}
420420
}
421421

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12543,20 +12543,20 @@ where
1254312543
self.best_block_updated(header, height);
1254412544
}
1254512545

12546-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
12546+
fn blocks_disconnected(&self, fork_point: BestBlock) {
1254712547
let _persistence_guard =
1254812548
PersistenceNotifierGuard::optionally_notify_skipping_background_events(
1254912549
self,
1255012550
|| -> NotifyOption { NotifyOption::DoPersist },
1255112551
);
1255212552
{
1255312553
let mut best_block = self.best_block.write().unwrap();
12554-
*best_block = new_best_block;
12554+
*best_block = fork_point;
1255512555
}
1255612556

12557-
self.do_chain_event(Some(new_best_block.height), |channel| {
12557+
self.do_chain_event(Some(fork_point.height), |channel| {
1255812558
channel.best_block_updated(
12559-
new_best_block.height,
12559+
fork_point.height,
1256012560
0,
1256112561
self.chain_hash,
1256212562
&self.node_signer,

lightning/src/util/sweep.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,13 +691,13 @@ where
691691
self.best_block_updated_internal(&mut state_lock, header, height);
692692
}
693693

694-
fn blocks_disconnected(&self, new_best_block: BestBlock) {
694+
fn blocks_disconnected(&self, fork_point: BestBlock) {
695695
let mut state_lock = self.sweeper_state.lock().unwrap();
696696

697-
state_lock.best_block = new_best_block;
697+
state_lock.best_block = fork_point;
698698

699699
for output_info in state_lock.outputs.iter_mut() {
700-
if output_info.status.confirmation_height() > Some(new_best_block.height) {
700+
if output_info.status.confirmation_height() > Some(fork_point.height) {
701701
output_info.status.unconfirmed();
702702
}
703703
}

0 commit comments

Comments
 (0)