@@ -146,8 +146,8 @@ void GovernanceList::setClientModel(ClientModel* model)
146146 return ;
147147 }
148148 connect (clientModel, &ClientModel::additionalDataSyncProgressChanged, this , &GovernanceList::updateProposalButtons);
149- connect (clientModel, &ClientModel::governanceChanged, this , &GovernanceList:: handleProposalListChanged);
150- connect (clientModel, &ClientModel::numBlocksChanged, this , &GovernanceList:: handleProposalListChanged);
149+ connect (clientModel, &ClientModel::governanceChanged, this , [ this ] { handleProposalListChanged ( /* force= */ false ); } );
150+ connect (clientModel, &ClientModel::numBlocksChanged, this , [ this ] { handleProposalListChanged ( /* force= */ false ); } );
151151 connect (clientModel->getOptionsModel (), &OptionsModel::displayUnitChanged, this , &GovernanceList::updateDisplayUnit);
152152 if (walletModel && ui->proposalSourceCombo ->findData (ToUnderlying (ProposalSource::Local)) == -1 ) {
153153 ui->proposalSourceCombo ->addItem (tr (" My Proposals" ), ToUnderlying (ProposalSource::Local));
@@ -212,18 +212,21 @@ void GovernanceList::updateDisplayUnit()
212212 }
213213}
214214
215- void GovernanceList::handleProposalListChanged ()
215+ void GovernanceList::handleProposalListChanged (bool force )
216216{
217- if (!clientModel || m_timer->isActive ()) {
218- // Too early or already processing, nothing to do
217+ if (!clientModel) {
219218 return ;
220219 }
221- int delay{GOVERNANCELIST_UPDATE_SECONDS * 1000 };
222- if (!clientModel->masternodeSync ().isBlockchainSynced ()) {
223- // Currently syncing, reduce refreshes
224- delay *= 6 ;
220+ if (force) {
221+ updateProposalList ();
222+ } else if (!m_timer->isActive ()) {
223+ int delay{GOVERNANCELIST_UPDATE_SECONDS * 1000 };
224+ if (!clientModel->masternodeSync ().isBlockchainSynced ()) {
225+ // Currently syncing, reduce refreshes
226+ delay *= 6 ;
227+ }
228+ m_timer->start (delay);
225229 }
226- m_timer->start (delay);
227230}
228231
229232int GovernanceList::queryCollateralDepth (const uint256& collateralHash) const
@@ -246,7 +249,7 @@ void GovernanceList::updateProposalList()
246249
247250 if (m_in_progress.exchange (true )) {
248251 // Already applying, re-arm for next attempt
249- handleProposalListChanged ();
252+ handleProposalListChanged (/* force= */ false );
250253 return ;
251254 }
252255
@@ -382,7 +385,7 @@ void GovernanceList::showResumeProposalDialog()
382385
383386 const auto proposals = getWalletProposals (/* pending=*/ true );
384387 ProposalResume* dialog = new ProposalResume (clientModel->node (), clientModel, walletModel, proposals, this );
385- connect (dialog, &ProposalResume::proposalBroadcasted, this , &GovernanceList:: handleProposalListChanged);
388+ connect (dialog, &ProposalResume::proposalBroadcasted, this , [ this ] { handleProposalListChanged ( /* force= */ true ); } );
386389 dialog->setAttribute (Qt::WA_DeleteOnClose, true );
387390 dialog->setWindowModality (Qt::NonModal);
388391 dialog->setModal (false );
@@ -481,7 +484,7 @@ void GovernanceList::setProposalSource(int index)
481484{
482485 m_proposal_source = static_cast <ProposalSource>(ui->proposalSourceCombo ->itemData (index).toInt ());
483486 ui->govTableView ->setColumnHidden (ProposalModel::Column::VOTING_STATUS, m_proposal_source == ProposalSource::Local);
484- m_timer-> start ( 0 );
487+ handleProposalListChanged ( /* force= */ true );
485488}
486489
487490void GovernanceList::voteYes () { voteForProposal (VOTE_OUTCOME_YES); }
@@ -632,7 +635,7 @@ void GovernanceList::voteForProposal(vote_outcome_enum_t outcome)
632635 QMessageBox::information (this , tr (" Voting Results" ), message);
633636
634637 // Update proposal list to show new vote counts
635- handleProposalListChanged ();
638+ handleProposalListChanged (/* force= */ true );
636639}
637640
638641void GovernanceList::showEvent (QShowEvent* event)
0 commit comments