mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Merge pull request #6701 from HenrikJannsen/remove_activation_date_for_distributed_BM
Remove BurningManService.isActivated and apply changed to client code.
This commit is contained in:
commit
91e10d4970
@ -69,11 +69,6 @@ public class BtcFeeReceiverService implements DaoStateListener {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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
|
||||
|
@ -35,9 +35,6 @@ import bisq.core.dao.state.model.governance.IssuanceType;
|
||||
|
||||
import bisq.network.p2p.storage.P2PDataStorage;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@ -46,8 +43,6 @@ import com.google.common.base.Charsets;
|
||||
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;
|
||||
@ -67,12 +62,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@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.
|
||||
|
||||
|
@ -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;
|
||||
@ -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) {
|
||||
|
||||
@ -51,7 +49,7 @@ public class AccountingNodeProvider {
|
||||
if (isBmFullNode && rpcDataSet) {
|
||||
accountingNode = fullNode;
|
||||
} else {
|
||||
accountingNode = BurningManService.isActivated() ? liteNode : inActiveAccountingNode;
|
||||
accountingNode = liteNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.dao.burningman.accounting.node;
|
||||
|
||||
import bisq.core.dao.burningman.accounting.BurningManAccountingService;
|
||||
import bisq.core.dao.burningman.accounting.node.full.AccountingBlockParser;
|
||||
import bisq.core.dao.state.DaoStateService;
|
||||
import bisq.core.user.Preferences;
|
||||
|
||||
import bisq.network.p2p.P2PService;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
// Dummy implementation for a do-nothing AccountingNode. Used for the time before the burningman domain gets activated.
|
||||
@Singleton
|
||||
class InActiveAccountingNode extends AccountingNode {
|
||||
@Inject
|
||||
public InActiveAccountingNode(P2PService p2PService,
|
||||
DaoStateService daoStateService,
|
||||
BurningManAccountingService burningManAccountingService,
|
||||
AccountingBlockParser accountingBlockParser,
|
||||
Preferences preferences) {
|
||||
super(p2PService, daoStateService, burningManAccountingService,
|
||||
accountingBlockParser, preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListeners() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitialDaoBlockParsingComplete() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startRequestBlocks() {
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ import bisq.core.btc.wallet.BtcWalletService;
|
||||
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;
|
||||
@ -745,20 +744,18 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
availabilityResult = AvailabilityResult.UNCONF_TX_LIMIT_HIT;
|
||||
}
|
||||
|
||||
if (BurningManService.isActivated()) {
|
||||
try {
|
||||
int takersBurningManSelectionHeight = request.getBurningManSelectionHeight();
|
||||
checkArgument(takersBurningManSelectionHeight > 0, "takersBurningManSelectionHeight must not be 0");
|
||||
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;
|
||||
}
|
||||
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,
|
||||
|
@ -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;
|
||||
@ -59,33 +58,31 @@ public class BuyerVerifiesFinalDelayedPayoutTx extends TradeTask {
|
||||
// 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();
|
||||
|
@ -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;
|
||||
@ -52,31 +51,29 @@ public class BuyerVerifiesPreparedDelayedPayoutTx extends TradeTask {
|
||||
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 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 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
|
||||
|
@ -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;
|
||||
@ -80,15 +79,13 @@ public class MakerProcessesInputsForDepositTxRequest extends TradeTask {
|
||||
|
||||
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
|
||||
|
@ -18,8 +18,6 @@
|
||||
package bisq.core.trade.protocol.bisq_v1.tasks.seller;
|
||||
|
||||
import bisq.core.btc.wallet.TradeWalletService;
|
||||
import bisq.core.dao.burningman.BurningManService;
|
||||
import bisq.core.dao.governance.param.Param;
|
||||
import bisq.core.trade.bisq_v1.TradeDataValidation;
|
||||
import bisq.core.trade.model.bisq_v1.Trade;
|
||||
import bisq.core.trade.protocol.bisq_v1.tasks.TradeTask;
|
||||
@ -27,7 +25,6 @@ import bisq.core.trade.protocol.bisq_v1.tasks.TradeTask;
|
||||
import bisq.common.taskrunner.TaskRunner;
|
||||
import bisq.common.util.Tuple2;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
|
||||
import java.util.List;
|
||||
@ -51,29 +48,19 @@ public class SellerCreatesDelayedPayoutTx extends TradeTask {
|
||||
TradeWalletService tradeWalletService = processModel.getTradeWalletService();
|
||||
Transaction depositTx = checkNotNull(processModel.getDepositTx());
|
||||
Transaction preparedDelayedPayoutTx;
|
||||
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("Create delayedPayoutTx using selectionHeight {} and receivers {}", selectionHeight, delayedPayoutTxReceivers);
|
||||
long lockTime = trade.getLockTime();
|
||||
preparedDelayedPayoutTx = tradeWalletService.createDelayedUnsignedPayoutTx(
|
||||
depositTx,
|
||||
delayedPayoutTxReceivers,
|
||||
lockTime);
|
||||
} else {
|
||||
String donationAddressString = processModel.getDaoFacade().getParamValue(Param.RECIPIENT_BTC_ADDRESS);
|
||||
Coin minerFee = trade.getTradeTxFee();
|
||||
long lockTime = trade.getLockTime();
|
||||
preparedDelayedPayoutTx = tradeWalletService.createDelayedUnsignedPayoutTx(depositTx,
|
||||
donationAddressString,
|
||||
minerFee,
|
||||
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("Create delayedPayoutTx using selectionHeight {} and receivers {}", selectionHeight, delayedPayoutTxReceivers);
|
||||
long lockTime = trade.getLockTime();
|
||||
preparedDelayedPayoutTx = tradeWalletService.createDelayedUnsignedPayoutTx(
|
||||
depositTx,
|
||||
delayedPayoutTxReceivers,
|
||||
lockTime);
|
||||
|
||||
TradeDataValidation.validateDelayedPayoutTx(trade,
|
||||
preparedDelayedPayoutTx,
|
||||
|
Loading…
Reference in New Issue
Block a user