Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Jun 21, 2022
1 parent 80dc1fb commit 7731e0b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bin/light-base/src/sync_service/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,14 @@ pub(super) async fn start_parachain<TPlat: Platform>(
// TODO: what about an `else`? does sync_sources leak if the block can't be decoded?
}

// Must unpin the pruned blocks if they haven't already been unpinned.
for (_, hash, pruned_block_parahead) in pruned_blocks {
if pruned_block_parahead.is_none() {
// Must unpin the pruned blocks if they haven't already been unpinned and
// if there is no operation in progress. In case where there is a parahead
// fetch operation in progress for this block, the operation uses the pin
// and block will be unpinned when the operation is finished.
for (block_index, _, pruned_block_parahead) in pruned_blocks {
if pruned_block_parahead.is_none()
&& async_tree.block_async_op_in_progress(block_index).is_none()
{
relay_chain_subscribe_all
.new_blocks
.unpin_block(&hash)
Expand Down
1 change: 1 addition & 0 deletions bin/wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Fix errors about verifying justifications. Justifications and Grandpa commits that can't be verified yet are now properly stored in memory in order to be verified later, instead of producing errors. ([#2400](https://github.com/paritytech/smoldot/pull/2400))
- Fix issue where unverified justifications would overwrite one another, meaning that an invalid justification could potentially prevent a valid justification from being taken into account. ([#2400](https://github.com/paritytech/smoldot/pull/2400))
- Fix panic when a relay chain block is pruned at the same time as we are trying to determine the parachain block corresponding to it.

## 0.6.19 - 2022-06-14

Expand Down
17 changes: 17 additions & 0 deletions src/chain/async_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,23 @@ where
}
}

/// If an asynchronous operation is in progress and targets the given block, returns the
/// identifier of this asynchronous operation.
///
/// Returns `None` if the asynchronous operation of this block is either already finished or
/// not started yet.
///
/// # Panic
///
/// Panics if the [`NodeIndex`] is invalid.
///
pub fn block_async_op_in_progress(&self, node_index: NodeIndex) -> Option<AsyncOpId> {
match &self.non_finalized_blocks.get(node_index).unwrap().async_op {
AsyncOpState::InProgress { async_op_id, .. } => Some(*async_op_id),
_ => None,
}
}

/// Returns the parent of the given node. Returns `None` if the node doesn't have any parent,
/// meaning that its parent is the finalized node.
///
Expand Down

0 comments on commit 7731e0b

Please sign in to comment.