Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Commit

Permalink
Change ballot commit interval to [1s..5m] (#47)
Browse files Browse the repository at this point in the history
* Change ballot commit interval to [1s..5m]

* S/this/self/
  • Loading branch information
mrose17 authored Apr 4, 2018
1 parent de3fd33 commit 5458396
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,8 @@ Client.prototype._currentReconcile = function (callback) {

transaction = { viewingId: viewingId,
surveyorId: surveyorInfo.surveyorId,
contribution: { fiat: { amount: amount, currency: currency },
contribution: {
fiat: { amount: amount, currency: currency },
rates: rates,
satoshis: body.satoshis,
altcurrency: body.altcurrency,
Expand Down Expand Up @@ -1129,12 +1130,13 @@ Client.prototype._prepareBallot = function (ballot, transaction, callback) {
ballot.prepareBallot = underscore.defaults(body, { server: self.options.server })

now = underscore.now()
delayTime = random.randomInt({ min: msecs.second, max: self.options.debugP ? msecs.minute : 3 * msecs.hour })
delayTime = random.randomInt({ min: 10 * msecs.second, max: (self.options.debugP ? 1 : 5) * msecs.minute })
ballot.delayStamp = now + delayTime
if (self.options.verboseP) ballot.delayDate = new Date(ballot.delayStamp)

self._log('_prepareBallot', { delayTime: msecs.minute })
callback(null, self.state, msecs.minute)
if (delayTime > msecs.minute) delayTime = msecs.minute
self._log('_prepareBallot', { delayTime: delayTime })
callback(null, self.state, delayTime)
})
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bat-client",
"version": "2.1.2",
"version": "2.1.3",
"description": "An example of client code for the BAT.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5458396

Please # to comment.