bosagora / agora

POC Node implementation for CoinNet
https://bosagora.io
MIT License
37 stars 22 forks source link

Reset pending block if ledger is at that height #3213

Closed hewison-chris closed 2 years ago

hewison-chris commented 2 years ago

If the block is fetched by a Validator via block catchup then we need to reset the pending block and rearm the envelope processing timer and reset the interval of the nomination timer.

codecov[bot] commented 2 years ago

Codecov Report

Merging #3213 (6f4be9a) into v0.x.x (dd2491c) will increase coverage by 8.23%. The diff coverage is 75.00%.

:exclamation: Current head 6f4be9a differs from pull request most recent head 11031c8. Consider uploading reports for the commit 11031c8 to get more accurate results

@@            Coverage Diff             @@
##           v0.x.x    #3213      +/-   ##
==========================================
+ Coverage   79.27%   87.51%   +8.23%     
==========================================
  Files         212      166      -46     
  Lines       19108    16922    -2186     
==========================================
- Hits        15148    14809     -339     
+ Misses       3960     2113    -1847     
Flag Coverage Δ
integration ?
unittests 87.51% <75.00%> (+0.10%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
source/agora/consensus/protocol/Nominator.d 91.75% <60.00%> (+0.24%) :arrow_up:
source/agora/node/Validator.d 92.78% <100.00%> (+2.10%) :arrow_up:
source/agora/test/ValidatorRecurringEnrollment.d 94.23% <100.00%> (ø)
source/agora/utils/Log.d 48.34% <0.00%> (-10.60%) :arrow_down:
source/agora/flash/Node.d 80.67% <0.00%> (-0.43%) :arrow_down:
source/agora/test/Flash.d 95.12% <0.00%> (-0.11%) :arrow_down:
...ora/submodules/ocean/src/ocean/meta/codegen/CTFE.d
...a/submodules/ocean/src/ocean/util/compress/c/Zip.d
...gora/submodules/ocean/src/ocean/core/TypeConvert.d
...gora/submodules/ocean/src/ocean/text/convert/Hex.d
... and 49 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dd2491c...11031c8. Read the comment docs.

hewison-chris commented 2 years ago

I am going to update to call resetPending when a block is accepted (added to the ledger) otherwise if the nomination timer has been set to a larger interval it will take longer before we find out.

hewison-chris commented 2 years ago

Now in Validator.acceptBlock it calls nominator.resetPendingBlock once the block is added to the ledger.