Skip to content

Commit

Permalink
Merge pull request #106 from OriginTrail/fix/already-known-retry-mech…
Browse files Browse the repository at this point in the history
…anism
  • Loading branch information
branarakic authored Sep 7, 2023
2 parents dc51e20 + 9153b6b commit ecc52d2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/dkg.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dkg.js",
"version": "6.0.12",
"version": "6.0.13",
"description": "Javascript library for interaction with the OriginTrail Decentralized Knowledge Graph",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 8 additions & 6 deletions services/blockchain-service/blockchain-service-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class BlockchainServiceBase {
return await web3Instance.eth.getGasPrice();
} catch (error) {
// eslint-disable-next-line no-console
console.warn(`Failed to fetch the gas price from the network: ${error}. Using default value: 100 Gwei.`);
console.warn(
`Failed to fetch the gas price from the network: ${error}. Using default value: 100 Gwei.`,
);
return Web3.utils.toWei('100', 'Gwei');
}
}
Expand All @@ -74,13 +76,13 @@ class BlockchainServiceBase {

let gasPrice = Number(
blockchain.previousTxGasPrice ||
blockchain.gasPrice ||
await this.getNetworkGasPrice(blockchain)
blockchain.gasPrice ||
(await this.getNetworkGasPrice(blockchain)),
);

if (blockchain.retryTx) {
// Increase gas price by 20%
gasPrice *= 1.2;
gasPrice = Math.round(gasPrice * 1.2);
}

return {
Expand Down Expand Up @@ -504,8 +506,8 @@ class BlockchainServiceBase {

return {
blockchainToken: blockchainTokenBalance,
trac: tracBalance
}
trac: tracBalance,
};
}

async getLatestBlock(blockchain) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ class NodeBlockchainService extends BlockchainServiceBase {
if (
!transactionRetried &&
blockchain.handleNotMinedError &&
(
e.message.includes('Transaction was not mined')
|| e.message.includes('Already known')
)
(e.message.includes('Transaction was not mined') ||
e.message.includes('already known'))
) {
transactionRetried = true;
// eslint-disable-next-line no-param-reassign
Expand Down

0 comments on commit ecc52d2

Please sign in to comment.