Merge pull request #45 from status-im/bug_fix/gas-average

Fix average in gas station
This commit is contained in:
Iuri Matias 2018-09-04 11:44:50 -04:00 committed by GitHub
commit 0f9331532e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -34,7 +34,7 @@ class GasStation extends Component {
}).map(gasPrice => {
totalWait += this.props.gasOracleStats[gasPrice].totalWait;
totalTxs += this.props.gasOracleStats[gasPrice].nbTxs;
totalGasPrice = gasPrice * this.props.gasOracleStats[gasPrice].nbTxs;
totalGasPrice += gasPrice * this.props.gasOracleStats[gasPrice].nbTxs;
return {
gasPrice,
wait: this.props.gasOracleStats[gasPrice].averageWait >= 0.1 ? this.props.gasOracleStats[gasPrice].averageWait : 0.1

View File

@ -28,7 +28,12 @@ class TransactionTracker {
}
block.transactions.forEach(transaction => {
if (this.transactions[transaction.hash]) {
Object.assign(this.transactions[transaction.hash], transaction, {endTimestamp: block.timestamp, wait: block.timestamp - this.transactions[transaction.hash].startTimestamp});
let wait = block.timestamp - this.transactions[transaction.hash].startTimestamp;
if (wait < 0.1) {
wait = 0.1;
}
Object.assign(this.transactions[transaction.hash],
{endTimestamp: block.timestamp, wait, gasPrice: transaction.gasPrice});
}
});
this.events.emit('blockchain:gas:oracle:new');