mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Fix but with calculating the miner fee for the DPT.
Add activation date for hotfix. We used all potential BM instead only the ones who have a positive cappedBurnAmountShare.
This commit is contained in:
parent
659d0c283d
commit
5470097981
@ -53,6 +53,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -207,6 +208,13 @@ public class BurningManService {
|
||||
return daoStateService.getParamValue(Param.RECIPIENT_BTC_ADDRESS, chainHeight);
|
||||
}
|
||||
|
||||
Set<BurningManCandidate> getActiveBurningManCandidates(int chainHeight) {
|
||||
return getBurningManCandidatesByName(chainHeight).values().stream()
|
||||
.filter(burningManCandidate -> burningManCandidate.getCappedBurnAmountShare() > 0)
|
||||
.filter(candidate -> candidate.getMostRecentAddress().isPresent())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
|
@ -25,6 +25,7 @@ import bisq.core.dao.state.model.blockchain.Block;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.util.Tuple2;
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -33,6 +34,8 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -49,6 +52,12 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class DelayedPayoutTxReceiverService implements DaoStateListener {
|
||||
private static final Date HOTFIX_ACTIVATION_DATE = Utilities.getUTCDate(2023, GregorianCalendar.JANUARY, 10);
|
||||
|
||||
public static boolean isHotfixActivated() {
|
||||
return new Date().after(HOTFIX_ACTIVATION_DATE);
|
||||
}
|
||||
|
||||
// We don't allow to get further back than 767950 (the block height from Dec. 18th 2022).
|
||||
static final int MIN_SNAPSHOT_HEIGHT = Config.baseCurrencyNetwork().isRegtest() ? 0 : 767950;
|
||||
|
||||
@ -113,9 +122,12 @@ public class DelayedPayoutTxReceiverService implements DaoStateListener {
|
||||
public List<Tuple2<Long, String>> getReceivers(int burningManSelectionHeight,
|
||||
long inputAmount,
|
||||
long tradeTxFee) {
|
||||
|
||||
checkArgument(burningManSelectionHeight >= MIN_SNAPSHOT_HEIGHT, "Selection height must be >= " + MIN_SNAPSHOT_HEIGHT);
|
||||
Collection<BurningManCandidate> burningManCandidates = burningManService.getBurningManCandidatesByName(burningManSelectionHeight).values();
|
||||
Collection<BurningManCandidate> burningManCandidates = isHotfixActivated() ?
|
||||
burningManService.getActiveBurningManCandidates(burningManSelectionHeight) :
|
||||
burningManService.getBurningManCandidatesByName(burningManSelectionHeight).values();
|
||||
|
||||
|
||||
if (burningManCandidates.isEmpty()) {
|
||||
// If there are no compensation requests (e.g. at dev testing) we fall back to the legacy BM
|
||||
return List.of(new Tuple2<>(inputAmount, burningManService.getLegacyBurningManAddress(burningManSelectionHeight)));
|
||||
|
Loading…
Reference in New Issue
Block a user