Module utils

Source
Expand description

Helper utilities

Functions§

best_fork_index
Auxiliary function to find best ranked fork.
block_rank
Compute a block’s rank, assuming that its valid, based on provided mining target.
deploy_native_contracts
Deploy DarkFi native wasm contracts to provided blockchain overlay.
find_extended_fork_index
Given a proposal, find the index of a fork chain it extends, along with the specific extended proposal index. Additionally, check that proposal doesn’t already exists in any fork chain.
get_mid
Auxiliary function to calculate the middle value between provided u64 numbers
header_rank
Verify provided header is valid for provided mining target and compute its rank.
median
Auxiliary function to calculate the median of a given Vec<u64>. The function sorts the vector internally.