Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cast delegate round to number #1143

Merged
merged 1 commit into from Oct 17, 2018
Merged

fix: cast delegate round to number #1143

merged 1 commit into from Oct 17, 2018

Conversation

spkjp
Copy link
Contributor

@spkjp spkjp commented Oct 17, 2018

Proposed changes

This check this.activeDelegates[0].round === round always evaluates to false, because delegate.round is a string at this point while round is a number.

There are two places where we performed this comparison:

if (!this.activeDelegates || this.activeDelegates.length === 0 || (this.activeDelegates.length && this.activeDelegates[0].round !== round)) {

if (this.activeDelegates && this.activeDelegates.length && this.activeDelegates[0].round === round) {

Once everything is done in memory this is probably unnecessary.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@spkjp spkjp requested review from fix and faustbrian October 17, 2018 15:55
@codecov-io
Copy link

Codecov Report

Merging #1143 into develop will decrease coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1143      +/-   ##
===========================================
- Coverage    78.14%   78.02%   -0.12%     
===========================================
  Files          424      424              
  Lines         6890     6891       +1     
  Branches       883      883              
===========================================
- Hits          5384     5377       -7     
- Misses        1332     1337       +5     
- Partials       174      177       +3
Impacted Files Coverage Δ
packages/core-database-postgres/lib/connection.js 74.19% <100%> (+0.11%) ⬆️
packages/core-forger/lib/manager.js 71.73% <0%> (-9.79%) ⬇️
packages/core-p2p/lib/utils/check-ntp.js 100% <0%> (+7.14%) ⬆️

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 ff8c4ef...b5dca68. Read the comment docs.

@faustbrian faustbrian merged commit 6d0479a into ArkEcosystem:develop Oct 17, 2018
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.

None yet

3 participants