chore(db): remove block numhash key (#1242)

This commit is contained in:
Roman Krasiuk
2023-02-10 23:43:00 +02:00
committed by GitHub
parent 23848df73a
commit 00a49f5ee7
20 changed files with 175 additions and 271 deletions

View File

@@ -134,7 +134,7 @@ where
.ok_or(DownloadError::MissingHeader { block_number: current_block_num })?;
// Find the block header.
let (_, header) = header_cursor
.seek_exact((number, hash).into())?
.seek_exact(number)?
.ok_or(DownloadError::MissingHeader { block_number: number })?;
// If the header is not empty, increment the counter

View File

@@ -50,7 +50,7 @@ pub(crate) fn insert_headers(db: &Env<WriteMap>, headers: &[SealedHeader]) {
db.update(|tx| -> Result<(), db::Error> {
for header in headers {
tx.put::<tables::CanonicalHeaders>(header.number, header.hash())?;
tx.put::<tables::Headers>(header.num_hash().into(), header.clone().unseal())?;
tx.put::<tables::Headers>(header.number, header.clone().unseal())?;
}
Ok(())
})