Skip to content

Commit

Permalink
Merge pull request #2160 from SelfKeyFoundation/release
Browse files Browse the repository at this point in the history
fix wallet balance
  • Loading branch information
sk91 authored Apr 1, 2020
2 parents 7aa300f + dea4cf3 commit 1729d29
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/blockchain/web3-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ export class Web3Service {
engine.on('error', error => {
log.error('Web3Service provider error %s', error);
});
engine.start();

this.web3 = new Web3(engine);
engine.on('start', async () => {
await this.web3.eth.getBlockNumber();
});
engine.start();
this.web3.transactionConfirmationBlocks = 1;
}

Expand Down Expand Up @@ -96,9 +98,11 @@ export class Web3Service {
engine.on('error', error => {
log.error('Web3Service provider error %s', error);
});
engine.start();

this.web3 = new Web3(engine);
engine.on('start', async () => {
await this.web3.eth.getBlockNumber();
});
engine.start();
this.web3.transactionConfirmationBlocks = 1;
}

Expand Down Expand Up @@ -149,8 +153,13 @@ export class Web3Service {
engine.addProvider(this.trezorWalletSubProvider);
engine.addProvider(subscriptionSubprovider);
engine.addProvider(new WebsocketProvider({ rpcUrl: SELECTED_SERVER_URL }));
engine.start();
this.web3 = new Web3(engine);
engine.on('start', async () => {
// block tracking does not work if not manually started for some reason
// causing incorrect balances to be returned on getBalance call
await this.web3.eth.getBlockNumber();
});
engine.start();
this.web3.transactionConfirmationBlocks = 1;
}

Expand Down

0 comments on commit 1729d29

Please sign in to comment.