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

[GUI] Governance, do not open the proposal creation wizard if node is in IBD. #2670

Merged
Merged
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
18 changes: 17 additions & 1 deletion src/qt/pivx/governancewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,23 @@ void GovernanceWidget::onVoteForPropClicked(const ProposalInfo& proposalInfo)

void GovernanceWidget::onCreatePropClicked()
{
if (!walletModel || !governanceModel) return;
if (!walletModel || !governanceModel || !clientModel) return;

if (!governanceModel->isTierTwoSync()) {
inform(tr("Please wait until the node is fully synced"));
return;
}

// Do not allow proposals submission 1440 blocks away (1 day) from the next superblock
// The budget finalization could have been submitted and the user would never know it, losing the first superblock.
// future: customizable future superblock height selection (for now, we are automatically using the next superblock).
const int chainHeight = clientModel->getLastBlockProcessedHeight();
const int nextSuperblock = governanceModel->getNextSuperblockHeight();
const int acceptedRange = (walletModel->isTestNetwork() || walletModel->isRegTestNetwork()) ? 10 : 1440;
if (nextSuperblock - acceptedRange < chainHeight) {
inform(tr("Cannot create proposal, superblock is too close. Need to wait %1 blocks").arg(nextSuperblock - chainHeight));
return;
}

auto ptrUnlockedContext = std::make_unique<WalletModel::UnlockContext>(walletModel->requestUnlock());
if (!ptrUnlockedContext->isValid()) {
Expand Down