File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,23 @@ void GovernanceWidget::onVoteForPropClicked(const ProposalInfo& proposalInfo)
143143
144144void GovernanceWidget::onCreatePropClicked ()
145145{
146- if (!walletModel || !governanceModel) return ;
146+ if (!walletModel || !governanceModel || !clientModel) return ;
147+
148+ if (!governanceModel->isTierTwoSync ()) {
149+ inform (tr (" Please wait until the node is fully synced" ));
150+ return ;
151+ }
152+
153+ // Do not allow proposals submission 1440 blocks away (1 day) from the next superblock
154+ // The budget finalization could have been submitted and the user would never know it, losing the first superblock.
155+ // future: customizable future superblock height selection (for now, we are automatically using the next superblock).
156+ const int chainHeight = clientModel->getLastBlockProcessedHeight ();
157+ const int nextSuperblock = governanceModel->getNextSuperblockHeight ();
158+ const int acceptedRange = (walletModel->isTestNetwork () || walletModel->isRegTestNetwork ()) ? 10 : 1440 ;
159+ if (nextSuperblock - acceptedRange < chainHeight) {
160+ inform (tr (" Cannot create proposal, superblock is too close. Need to wait %1 blocks" ).arg (nextSuperblock - chainHeight));
161+ return ;
162+ }
147163
148164 auto ptrUnlockedContext = std::make_unique<WalletModel::UnlockContext>(walletModel->requestUnlock ());
149165 if (!ptrUnlockedContext->isValid ()) {
You can’t perform that action at this time.
0 commit comments