Use CBitcoinAddress ti store change destination
authorCryptoManiac <balthazar@yandex.ru>
Sun, 6 Mar 2016 21:47:41 +0000 (00:47 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Sun, 6 Mar 2016 21:47:41 +0000 (00:47 +0300)
src/coincontrol.h
src/qt/bitcoinaddressvalidator.h
src/qt/forms/sendcoinsentry.ui
src/qt/sendcoinsdialog.cpp
src/wallet.cpp

index 236b586..a64a0ec 100644 (file)
@@ -1,11 +1,13 @@
 #ifndef COINCONTROL_H
 #define COINCONTROL_H
 
+#include "base58.h"
+
 /** Coin Control Features. */
 class CCoinControl
 {
 public:
-    CTxDestination destChange;
+    CBitcoinAddress destChange;
 
     CCoinControl()
     {
@@ -14,7 +16,7 @@ public:
         
     void SetNull()
     {
-        destChange = CNoDestination();
+        destChange = CBitcoinAddress();
         setSelected.clear();
     }
     
index 9710d12..6cad8ce 100644 (file)
@@ -14,7 +14,7 @@ public:
 
     State validate(QString &input, int &pos) const;
 
-    static const int MaxAddressLength = 35;
+    static const int MaxAddressLength = 99;
 signals:
 
 public slots:
index 3d90e49..bdbffb1 100644 (file)
@@ -58,7 +58,7 @@
       <number>0</number>
      </property>
      <item>
-      <widget class="QValidatedLineEdit" name="addAsLabel">
+      <widget class="QValidatedLineEdit" name="addAsLabel" native="true">
        <property name="enabled">
         <bool>true</bool>
        </property>
       <number>0</number>
      </property>
      <item>
-      <widget class="QValidatedLineEdit" name="payTo">
+      <widget class="QValidatedLineEdit" name="payTo" native="true">
        <property name="toolTip">
         <string>The address to send the payment to  (e.g. 4Zo1ga6xuKuQ7JV7M9rGDoxdbYwV5zgQJ5)</string>
        </property>
-       <property name="maxLength">
-        <number>34</number>
+       <property name="maxLength" stdset="0">
+        <number>100</number>
        </property>
       </widget>
      </item>
  <customwidgets>
   <customwidget>
    <class>QValidatedLineEdit</class>
-   <extends>QLineEdit</extends>
+   <extends>QWidget</extends>
    <header>qvalidatedlineedit.h</header>
   </customwidget>
   <customwidget>
index e40205b..b0e7382 100644 (file)
@@ -131,12 +131,12 @@ void SendCoinsDialog::on_sendButton_clicked()
         if(!ui->lineEditCoinControlChange->hasAcceptableInput() ||
            (model && !model->validateAddress(ui->lineEditCoinControlChange->text())))
         {
-            CoinControlDialog::coinControl->destChange = CNoDestination();
+            CoinControlDialog::coinControl->destChange = CBitcoinAddress();
             ui->lineEditCoinControlChange->setValid(false);
             valid = false;
         }
         else
-            CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString()).Get();
+            CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString());
     }
 
     for(int i = 0; i < ui->entries->count(); ++i)
@@ -461,9 +461,9 @@ void SendCoinsDialog::coinControlChangeChecked(int state)
     if (model)
     {
         if (state == Qt::Checked)
-            CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString()).Get();
+            CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString());
         else
-            CoinControlDialog::coinControl->destChange = CNoDestination();
+            CoinControlDialog::coinControl->destChange = CBitcoinAddress();
     }
 
     ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked));
index ab44a9b..1846d17 100644 (file)
@@ -1688,8 +1688,8 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
                     CScript scriptChange;
 
                     // coin control: send change to custom address
-                    if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange))
-                        scriptChange.SetDestination(coinControl->destChange);
+                    if (coinControl && coinControl->destChange.IsValid())
+                        scriptChange.SetAddress(coinControl->destChange);
 
                     // no coin control: send change to newly generated address
                     else