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