mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +00:00
Remove unused finalization_displaced variable in db (#13090)
This commit is contained in:
@@ -1291,14 +1291,13 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
header: &Block::Header,
|
header: &Block::Header,
|
||||||
last_finalized: Option<Block::Hash>,
|
last_finalized: Option<Block::Hash>,
|
||||||
justification: Option<Justification>,
|
justification: Option<Justification>,
|
||||||
finalization_displaced: &mut Option<FinalizationOutcome<Block::Hash, NumberFor<Block>>>,
|
|
||||||
) -> ClientResult<MetaUpdate<Block>> {
|
) -> ClientResult<MetaUpdate<Block>> {
|
||||||
// TODO: ensure best chain contains this block.
|
// TODO: ensure best chain contains this block.
|
||||||
let number = *header.number();
|
let number = *header.number();
|
||||||
self.ensure_sequential_finalization(header, last_finalized)?;
|
self.ensure_sequential_finalization(header, last_finalized)?;
|
||||||
let with_state = sc_client_api::Backend::have_state_at(self, hash, number);
|
let with_state = sc_client_api::Backend::have_state_at(self, hash, number);
|
||||||
|
|
||||||
self.note_finalized(transaction, header, hash, finalization_displaced, with_state)?;
|
self.note_finalized(transaction, header, hash, with_state)?;
|
||||||
|
|
||||||
if let Some(justification) = justification {
|
if let Some(justification) = justification {
|
||||||
transaction.set_from_vec(
|
transaction.set_from_vec(
|
||||||
@@ -1362,7 +1361,6 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
|
|
||||||
fn try_commit_operation(&self, mut operation: BlockImportOperation<Block>) -> ClientResult<()> {
|
fn try_commit_operation(&self, mut operation: BlockImportOperation<Block>) -> ClientResult<()> {
|
||||||
let mut transaction = Transaction::new();
|
let mut transaction = Transaction::new();
|
||||||
let mut finalization_displaced_leaves = None;
|
|
||||||
|
|
||||||
operation.apply_aux(&mut transaction);
|
operation.apply_aux(&mut transaction);
|
||||||
operation.apply_offchain(&mut transaction);
|
operation.apply_offchain(&mut transaction);
|
||||||
@@ -1381,7 +1379,6 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
&block_header,
|
&block_header,
|
||||||
Some(last_finalized_hash),
|
Some(last_finalized_hash),
|
||||||
justification,
|
justification,
|
||||||
&mut finalization_displaced_leaves,
|
|
||||||
)?);
|
)?);
|
||||||
last_finalized_hash = block_hash;
|
last_finalized_hash = block_hash;
|
||||||
last_finalized_num = *block_header.number();
|
last_finalized_num = *block_header.number();
|
||||||
@@ -1554,13 +1551,7 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
if finalized {
|
if finalized {
|
||||||
// TODO: ensure best chain contains this block.
|
// TODO: ensure best chain contains this block.
|
||||||
self.ensure_sequential_finalization(header, Some(last_finalized_hash))?;
|
self.ensure_sequential_finalization(header, Some(last_finalized_hash))?;
|
||||||
self.note_finalized(
|
self.note_finalized(&mut transaction, header, hash, operation.commit_state)?;
|
||||||
&mut transaction,
|
|
||||||
header,
|
|
||||||
hash,
|
|
||||||
&mut finalization_displaced_leaves,
|
|
||||||
operation.commit_state,
|
|
||||||
)?;
|
|
||||||
} else {
|
} else {
|
||||||
// canonicalize blocks which are old enough, regardless of finality.
|
// canonicalize blocks which are old enough, regardless of finality.
|
||||||
self.force_delayed_canonicalize(&mut transaction)?
|
self.force_delayed_canonicalize(&mut transaction)?
|
||||||
@@ -1692,7 +1683,6 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
transaction: &mut Transaction<DbHash>,
|
transaction: &mut Transaction<DbHash>,
|
||||||
f_header: &Block::Header,
|
f_header: &Block::Header,
|
||||||
f_hash: Block::Hash,
|
f_hash: Block::Hash,
|
||||||
displaced: &mut Option<FinalizationOutcome<Block::Hash, NumberFor<Block>>>,
|
|
||||||
with_state: bool,
|
with_state: bool,
|
||||||
) -> ClientResult<()> {
|
) -> ClientResult<()> {
|
||||||
let f_num = *f_header.number();
|
let f_num = *f_header.number();
|
||||||
@@ -1720,10 +1710,6 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
|
|
||||||
let new_displaced = self.blockchain.leaves.write().finalize_height(f_num);
|
let new_displaced = self.blockchain.leaves.write().finalize_height(f_num);
|
||||||
self.prune_blocks(transaction, f_num, &new_displaced)?;
|
self.prune_blocks(transaction, f_num, &new_displaced)?;
|
||||||
match displaced {
|
|
||||||
x @ &mut None => *x = Some(new_displaced),
|
|
||||||
&mut Some(ref mut displaced) => displaced.merge(new_displaced),
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -2013,7 +1999,6 @@ impl<Block: BlockT> sc_client_api::backend::Backend<Block> for Backend<Block> {
|
|||||||
) -> ClientResult<()> {
|
) -> ClientResult<()> {
|
||||||
let mut transaction = Transaction::new();
|
let mut transaction = Transaction::new();
|
||||||
let header = self.blockchain.expect_header(hash)?;
|
let header = self.blockchain.expect_header(hash)?;
|
||||||
let mut displaced = None;
|
|
||||||
|
|
||||||
let m = self.finalize_block_with_transaction(
|
let m = self.finalize_block_with_transaction(
|
||||||
&mut transaction,
|
&mut transaction,
|
||||||
@@ -2021,8 +2006,8 @@ impl<Block: BlockT> sc_client_api::backend::Backend<Block> for Backend<Block> {
|
|||||||
&header,
|
&header,
|
||||||
None,
|
None,
|
||||||
justification,
|
justification,
|
||||||
&mut displaced,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
self.storage.db.commit(transaction)?;
|
self.storage.db.commit(transaction)?;
|
||||||
self.blockchain.update_meta(m);
|
self.blockchain.update_meta(m);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user