Use ceil for round calculations - Closes #427 #439

Merged
merged 2 commits into from Feb 23, 2017

Conversation

Projects
2 participants
@4miners
Member

4miners commented Feb 14, 2017

Closes #427

@4miners 4miners added the enhancement label Feb 14, 2017

@karmacoma karmacoma self-assigned this Feb 14, 2017

@karmacoma

Please see this.scope for access to modules. Also see https://github.com/LiskHQ/lisk/blob/development/logic/vote.js#L17 for existing pattern. Not sure this is best approach, but works.

@@ -531,7 +526,7 @@ Transaction.prototype.apply = function (trs, block, sender, cb) {
this.scope.account.merge(sender.address, {
balance: -amount,
blockId: block.id,
- round: calc(block.height)
+ round: modules.rounds.calc(block.height)

This comment has been minimized.

@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@@ -542,7 +537,7 @@ Transaction.prototype.apply = function (trs, block, sender, cb) {
this.scope.account.merge(sender.address, {
balance: amount,
blockId: block.id,
- round: calc(block.height)
+ round: modules.rounds.calc(block.height)

This comment has been minimized.

@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@@ -560,7 +555,7 @@ Transaction.prototype.undo = function (trs, block, sender, cb) {
this.scope.account.merge(sender.address, {
balance: amount,
blockId: block.id,
- round: calc(block.height)
+ round: modules.rounds.calc(block.height)

This comment has been minimized.

@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@@ -571,7 +566,7 @@ Transaction.prototype.undo = function (trs, block, sender, cb) {
this.scope.account.merge(sender.address, {
balance: amount,
blockId: block.id,
- round: calc(block.height)
+ round: modules.rounds.calc(block.height)

This comment has been minimized.

@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@karmacoma

karmacoma Feb 14, 2017

Member
modules is not defined
@4miners

This comment has been minimized.

Show comment
Hide comment
@4miners

4miners Feb 14, 2017

Member

Fixed. That solution is far from perfect, but it works. ;) library.logic.transaction/block/account are specyfic modules, so using one of currently used approach fail here. Another options:

  • require rounds module directly inside logic/transaction.js
  • move Rounds.prototype.calc to helpers/slots.js or maybe create rounds helper
Member

4miners commented Feb 14, 2017

Fixed. That solution is far from perfect, but it works. ;) library.logic.transaction/block/account are specyfic modules, so using one of currently used approach fail here. Another options:

  • require rounds module directly inside logic/transaction.js
  • move Rounds.prototype.calc to helpers/slots.js or maybe create rounds helper

@karmacoma karmacoma changed the title from Use ceil for round calculations to Use ceil for round calculations - Closes #427 Feb 23, 2017

@karmacoma karmacoma merged commit 1a7b586 into LiskHQ:development Feb 23, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@karmacoma karmacoma added this to Done in Version 0.7.0 Feb 23, 2017

@4miners 4miners deleted the 4miners:427_ceil-for-rounds branch Mar 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment