Окно опций теперь QWidget
[novacoin.git] / src / qt / multisigdialog.cpp
index b19d4d5..e8ad839 100644 (file)
@@ -164,11 +164,31 @@ void MultisigDialog::on_createAddressButton_clicked()
         pubkeys[i].SetPubKey(vchPubKey);
     }
 
-    if((required == 0) || (required > pubkeys.size()))
+    if(pubkeys.size() > 16)
+    {
+        QMessageBox::warning(this, tr("Error"), tr("Number of addresses involved in the address creation > %1\nReduce the number").arg(16), QMessageBox::Ok);
+        return;
+    }
+
+    if(required == 0)
+    {
+        QMessageBox::warning(this, tr("Error"), tr("Number of required signatures is 0\nNumber of required signatures must be between 1 and number of keys involved in the creation of address."), QMessageBox::Ok);
         return;
+    }
 
+    if(required > pubkeys.size())
+    {
+        QMessageBox::warning(this, tr("Error"), tr("Number of required signatures > Number of keys involved in the creation of address."), QMessageBox::Ok);
+        return;
+    }
+    
     CScript script;
     script.SetMultisig(required, pubkeys);
+    if (script.size() > MAX_SCRIPT_ELEMENT_SIZE)
+    {
+        QMessageBox::warning(this, tr("Error"), tr("Redeem script exceeds size limit: %1 > %2\nReduce the number of addresses involved in the address creation.").arg(script.size()).arg(MAX_SCRIPT_ELEMENT_SIZE), QMessageBox::Ok);
+        return;
+    }
     CScriptID scriptID = script.GetID();
     CBitcoinAddress address(scriptID);
 
@@ -404,7 +424,7 @@ void MultisigDialog::on_signTransactionButton_clicked()
 
     // Fetch previous transactions (inputs)
     std::map<COutPoint, CScript> mapPrevOut;
-    for(int i = 0; i < mergedTx.vin.size(); i++)
+    for(unsigned int i = 0; i < mergedTx.vin.size(); i++)
     {
         CTransaction tempTx;
         MapPrevTx mapPrevTx;
@@ -445,7 +465,7 @@ void MultisigDialog::on_signTransactionButton_clicked()
 
     // Sign what we can
     bool fComplete = true;
-    for(int i = 0; i < mergedTx.vin.size(); i++)
+    for(unsigned int i = 0; i < mergedTx.vin.size(); i++)
     {
         CTxIn& txin = mergedTx.vin[i];
         if(mapPrevOut.count(txin.prevout) == 0)