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

Commit

Permalink
hot patch: fix whitelist for contributions and deal with the run(0) i…
Browse files Browse the repository at this point in the history
…ssue

“fixes” #3452 and related
issue in #2994

auditor: @diracdeltas
  • Loading branch information
mrose17 committed Aug 27, 2016
1 parent bd0ef2e commit 55c0e10
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,13 +773,7 @@ var callback = (err, result, delayTime) => {
console.log('ledger client error(1): ' + err.toString() + (err.stack ? ('\n' + err.stack) : ''))
if (!client) return

/* TBD: avoid error lock-up in sync preventing future reconciliations
return setTimeout(() => {
if (client.sync(callback) === true) run(random.randomInt({ min: 1, max: 10 * msecs.minute }))
}, 1 * msecs.hour)
*/

if (typeof delayTime === 'undefined') delayTime = 0
if (typeof delayTime === 'undefined') delayTime = random.randomInt({ min: 1, max: 10 * msecs.minute })
}

if (!result) return run(delayTime)
Expand Down Expand Up @@ -896,7 +890,7 @@ var run = (delayTime) => {

if (!client) return console.log('\n\n*** MTR says this can\'t happen(1)... please tell him that he\'s wrong!\n\n')

if (client.sync(callback) === true) return run(0)
if (client.sync(callback) === true) return run(random.randomInt({ min: 1, max: 10 * msecs.minute }))
}, delayTime)
}

Expand Down Expand Up @@ -934,18 +928,16 @@ var getStateInfo = (state) => {
if (transaction.stamp < then) break

ballots = underscore.clone(transaction.ballots || {})
underscore.keys(state.ballots).forEach((ballot) => {
state.ballots.forEach((ballot) => {
if (ballot.viewingId !== transaction.viewingId) return

if (!ballots[ballot.publisher]) ballots[ballot.publisher] = 0
ballots[ballot.publisher]++
})

ledgerInfo.transactions.push(underscore.extend(underscore.pick(transaction,
[ 'viewingId', 'submissionStamp', 'satoshis',
'contribution'
]),
transaction.fee, { ballots: ballots }))
[ 'viewingId', 'contribution', 'submissionStamp', 'count' ]),

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Aug 27, 2016

Member

please update docs/state.md to reflect this change

{ ballots: ballots }))
}

updateLedgerInfo()
Expand Down

1 comment on commit 55c0e10

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willy-b please confirm that this fixes the ballots issue you were seeing, thanks

Please sign in to comment.