Fix block visualization color for <1 sat/vb txs

This commit is contained in:
Mononaut 2022-06-24 20:06:48 +00:00
parent 24300eeac5
commit 61c309cd1d
No known key found for this signature in database
GPG Key ID: 61B952CAF4838F94

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]);
}
}