Skip to content
  • Wei Tang's avatar
    Cumulative fixes to make working with consensus-pow easier (#3617) · ddd7368b
    Wei Tang authored
    
    
    * consensus-pow: add difficulty data to auxiliary
    
    * Timestamp api
    
    * Implement FinalityProofProvider for ()
    
    * Add DifficultyApi
    
    * Remove assumption that Difficulty is u128
    
    * Use a separate trait for add instead of hard-code it as Saturating
    
    * Some convenience functions to work with PowVerifier
    
    * Try to fix mining unstability
    
    * Fix generic resolution
    
    * Unused best_header variable
    
    * Fix hash calculation
    
    * Remove artificial sleep
    
    * Tweak proposer waiting time
    
    * Revert sleep removal
    
    The reason why it was there is because when mine_loop returns, it means an error
    happened. In that case, we'd better sleep for a moment before trying again,
    because immediately trying would most likely just fail.
    
    * Pass sync oracle to mining
    
    So that it does not mine when major syncing
    
    * Expose build time as a parameter
    
    Instead of hardcode it as previously 100ms.
    
    * Update lock file
    
    * Fix compile
    
    * Support skipping check_inherents for ancient blocks
    
    For PoW, older blocks are secured by the work, and can mostly be considered to
    be finalized. Thus we can save both code complexity and validation time by
    skipping checking inherents for them.
    
    * Move difficulty fetch function out of loop
    
    To make things faster
    
    * Remove seed from mining
    
    Each engine can use its own Rng source.
    
    * Better comments
    
    * Add TotalDifficulty definition for U256 and u128
    
    * Update core/consensus/pow/src/lib.rs
    
    Co-Authored-By: default avatarAndré Silva <[email protected]>
    
    * Rename TotalDifficulty::add -> increment
    
    * Use SelectChain to fetch the best header/hash
    
    * Update lock file
    ddd7368b