Skip to content

fix(core-database): fix delete blocks#3814

Merged
faustbrian merged 2 commits into
developfrom
fix/core-database/delete-blocks
Jun 19, 2020
Merged

fix(core-database): fix delete blocks#3814
faustbrian merged 2 commits into
developfrom
fix/core-database/delete-blocks

Conversation

@rainydio

@rainydio rainydio commented Jun 19, 2020

Copy link
Copy Markdown
Contributor

Summary

It appears that BlockRepository.deleteBlocks was called with array in reverse order (higher height first). This should have raised Removing blocks from the middle error, but didn't. I added more checks, tests, and reversed block order (similarly to how transactions are re-added to pool).

This is an attempt to shield BlockRepository.deleteBlocks so it can't be called with incorrect arguments that will not throw some error.

Checklist

  • Tests
  • Ready to be merged

@ghost ghost added Complexity: Low labels Jun 19, 2020
@codecov

codecov Bot commented Jun 19, 2020

Copy link
Copy Markdown

Codecov Report

Merging #3814 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3814   +/-   ##
========================================
  Coverage    97.28%   97.29%           
========================================
  Files          617      617           
  Lines        13910    13916    +6     
  Branches      1632     1635    +3     
========================================
+ Hits         13533    13539    +6     
  Misses         117      117           
  Partials       260      260           
Flag Coverage Δ
#functional 6.48% <87.50%> (+0.04%) ⬆️
#integration 10.18% <0.00%> (-0.01%) ⬇️
#unit 95.22% <12.50%> (-0.05%) ⬇️
Impacted Files Coverage Δ
packages/core-blockchain/src/blockchain.ts 98.02% <100.00%> (ø)
...core-database/src/repositories/block-repository.ts 96.96% <100.00%> (+0.30%) ⬆️

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 d9fc0c0...8593878. Read the comment docs.

@rainydio rainydio marked this pull request as ready for review June 19, 2020 12:38
@faustbrian faustbrian merged commit b2fee48 into develop Jun 19, 2020
@ghost ghost deleted the fix/core-database/delete-blocks branch June 19, 2020 13:03
@ghost ghost removed the Status: Needs Review label Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants