@@ -1705,25 +1705,25 @@ impl<Block: BlockT> Backend<Block> {
1705
1705
let number = finalized. saturating_sub ( keep. into ( ) ) ;
1706
1706
self . prune_block ( transaction, BlockId :: < Block > :: number ( number) ) ?;
1707
1707
}
1708
+ }
1708
1709
1709
- // Also discard all blocks from displaced branches
1710
- for h in displaced. leaves ( ) {
1711
- let mut number = finalized;
1712
- let mut hash = * h;
1713
- // Follow displaced chains back until we reach a finalized block.
1714
- // Since leaves are discarded due to finality, they can't have parents
1715
- // that are canonical, but not yet finalized. So we stop deleting as soon as
1716
- // we reach canonical chain.
1717
- while self . blockchain . hash ( number) ? != Some ( hash) {
1718
- let id = BlockId :: < Block > :: hash ( hash) ;
1719
- match self . blockchain . header ( id) ? {
1720
- Some ( header) => {
1721
- self . prune_block ( transaction, id) ?;
1722
- number = header. number ( ) . saturating_sub ( One :: one ( ) ) ;
1723
- hash = * header. parent_hash ( ) ;
1724
- } ,
1725
- None => break ,
1726
- }
1710
+ // Discard all blocks from displaced (discarded) branches
1711
+ for h in displaced. leaves ( ) {
1712
+ let mut number = finalized;
1713
+ let mut hash = * h;
1714
+ // Follow displaced chains back until we reach a finalized block.
1715
+ // Since leaves are discarded due to finality, they can't have parents
1716
+ // that are canonical, but not yet finalized. So we stop deleting as soon as
1717
+ // we reach canonical chain.
1718
+ while self . blockchain . hash ( number) ? != Some ( hash) {
1719
+ let id = BlockId :: < Block > :: hash ( hash) ;
1720
+ match self . blockchain . header ( id) ? {
1721
+ Some ( header) => {
1722
+ self . prune_block ( transaction, id) ?;
1723
+ number = header. number ( ) . saturating_sub ( One :: one ( ) ) ;
1724
+ hash = * header. parent_hash ( ) ;
1725
+ } ,
1726
+ None => break ,
1727
1727
}
1728
1728
}
1729
1729
}
@@ -1743,6 +1743,13 @@ impl<Block: BlockT> Backend<Block> {
1743
1743
columns:: BODY ,
1744
1744
id,
1745
1745
) ?;
1746
+ utils:: remove_from_db (
1747
+ transaction,
1748
+ & * self . storage . db ,
1749
+ columns:: KEY_LOOKUP ,
1750
+ columns:: JUSTIFICATIONS ,
1751
+ id,
1752
+ ) ?;
1746
1753
if let Some ( index) =
1747
1754
read_db ( & * self . storage . db , columns:: KEY_LOOKUP , columns:: BODY_INDEX , id) ?
1748
1755
{
0 commit comments