mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Don't ignore BSQ burned by invalid txs in chart data models
Use 'Tx::getBurntBsq' instead of 'Tx::getBurntFee', so as not to exclude BSQ burned by invalid txs from the supply calculations. There are no invalid BSQ txs at present on mainchain, but accidentally burned BSQ should definitely count as a reduction in supply, so this fixes a bug.
This commit is contained in:
parent
712c97826b
commit
d97636eaad
@ -307,7 +307,7 @@ public class PriceChartDataModel extends ChartDataModel {
|
||||
private NavigableMap<Long, Double> getOutstandingBsqByInterval() {
|
||||
Stream<Tx> txStream = daoStateService.getBlocks().stream()
|
||||
.flatMap(b -> b.getTxs().stream())
|
||||
.filter(tx -> tx.getBurntFee() > 0);
|
||||
.filter(tx -> tx.getBurntBsq() > 0);
|
||||
Map<Long, Double> simpleBurns = txStream
|
||||
.collect(Collectors.groupingBy(
|
||||
tx -> toTimeInterval(Instant.ofEpochMilli(tx.getTime())),
|
||||
|
@ -210,7 +210,7 @@ public class DaoChartDataModel extends ChartDataModel {
|
||||
return totalBurnedByInterval;
|
||||
}
|
||||
|
||||
totalBurnedByInterval = getBurntBsqByInterval(getBurntFeeTxStream(), getDateFilter());
|
||||
totalBurnedByInterval = getBurntBsqByInterval(getBurntBsqTxStream(), getDateFilter());
|
||||
return totalBurnedByInterval;
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ public class DaoChartDataModel extends ChartDataModel {
|
||||
return miscBurnByInterval;
|
||||
}
|
||||
|
||||
Map<Long, Long> allMiscBurnByInterval = getBurntFeeTxStream()
|
||||
Map<Long, Long> allMiscBurnByInterval = getBurntBsqTxStream()
|
||||
.filter(e -> e.getTxType() != TxType.PAY_TRADE_FEE)
|
||||
.filter(e -> e.getTxType() != TxType.PROOF_OF_BURN)
|
||||
.collect(Collectors.groupingBy(
|
||||
@ -295,7 +295,7 @@ public class DaoChartDataModel extends ChartDataModel {
|
||||
Collection<Issuance> issuanceSetForType = daoStateService.getIssuanceItems();
|
||||
// get all issued and burnt BSQ, not just the filtered date range
|
||||
Map<Long, Long> tmpIssuedByInterval = getIssuedBsqByInterval(issuanceSetForType, e -> true);
|
||||
Map<Long, Long> tmpBurnedByInterval = getBurntBsqByInterval(getBurntFeeTxStream(), e -> true);
|
||||
Map<Long, Long> tmpBurnedByInterval = getBurntBsqByInterval(getBurntBsqTxStream(), e -> true);
|
||||
tmpBurnedByInterval.replaceAll((k, v) -> -v);
|
||||
|
||||
Map<Long, Long> tmpSupplyByInterval = new TreeMap<>(getMergedMap(tmpIssuedByInterval, tmpBurnedByInterval, Long::sum));
|
||||
@ -354,10 +354,10 @@ public class DaoChartDataModel extends ChartDataModel {
|
||||
|
||||
// TODO: Consider moving these two methods to DaoStateService:
|
||||
|
||||
private Stream<Tx> getBurntFeeTxStream() {
|
||||
private Stream<Tx> getBurntBsqTxStream() {
|
||||
return daoStateService.getBlocks().stream()
|
||||
.flatMap(b -> b.getTxs().stream())
|
||||
.filter(tx -> tx.getBurntFee() > 0);
|
||||
.filter(tx -> tx.getBurntBsq() > 0);
|
||||
}
|
||||
|
||||
private Stream<Tx> getTradeFeeTxStream() {
|
||||
|
Loading…
Reference in New Issue
Block a user