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

Fix premature validation call #5894

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 @@ -62,7 +62,7 @@ public class LiteNodeNetworkService implements MessageListener, ConnectionListen

private static final long RETRY_DELAY_SEC = 10;
private static final long CLEANUP_TIMER = 120;
private static final int MAX_RETRY = 3;
private static final int MAX_RETRY = 12;

private int retryCounter = 0;
private int lastRequestedBlockHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package bisq.core.dao.state;

import bisq.core.btc.setup.WalletsSetup;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.dao.DaoSetupService;
import bisq.core.dao.governance.param.Param;
import bisq.core.dao.monitoring.DaoStateMonitoringService;
Expand Down Expand Up @@ -63,6 +65,8 @@ public class DaoStateSnapshotService implements DaoSetupService, DaoStateListene
private final GenesisTxInfo genesisTxInfo;
private final DaoStateStorageService daoStateStorageService;
private final DaoStateMonitoringService daoStateMonitoringService;
private final WalletsSetup walletsSetup;
private final BsqWalletService bsqWalletService;
private final Preferences preferences;
private final Config config;
private final File storageDir;
Expand All @@ -88,13 +92,17 @@ public DaoStateSnapshotService(DaoStateService daoStateService,
GenesisTxInfo genesisTxInfo,
DaoStateStorageService daoStateStorageService,
DaoStateMonitoringService daoStateMonitoringService,
WalletsSetup walletsSetup,
BsqWalletService bsqWalletService,
Preferences preferences,
Config config,
@Named(Config.STORAGE_DIR) File storageDir) {
this.daoStateService = daoStateService;
this.genesisTxInfo = genesisTxInfo;
this.daoStateStorageService = daoStateStorageService;
this.daoStateMonitoringService = daoStateMonitoringService;
this.walletsSetup = walletsSetup;
this.bsqWalletService = bsqWalletService;
this.preferences = preferences;
this.config = config;
this.storageDir = storageDir;
Expand All @@ -121,7 +129,9 @@ public void start() {

@Override
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
if (config.baseCurrencyNetwork.isMainnet()) {
if (config.baseCurrencyNetwork.isMainnet() &&
walletsSetup.isDownloadComplete() &&
daoStateService.getChainHeight() == bsqWalletService.getBestChainHeight()) {
// In case the DAO state is invalid we might get an outdated RECIPIENT_BTC_ADDRESS. In that case we trigger
// a dao resync from resources.
String address = daoStateService.getParamValue(Param.RECIPIENT_BTC_ADDRESS, daoStateService.getChainHeight());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public void setup() {
mock(DaoStateMonitoringService.class),
null,
null,
null,
null,
null);
}

Expand Down