Skip to content

Commit d6c7d44

Browse files
Juhyung Parkmergify[bot]
authored andcommitted
Do not add already imported headers to the imported in the chain_notify's new_headers
Currently, we does not need this code because the verification queue always give ordered headers. However, following commits will call import_headers when blocks are verified. In this case, some headers are imported twice, so we should check whether the header is imported or not.
1 parent f1f315c commit d6c7d44

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/client/importer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ impl Importer {
396396
.block_header(&BlockId::Hash(*header.parent_hash()))
397397
.expect("Parent of importing header must exist")
398398
.decode();
399-
if self.check_header(&header, &parent_header) {
399+
if client.block_header(&BlockId::Hash(hash)).is_some() {
400+
// Do nothing if the header is already imported
401+
} else if self.check_header(&header, &parent_header) {
400402
imported.push(hash);
401403
routes.push(self.commit_header(&header, client));
402404
} else {

0 commit comments

Comments
 (0)