Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove BurningManService.isActivated and apply changed to client code. #6701

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ private void applyBlock(Block block) {
///////////////////////////////////////////////////////////////////////////////////////////

public String getAddress() {
if (!BurningManService.isActivated()) {
// Before activation, we fall back to the current fee receiver address
return BurningManPresentationService.LEGACY_BURNING_MAN_BTC_FEES_ADDRESS;
}

List<BurningManCandidate> activeBurningManCandidates = new ArrayList<>(burningManService.getActiveBurningManCandidates(currentChainHeight));
if (activeBurningManCandidates.isEmpty()) {
// If there are no compensation requests (e.g. at dev testing) we fall back to the default address
Expand Down
11 changes: 0 additions & 11 deletions core/src/main/java/bisq/core/dao/burningman/BurningManService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@

import bisq.network.p2p.storage.P2PDataStorage;

import bisq.common.config.Config;
import bisq.common.util.Utilities;

import javax.inject.Inject;
import javax.inject.Singleton;

Expand All @@ -46,8 +43,6 @@
import com.google.common.collect.ImmutableList;

import java.util.Collection;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -67,12 +62,6 @@
@Slf4j
@Singleton
public class BurningManService {
private static final Date ACTIVATION_DATE = Utilities.getUTCDate(2023, GregorianCalendar.JANUARY, 1);

public static boolean isActivated() {
return Config.baseCurrencyNetwork().isRegtest() || new Date().after(ACTIVATION_DATE);
}

// Parameters
// Cannot be changed after release as it would break trade protocol verification of DPT receivers.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package bisq.core.dao.burningman.accounting.node;

import bisq.core.dao.burningman.BurningManService;
import bisq.core.dao.burningman.accounting.node.full.AccountingFullNode;
import bisq.core.dao.burningman.accounting.node.lite.AccountingLiteNode;
import bisq.core.user.Preferences;
Expand All @@ -39,7 +38,6 @@ public class AccountingNodeProvider {
@Inject
public AccountingNodeProvider(AccountingLiteNode liteNode,
AccountingFullNode fullNode,
InActiveAccountingNode inActiveAccountingNode,
@Named(Config.IS_BM_FULL_NODE) boolean isBmFullNode,
Preferences preferences) {

Expand All @@ -51,7 +49,7 @@ public AccountingNodeProvider(AccountingLiteNode liteNode,
if (isBmFullNode && rpcDataSet) {
accountingNode = fullNode;
} else {
accountingNode = BurningManService.isActivated() ? liteNode : inActiveAccountingNode;
accountingNode = liteNode;
}
}
}

This file was deleted.

27 changes: 12 additions & 15 deletions core/src/main/java/bisq/core/offer/OpenOfferManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import bisq.core.btc.wallet.TradeWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.dao.burningman.BtcFeeReceiverService;
import bisq.core.dao.burningman.BurningManService;
import bisq.core.dao.burningman.DelayedPayoutTxReceiverService;
import bisq.core.exceptions.TradePriceOutOfToleranceException;
import bisq.core.filter.FilterManager;
Expand Down Expand Up @@ -745,20 +744,18 @@ private void handleOfferAvailabilityRequest(OfferAvailabilityRequest request, No
availabilityResult = AvailabilityResult.UNCONF_TX_LIMIT_HIT;
}

if (BurningManService.isActivated()) {
try {
int takersBurningManSelectionHeight = request.getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight > 0, "takersBurningManSelectionHeight must not be 0");

int makersBurningManSelectionHeight = delayedPayoutTxReceiverService.getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight == makersBurningManSelectionHeight,
"takersBurningManSelectionHeight does no match makersBurningManSelectionHeight. " +
"takersBurningManSelectionHeight=" + takersBurningManSelectionHeight + "; makersBurningManSelectionHeight=" + makersBurningManSelectionHeight);
} catch (Throwable t) {
errorMessage = "Message validation failed. Error=" + t + ", Message=" + request;
log.warn(errorMessage);
availabilityResult = AvailabilityResult.INVALID_SNAPSHOT_HEIGHT;
}
try {
int takersBurningManSelectionHeight = request.getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight > 0, "takersBurningManSelectionHeight must not be 0");

int makersBurningManSelectionHeight = delayedPayoutTxReceiverService.getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight == makersBurningManSelectionHeight,
"takersBurningManSelectionHeight does no match makersBurningManSelectionHeight. " +
"takersBurningManSelectionHeight=" + takersBurningManSelectionHeight + "; makersBurningManSelectionHeight=" + makersBurningManSelectionHeight);
} catch (Throwable t) {
errorMessage = "Message validation failed. Error=" + t + ", Message=" + request;
log.warn(errorMessage);
availabilityResult = AvailabilityResult.INVALID_SNAPSHOT_HEIGHT;
}

OfferAvailabilityResponse offerAvailabilityResponse = new OfferAvailabilityResponse(request.offerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package bisq.core.trade.protocol.bisq_v1.tasks.buyer;

import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.burningman.BurningManService;
import bisq.core.trade.bisq_v1.TradeDataValidation;
import bisq.core.trade.model.bisq_v1.Trade;
import bisq.core.trade.protocol.bisq_v1.tasks.TradeTask;
Expand Down Expand Up @@ -59,33 +58,31 @@ protected void run() {
// Now as we know the deposit tx we can also verify the input
TradeDataValidation.validatePayoutTxInput(depositTx, finalDelayedPayoutTx);

if (BurningManService.isActivated()) {
long inputAmount = depositTx.getOutput(0).getValue().value;
long tradeTxFeeAsLong = trade.getTradeTxFeeAsLong();
int selectionHeight = processModel.getBurningManSelectionHeight();
List<Tuple2<Long, String>> delayedPayoutTxReceivers = processModel.getDelayedPayoutTxReceiverService().getReceivers(
selectionHeight,
inputAmount,
tradeTxFeeAsLong);
log.info("Verify delayedPayoutTx using selectionHeight {} and receivers {}", selectionHeight, delayedPayoutTxReceivers);
long lockTime = trade.getLockTime();
Transaction buyersDelayedPayoutTx = processModel.getTradeWalletService().createDelayedUnsignedPayoutTx(
depositTx,
delayedPayoutTxReceivers,
lockTime);
long inputAmount = depositTx.getOutput(0).getValue().value;
long tradeTxFeeAsLong = trade.getTradeTxFeeAsLong();
int selectionHeight = processModel.getBurningManSelectionHeight();
List<Tuple2<Long, String>> delayedPayoutTxReceivers = processModel.getDelayedPayoutTxReceiverService().getReceivers(
selectionHeight,
inputAmount,
tradeTxFeeAsLong);
log.info("Verify delayedPayoutTx using selectionHeight {} and receivers {}", selectionHeight, delayedPayoutTxReceivers);
long lockTime = trade.getLockTime();
Transaction buyersDelayedPayoutTx = processModel.getTradeWalletService().createDelayedUnsignedPayoutTx(
depositTx,
delayedPayoutTxReceivers,
lockTime);

if (!buyersDelayedPayoutTx.getTxId().equals(finalDelayedPayoutTx.getTxId())) {
String errorMsg = "TxIds of buyersDelayedPayoutTx and finalDelayedPayoutTx must be the same.";
log.error("{} \nbuyersDelayedPayoutTx={}, \nfinalDelayedPayoutTx={}, " +
"\nBtcWalletService.chainHeight={}, " +
"\nDaoState.chainHeight={}, " +
"\nisDaoStateIsInSync={}",
errorMsg, buyersDelayedPayoutTx, finalDelayedPayoutTx,
processModel.getBtcWalletService().getBestChainHeight(),
processModel.getDaoFacade().getChainHeight(),
processModel.getDaoFacade().isDaoStateReadyAndInSync());
throw new IllegalArgumentException(errorMsg);
}
if (!buyersDelayedPayoutTx.getTxId().equals(finalDelayedPayoutTx.getTxId())) {
String errorMsg = "TxIds of buyersDelayedPayoutTx and finalDelayedPayoutTx must be the same.";
log.error("{} \nbuyersDelayedPayoutTx={}, \nfinalDelayedPayoutTx={}, " +
"\nBtcWalletService.chainHeight={}, " +
"\nDaoState.chainHeight={}, " +
"\nisDaoStateIsInSync={}",
errorMsg, buyersDelayedPayoutTx, finalDelayedPayoutTx,
processModel.getBtcWalletService().getBestChainHeight(),
processModel.getDaoFacade().getChainHeight(),
processModel.getDaoFacade().isDaoStateReadyAndInSync());
throw new IllegalArgumentException(errorMsg);
}

complete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package bisq.core.trade.protocol.bisq_v1.tasks.buyer;

import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.burningman.BurningManService;
import bisq.core.trade.bisq_v1.TradeDataValidation;
import bisq.core.trade.model.bisq_v1.Trade;
import bisq.core.trade.protocol.bisq_v1.tasks.TradeTask;
Expand Down Expand Up @@ -52,31 +51,29 @@ protected void run() {
btcWalletService);

Transaction preparedDepositTx = btcWalletService.getTxFromSerializedTx(processModel.getPreparedDepositTx());
if (BurningManService.isActivated()) {
long inputAmount = preparedDepositTx.getOutput(0).getValue().value;
long tradeTxFeeAsLong = trade.getTradeTxFeeAsLong();
List<Tuple2<Long, String>> delayedPayoutTxReceivers = processModel.getDelayedPayoutTxReceiverService().getReceivers(
processModel.getBurningManSelectionHeight(),
inputAmount,
tradeTxFeeAsLong);

long lockTime = trade.getLockTime();
Transaction buyersPreparedDelayedPayoutTx = processModel.getTradeWalletService().createDelayedUnsignedPayoutTx(
preparedDepositTx,
delayedPayoutTxReceivers,
lockTime);
if (!buyersPreparedDelayedPayoutTx.getTxId().equals(sellersPreparedDelayedPayoutTx.getTxId())) {
String errorMsg = "TxIds of buyersPreparedDelayedPayoutTx and sellersPreparedDelayedPayoutTx must be the same.";
log.error("{} \nbuyersPreparedDelayedPayoutTx={}, \nsellersPreparedDelayedPayoutTx={}, " +
"\nBtcWalletService.chainHeight={}, " +
"\nDaoState.chainHeight={}, " +
"\nisDaoStateIsInSync={}",
errorMsg, buyersPreparedDelayedPayoutTx, sellersPreparedDelayedPayoutTx,
processModel.getBtcWalletService().getBestChainHeight(),
processModel.getDaoFacade().getChainHeight(),
processModel.getDaoFacade().isDaoStateReadyAndInSync());
throw new IllegalArgumentException(errorMsg);
}
long inputAmount = preparedDepositTx.getOutput(0).getValue().value;
long tradeTxFeeAsLong = trade.getTradeTxFeeAsLong();
List<Tuple2<Long, String>> delayedPayoutTxReceivers = processModel.getDelayedPayoutTxReceiverService().getReceivers(
processModel.getBurningManSelectionHeight(),
inputAmount,
tradeTxFeeAsLong);

long lockTime = trade.getLockTime();
Transaction buyersPreparedDelayedPayoutTx = processModel.getTradeWalletService().createDelayedUnsignedPayoutTx(
preparedDepositTx,
delayedPayoutTxReceivers,
lockTime);
if (!buyersPreparedDelayedPayoutTx.getTxId().equals(sellersPreparedDelayedPayoutTx.getTxId())) {
String errorMsg = "TxIds of buyersPreparedDelayedPayoutTx and sellersPreparedDelayedPayoutTx must be the same.";
log.error("{} \nbuyersPreparedDelayedPayoutTx={}, \nsellersPreparedDelayedPayoutTx={}, " +
"\nBtcWalletService.chainHeight={}, " +
"\nDaoState.chainHeight={}, " +
"\nisDaoStateIsInSync={}",
errorMsg, buyersPreparedDelayedPayoutTx, sellersPreparedDelayedPayoutTx,
processModel.getBtcWalletService().getBestChainHeight(),
processModel.getDaoFacade().getChainHeight(),
processModel.getDaoFacade().isDaoStateReadyAndInSync());
throw new IllegalArgumentException(errorMsg);
}

// If the deposit tx is non-malleable, we already know its final ID, so should check that now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package bisq.core.trade.protocol.bisq_v1.tasks.maker;

import bisq.core.dao.burningman.BurningManService;
import bisq.core.exceptions.TradePriceOutOfToleranceException;
import bisq.core.offer.Offer;
import bisq.core.support.dispute.mediation.mediator.Mediator;
Expand Down Expand Up @@ -80,15 +79,13 @@ protected void run() {

tradingPeer.setAccountId(nonEmptyStringOf(request.getTakerAccountId()));

if (BurningManService.isActivated()) {
int takersBurningManSelectionHeight = request.getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight > 0, "takersBurningManSelectionHeight must not be 0");
int takersBurningManSelectionHeight = request.getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight > 0, "takersBurningManSelectionHeight must not be 0");

int makersBurningManSelectionHeight = processModel.getDelayedPayoutTxReceiverService().getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight == makersBurningManSelectionHeight,
"takersBurningManSelectionHeight does no match makersBurningManSelectionHeight");
processModel.setBurningManSelectionHeight(makersBurningManSelectionHeight);
}
int makersBurningManSelectionHeight = processModel.getDelayedPayoutTxReceiverService().getBurningManSelectionHeight();
checkArgument(takersBurningManSelectionHeight == makersBurningManSelectionHeight,
"takersBurningManSelectionHeight does no match makersBurningManSelectionHeight");
processModel.setBurningManSelectionHeight(makersBurningManSelectionHeight);

// We set the taker fee only in the processModel yet not in the trade as the tx was only created but not
// published yet. Once it was published we move it to trade. The takerFeeTx should be sent in a later
Expand Down
Loading