Skip to content

Commit bdb13c8

Browse files
committed
[GUI][Model] Enforce required depth for mn collaterals
Notify the user about the required confirmations (MASTERNODE_MIN_CONFIRMATIONS) after masternode creation and when trying to start too early. Consider MNModel::WAS_COLLATERAL_ACCEPTED only when the tx has the required depth.
1 parent 1c197d2 commit bdb13c8

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/qt/pivx/masternodeswidget.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,17 @@ bool MasterNodesWidget::checkMNsNetwork()
208208
void MasterNodesWidget::onEditMNClicked()
209209
{
210210
if (walletModel) {
211-
if (!checkMNsNetwork()) return;
211+
if (!Params().IsRegTestNet() && !checkMNsNetwork()) return; // skip on RegNet: so we can test even if tier two not synced
212212
if (index.sibling(index.row(), MNModel::WAS_COLLATERAL_ACCEPTED).data(Qt::DisplayRole).toBool()) {
213213
// Start MN
214214
QString strAlias = this->index.data(Qt::DisplayRole).toString();
215215
if (ask(tr("Start Masternode"), tr("Are you sure you want to start masternode %1?\n").arg(strAlias))) {
216216
if (!verifyWalletUnlocked()) return;
217217
startAlias(strAlias);
218218
}
219-
}else {
220-
inform(tr("Cannot start masternode, the collateral transaction has not been accepted by the network.\nPlease wait few more minutes."));
219+
} else {
220+
inform(tr("Cannot start masternode, the collateral transaction has not been confirmed by the network yet.\n"
221+
"Please wait few more minutes (masternode collaterals require %1 confirmations).").arg(MASTERNODE_MIN_CONFIRMATIONS));
221222
}
222223
}
223224
}

src/qt/pivx/masternodewizarddialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ bool MasterNodeWizardDialog::createMN()
335335
COutPoint collateralOut(walletTx->GetHash(), indexOut);
336336
walletModel->lockCoin(collateralOut);
337337

338-
returnStr = tr("Master node created!");
338+
returnStr = tr("Master node created! Wait %1 confirmations before starting it.").arg(MASTERNODE_MIN_CONFIRMATIONS);
339339
return true;
340340
} else{
341341
returnStr = tr("masternode.conf file doesn't exists");

src/qt/pivx/mnmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void MNModel::updateMNList()
3939
{
4040
LOCK2(cs_main, pwalletMain->cs_wallet);
4141
const CWalletTx *walletTx = pwalletMain->GetWalletTx(txHash);
42-
if (walletTx && walletTx->GetDepthInMainChain() > 0) {
42+
if (walletTx && walletTx->GetDepthInMainChain() >= MASTERNODE_MIN_CONFIRMATIONS) {
4343
txAccepted = true;
4444
}
4545
}

0 commit comments

Comments
 (0)