Merge pull request #1922 from mononaut/bugfix/visualization-colors

Fix block visualization color for txs with 0 < feerate < 1 sat/vb
This commit is contained in:
wiz 2022-06-27 00:31:29 +09:00 committed by GitHub
commit c738816cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,9 +140,8 @@ export default class TxView implements TransactionStripped {
}
getColor(): Color {
let feeLevelIndex = feeLevels.slice().reverse().findIndex((feeLvl) => (this.feerate || 1) >= feeLvl);
feeLevelIndex = feeLevelIndex >= 0 ? feeLevels.length - feeLevelIndex : feeLevelIndex;
return hexToColor(mempoolFeeColors[feeLevelIndex - 1] || mempoolFeeColors[mempoolFeeColors.length - 1]);
const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, this.feerate) < feeLvl) - 1;
return hexToColor(mempoolFeeColors[feeLevelIndex] || mempoolFeeColors[mempoolFeeColors.length - 1]);
}
}