mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Use trade date for check if hotfix is activated at refund managers DPT verification
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
9dc79fdcd4
commit
b872683b60
@ -52,7 +52,7 @@ 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 final Date HOTFIX_ACTIVATION_DATE = Utilities.getUTCDate(2023, GregorianCalendar.JANUARY, 10);
|
||||
|
||||
public static boolean isHotfixActivated() {
|
||||
return new Date().after(HOTFIX_ACTIVATION_DATE);
|
||||
@ -121,8 +121,15 @@ public class DelayedPayoutTxReceiverService implements DaoStateListener {
|
||||
public List<Tuple2<Long, String>> getReceivers(int burningManSelectionHeight,
|
||||
long inputAmount,
|
||||
long tradeTxFee) {
|
||||
return getReceivers(burningManSelectionHeight, inputAmount, tradeTxFee, isHotfixActivated());
|
||||
}
|
||||
|
||||
public List<Tuple2<Long, String>> getReceivers(int burningManSelectionHeight,
|
||||
long inputAmount,
|
||||
long tradeTxFee,
|
||||
boolean isHotfixActivated) {
|
||||
checkArgument(burningManSelectionHeight >= MIN_SNAPSHOT_HEIGHT, "Selection height must be >= " + MIN_SNAPSHOT_HEIGHT);
|
||||
Collection<BurningManCandidate> burningManCandidates = isHotfixActivated() ?
|
||||
Collection<BurningManCandidate> burningManCandidates = isHotfixActivated ?
|
||||
burningManService.getActiveBurningManCandidates(burningManSelectionHeight) :
|
||||
burningManService.getBurningManCandidatesByName(burningManSelectionHeight).values();
|
||||
|
||||
@ -151,7 +158,7 @@ public class DelayedPayoutTxReceiverService implements DaoStateListener {
|
||||
// If we remove outputs it will be spent as miner fee.
|
||||
long minOutputAmount = Math.max(DPT_MIN_OUTPUT_AMOUNT, txFeePerVbyte * 32 * 2);
|
||||
// Sanity check that max share of a non-legacy BM is 20% over MAX_BURN_SHARE (taking into account potential increase due adjustment)
|
||||
long maxOutputAmount = isHotfixActivated() ?
|
||||
long maxOutputAmount = isHotfixActivated ?
|
||||
Math.round(spendableAmount * (BurningManService.MAX_BURN_SHARE * 1.2)) :
|
||||
Math.round(inputAmount * (BurningManService.MAX_BURN_SHARE * 1.2));
|
||||
// We accumulate small amounts which gets filtered out and subtract it from 1 to get an adjustment factor
|
||||
|
@ -320,10 +320,13 @@ public final class RefundManager extends DisputeManager<RefundDisputeList> {
|
||||
Transaction depositTx = dispute.findDepositTx(btcWalletService).orElseThrow();
|
||||
long inputAmount = depositTx.getOutput(0).getValue().value;
|
||||
int selectionHeight = dispute.getBurningManSelectionHeight();
|
||||
|
||||
boolean wasHotfixActivatedAtTradeDate = dispute.getTradeDate().after(DelayedPayoutTxReceiverService.HOTFIX_ACTIVATION_DATE);
|
||||
List<Tuple2<Long, String>> delayedPayoutTxReceivers = delayedPayoutTxReceiverService.getReceivers(
|
||||
selectionHeight,
|
||||
inputAmount,
|
||||
dispute.getTradeTxFee());
|
||||
dispute.getTradeTxFee(),
|
||||
wasHotfixActivatedAtTradeDate);
|
||||
log.info("Verify delayedPayoutTx using selectionHeight {} and receivers {}", selectionHeight, delayedPayoutTxReceivers);
|
||||
checkArgument(delayedPayoutTx.getOutputs().size() == delayedPayoutTxReceivers.size(),
|
||||
"Size of outputs and delayedPayoutTxReceivers must be the same");
|
||||
|
Loading…
Reference in New Issue
Block a user