Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit dd1460d

Browse files
andresilvaDemi-Marie
authored andcommitted
grandpa: add identifier to UntilImported logging message (#3735)
* grandpa: add identifier to UntilImported logging * grandpa: fix tests
1 parent a61b592 commit dd1460d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

core/finality-grandpa/src/environment.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ where
587587
self.inner.import_notification_stream(),
588588
self.inner.clone(),
589589
incoming,
590+
"round",
590591
).map_err(Into::into));
591592

592593
// schedule network message cleanup when sink drops.

core/finality-grandpa/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ fn global_communication<Block: BlockT<Hash=H256>, B, E, N, RA>(
427427
client.import_notification_stream(),
428428
client.clone(),
429429
global_in,
430+
"global",
430431
);
431432

432433
let global_in = global_in.map_err(CommandOrError::from);

core/finality-grandpa/src/until_imported.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ pub(crate) struct UntilImported<Block: BlockT, Status, I, M: BlockUntilImported<
7171
ready: VecDeque<M::Blocked>,
7272
check_pending: Interval,
7373
pending: HashMap<Block::Hash, (Instant, Vec<M>)>,
74+
identifier: &'static str,
7475
}
7576

7677
impl<Block: BlockT, Status, I: Stream, M> UntilImported<Block, Status, I, M>
@@ -81,6 +82,7 @@ impl<Block: BlockT, Status, I: Stream, M> UntilImported<Block, Status, I, M>
8182
import_notifications: ImportNotifications<Block>,
8283
status_check: Status,
8384
stream: I,
85+
identifier: &'static str,
8486
) -> Self {
8587
// how often to check if pending messages that are waiting for blocks to be
8688
// imported can be checked.
@@ -101,6 +103,7 @@ impl<Block: BlockT, Status, I: Stream, M> UntilImported<Block, Status, I, M>
101103
ready: VecDeque::new(),
102104
check_pending,
103105
pending: HashMap::new(),
106+
identifier,
104107
}
105108
}
106109
}
@@ -170,8 +173,9 @@ impl<Block: BlockT, Status, I, M> Stream for UntilImported<Block, Status, I, M>
170173
if Instant::now() <= next_log {
171174
debug!(
172175
target: "afg",
173-
"Waiting to import block {} before {} votes can be imported. \
176+
"Waiting to import block {} before {} {} messages can be imported. \
174177
Possible fork?",
178+
self.identifier,
175179
block_hash,
176180
v.len(),
177181
);
@@ -533,6 +537,7 @@ mod tests {
533537
import_notifications,
534538
block_status,
535539
global_rx.map_err(|_| panic!("should never error")),
540+
"global",
536541
);
537542

538543
global_tx.unbounded_send(msg).unwrap();
@@ -558,6 +563,7 @@ mod tests {
558563
import_notifications,
559564
block_status,
560565
global_rx.map_err(|_| panic!("should never error")),
566+
"global",
561567
);
562568

563569
global_tx.unbounded_send(msg).unwrap();

0 commit comments

Comments
 (0)