mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 22:45:21 +01:00
Remove daoActivated options
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
cc8fe09d87
commit
008cfaac57
8 changed files with 27 additions and 62 deletions
|
@ -34,7 +34,6 @@ public class DevEnv {
|
|||
|
||||
public static void setup(Config config) {
|
||||
DevEnv.setDevMode(config.useDevMode);
|
||||
DevEnv.setDaoActivated(config.daoActivated);
|
||||
}
|
||||
|
||||
// If set to true we ignore several UI behavior like confirmation popups as well dummy accounts are created and
|
||||
|
@ -49,14 +48,8 @@ public class DevEnv {
|
|||
DevEnv.devMode = devMode;
|
||||
}
|
||||
|
||||
private static boolean daoActivated = true;
|
||||
|
||||
public static boolean isDaoActivated() {
|
||||
return daoActivated;
|
||||
}
|
||||
|
||||
public static void setDaoActivated(boolean daoActivated) {
|
||||
DevEnv.daoActivated = daoActivated;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void logErrorAndThrowIfDevMode(String msg) {
|
||||
|
|
|
@ -115,7 +115,6 @@ public class Config {
|
|||
public static final String GENESIS_TX_ID = "genesisTxId";
|
||||
public static final String GENESIS_BLOCK_HEIGHT = "genesisBlockHeight";
|
||||
public static final String GENESIS_TOTAL_SUPPLY = "genesisTotalSupply";
|
||||
public static final String DAO_ACTIVATED = "daoActivated";
|
||||
public static final String DUMP_DELAYED_PAYOUT_TXS = "dumpDelayedPayoutTxs";
|
||||
public static final String ALLOW_FAULTY_DELAYED_TXS = "allowFaultyDelayedTxs";
|
||||
public static final String API_PASSWORD = "apiPassword";
|
||||
|
@ -169,7 +168,6 @@ public class Config {
|
|||
public final NetworkParameters networkParameters;
|
||||
public final boolean ignoreLocalBtcNode;
|
||||
public final String bitcoinRegtestHost;
|
||||
public final boolean daoActivated;
|
||||
public final String referralId;
|
||||
public final boolean useDevMode;
|
||||
public final boolean useDevModeHeader;
|
||||
|
@ -626,12 +624,6 @@ public class Config {
|
|||
.ofType(long.class)
|
||||
.defaultsTo(-1L);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Boolean> daoActivatedOpt =
|
||||
parser.accepts(DAO_ACTIVATED, "If set to true dao is activated.")
|
||||
.withRequiredArg()
|
||||
.ofType(boolean.class)
|
||||
.defaultsTo(true);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Boolean> dumpDelayedPayoutTxsOpt =
|
||||
parser.accepts(DUMP_DELAYED_PAYOUT_TXS, "Dump delayed payout transactions to file")
|
||||
.withRequiredArg()
|
||||
|
@ -798,7 +790,6 @@ public class Config {
|
|||
this.genesisTxId = options.valueOf(genesisTxIdOpt);
|
||||
this.genesisBlockHeight = options.valueOf(genesisBlockHeightOpt);
|
||||
this.genesisTotalSupply = options.valueOf(genesisTotalSupplyOpt);
|
||||
this.daoActivated = options.valueOf(daoActivatedOpt);
|
||||
this.dumpDelayedPayoutTxs = options.valueOf(dumpDelayedPayoutTxsOpt);
|
||||
this.allowFaultyDelayedTxs = options.valueOf(allowFaultyDelayedTxsOpt);
|
||||
this.apiPassword = options.valueOf(apiPasswordOpt);
|
||||
|
|
|
@ -74,15 +74,12 @@ public class AppSetupWithP2PAndDAO extends AppSetupWithP2P {
|
|||
this.daoSetup = daoSetup;
|
||||
this.preferences = preferences;
|
||||
|
||||
// TODO Should be refactored/removed. In the meantime keep in sync with CorePersistedDataHost
|
||||
if (config.daoActivated) {
|
||||
persistedDataHosts.add(myVoteListService);
|
||||
persistedDataHosts.add(ballotListService);
|
||||
persistedDataHosts.add(myBlindVoteListService);
|
||||
persistedDataHosts.add(myProposalListService);
|
||||
persistedDataHosts.add(myReputationListService);
|
||||
persistedDataHosts.add(myProofOfBurnListService);
|
||||
}
|
||||
persistedDataHosts.add(myVoteListService);
|
||||
persistedDataHosts.add(ballotListService);
|
||||
persistedDataHosts.add(myBlindVoteListService);
|
||||
persistedDataHosts.add(myProposalListService);
|
||||
persistedDataHosts.add(myReputationListService);
|
||||
persistedDataHosts.add(myProofOfBurnListService);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -222,7 +222,6 @@ public class DaoModule extends AppModule {
|
|||
bindConstant().annotatedWith(named(Config.RPC_BLOCK_NOTIFICATION_HOST)).to(config.rpcBlockNotificationHost);
|
||||
bindConstant().annotatedWith(named(Config.DUMP_BLOCKCHAIN_DATA)).to(config.dumpBlockchainData);
|
||||
bindConstant().annotatedWith(named(Config.FULL_DAO_NODE)).to(config.fullDaoNode);
|
||||
bindConstant().annotatedWith(named(Config.DAO_ACTIVATED)).to(config.daoActivated);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
|
|||
import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreListener;
|
||||
import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreService;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
@ -67,16 +65,14 @@ public class BlindVoteListService implements AppendOnlyDataStoreListener, DaoSta
|
|||
PeriodService periodService,
|
||||
BlindVoteStorageService blindVoteStorageService,
|
||||
AppendOnlyDataStoreService appendOnlyDataStoreService,
|
||||
BlindVoteValidator blindVoteValidator,
|
||||
Config config) {
|
||||
BlindVoteValidator blindVoteValidator) {
|
||||
this.daoStateService = daoStateService;
|
||||
this.p2PService = p2PService;
|
||||
this.periodService = periodService;
|
||||
this.blindVoteStorageService = blindVoteStorageService;
|
||||
this.blindVoteValidator = blindVoteValidator;
|
||||
|
||||
if (config.daoActivated)
|
||||
appendOnlyDataStoreService.addService(blindVoteStorageService);
|
||||
appendOnlyDataStoreService.addService(blindVoteStorageService);
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,7 +147,8 @@ public class BlindVoteListService implements AppendOnlyDataStoreListener, DaoSta
|
|||
blindVoteStorageService.getMap().values().forEach(e -> onAppendOnlyDataAdded(e, false));
|
||||
}
|
||||
|
||||
private void onAppendOnlyDataAdded(PersistableNetworkPayload persistableNetworkPayload, boolean fromBroadcastMessage) {
|
||||
private void onAppendOnlyDataAdded(PersistableNetworkPayload persistableNetworkPayload,
|
||||
boolean fromBroadcastMessage) {
|
||||
if (persistableNetworkPayload instanceof BlindVotePayload) {
|
||||
BlindVotePayload blindVotePayload = (BlindVotePayload) persistableNetworkPayload;
|
||||
if (!blindVotePayloads.contains(blindVotePayload)) {
|
||||
|
|
|
@ -40,14 +40,10 @@ import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreListener;
|
|||
import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreService;
|
||||
import bisq.network.p2p.storage.persistence.ProtectedDataStoreService;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
|
@ -97,19 +93,16 @@ public class ProposalService implements HashMapChangedListener, AppendOnlyDataSt
|
|||
AppendOnlyDataStoreService appendOnlyDataStoreService,
|
||||
ProtectedDataStoreService protectedDataStoreService,
|
||||
DaoStateService daoStateService,
|
||||
ProposalValidatorProvider validatorProvider,
|
||||
@Named(Config.DAO_ACTIVATED) boolean daoActivated) {
|
||||
ProposalValidatorProvider validatorProvider) {
|
||||
this.p2PService = p2PService;
|
||||
this.periodService = periodService;
|
||||
this.proposalStorageService = proposalStorageService;
|
||||
this.daoStateService = daoStateService;
|
||||
this.validatorProvider = validatorProvider;
|
||||
|
||||
if (daoActivated) {
|
||||
// We add our stores to the global stores
|
||||
appendOnlyDataStoreService.addService(proposalStorageService);
|
||||
protectedDataStoreService.addService(tempProposalStorageService);
|
||||
}
|
||||
// We add our stores to the global stores
|
||||
appendOnlyDataStoreService.addService(proposalStorageService);
|
||||
protectedDataStoreService.addService(tempProposalStorageService);
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,14 +191,14 @@ public class ProposalService implements HashMapChangedListener, AppendOnlyDataSt
|
|||
public Coin getRequiredQuorum(Proposal proposal) {
|
||||
int chainHeight = daoStateService.getTx(proposal.getTxId())
|
||||
.map(BaseTx::getBlockHeight).
|
||||
orElse(daoStateService.getChainHeight());
|
||||
orElse(daoStateService.getChainHeight());
|
||||
return daoStateService.getParamValueAsCoin(proposal.getQuorumParam(), chainHeight);
|
||||
}
|
||||
|
||||
public double getRequiredThreshold(Proposal proposal) {
|
||||
int chainHeight = daoStateService.getTx(proposal.getTxId())
|
||||
.map(BaseTx::getBlockHeight).
|
||||
orElse(daoStateService.getChainHeight());
|
||||
orElse(daoStateService.getChainHeight());
|
||||
return daoStateService.getParamValueAsPercentDouble(proposal.getThresholdParam(), chainHeight);
|
||||
}
|
||||
|
||||
|
@ -308,7 +301,8 @@ public class ProposalService implements HashMapChangedListener, AppendOnlyDataSt
|
|||
tempProposals.retainAll(tempProposalsWithUpdates);
|
||||
}
|
||||
|
||||
private void onAppendOnlyDataAdded(PersistableNetworkPayload persistableNetworkPayload, boolean fromBroadcastMessage) {
|
||||
private void onAppendOnlyDataAdded(PersistableNetworkPayload persistableNetworkPayload,
|
||||
boolean fromBroadcastMessage) {
|
||||
if (persistableNetworkPayload instanceof ProposalPayload) {
|
||||
ProposalPayload proposalPayload = (ProposalPayload) persistableNetworkPayload;
|
||||
if (!proposalPayloads.contains(proposalPayload)) {
|
||||
|
|
|
@ -45,9 +45,7 @@ public class CoreNetworkCapabilities {
|
|||
Capability.BSQ_SWAP_OFFER
|
||||
);
|
||||
|
||||
if (config.daoActivated) {
|
||||
maybeApplyDaoFullMode(config);
|
||||
}
|
||||
maybeApplyDaoFullMode(config);
|
||||
|
||||
log.info(Capabilities.app.prettyPrint());
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import bisq.network.p2p.peers.PeerManager;
|
|||
import bisq.network.p2p.storage.P2PDataStorage;
|
||||
import bisq.network.p2p.storage.persistence.RemovedPayloadsService;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.proto.persistable.PersistedDataHost;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
|
@ -74,16 +73,13 @@ public class CorePersistedDataHost {
|
|||
persistedDataHosts.add(injector.getInstance(MailboxMessageService.class));
|
||||
persistedDataHosts.add(injector.getInstance(IgnoredMailboxService.class));
|
||||
persistedDataHosts.add(injector.getInstance(RemovedPayloadsService.class));
|
||||
|
||||
if (injector.getInstance(Config.class).daoActivated) {
|
||||
persistedDataHosts.add(injector.getInstance(BallotListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyBlindVoteListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyVoteListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyProposalListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyReputationListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyProofOfBurnListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(UnconfirmedBsqChangeOutputListService.class));
|
||||
}
|
||||
persistedDataHosts.add(injector.getInstance(BallotListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyBlindVoteListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyVoteListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyProposalListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyReputationListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(MyProofOfBurnListService.class));
|
||||
persistedDataHosts.add(injector.getInstance(UnconfirmedBsqChangeOutputListService.class));
|
||||
return persistedDataHosts;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue