устранил предупреждения компилятора
[novacoin.git] / src / qt / multisigdialog.cpp
index 8e237cb..52eb978 100644 (file)
 #include "txdb-bdb.h"
 #endif
 
+#ifdef _MSC_VER
+#pragma warning( disable : 4101)
+#endif
+
 MultisigDialog::MultisigDialog(QWidget *parent) : QDialog(parent), ui(new Ui::MultisigDialog), model(0)
 {
     ui->setupUi(this);
@@ -164,11 +168,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);