Skip to content

Commit

Permalink
Revert "Fabo/remove polkadot reconnection logic" (#892)
Browse files Browse the repository at this point in the history
* Revert "Fabo/remove polkadot reconnection logic (#885)"

This reverts commit b05a3bf.

* Update polkadot-node-subscription.js
  • Loading branch information
faboweb authored Jun 4, 2020
1 parent 7f3632e commit f5c938e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Installation
## Installation
Clone the repository:

```
Expand Down
37 changes: 0 additions & 37 deletions lib/block-listeners/polkadot-node-subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,43 +259,6 @@ class PolkadotNodeSubscription {
)
return this.db.upsert('validatorprofiles', validatorRows)
}
async updateRewards(era, chainId) {
console.time()
console.log('update rewards')
const rewards = await this.polkadotAPI.getEraRewards(era) // ATTENTION: era means "get all rewards of all eras since that era". putting a low number takes a long time.
console.timeEnd()

console.time()
console.log('store rewards', rewards.length)
await this.storeRewards(
rewards
.filter(({ amount }) => amount > 0)
.map(({ amount, height, validatorAddress, denom, address }) => ({
amount,
height,
validator: validatorAddress,
denom,
address
})),
era,
chainId
)
console.timeEnd()
}

storeRewards(rewards, chainId) {
return this.db.insert('rewards', rewards, undefined, chainId) // height is in the rewards rows already
}

async eraRewardsExist(era) {
const response = await this.db.read(
'rewards',
'rewardsExitCheck',
['amount'],
`limit:1 where:{height:{_eq:"${era}"}}`
)
return response.length > 0
}
}

module.exports = PolkadotNodeSubscription
3 changes: 0 additions & 3 deletions lib/reducers/polkadotV0-reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ async function balanceReducer(
fiatCurrency
)
// hack. We convert the balance into an Array to make it an Iterable
if (balance == 0) {
return []
}
return [
{
amount: lunieCoin.amount,
Expand Down
1 change: 0 additions & 1 deletion lib/stores/block-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class BlockStore {
this.dataReady = new Promise((resolve) => {
this.resolveReady = resolve
})
this.db = database
}

update({
Expand Down

0 comments on commit f5c938e

Please sign in to comment.