[Dev] Documenting Feathercoin Specific Software settings - Part 6
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
New FTC multisign address prefix f : - commit
https://github.com/FeatherCoin/Feathercoin/commit/ed07f1dda9678436dbb939de056f703aa63c087c
src/rpcrawtransaction.cpp
Multisignature addresses
+ entry.push_back(Pair("locktime", (int64_t)tx.nLockTime)); + in.push_back(Pair("vout", (int64_t)txin.prevout.n)); + in.push_back(Pair("sequence", (int64_t)txin.nSequence)); + out.push_back(Pair("n", (int64_t)i)); + entry.push_back(Pair("time", (int64_t)pindex ->nTime)); + entry.push_back(Pair("blocktime", (int64_t)pindex ->nTime)); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Feathercoin address: ") + s.name_); + "1. \"hex\" (string, required) The transaction hex string\n" + " \"txid\" : \"id\", (string) The transaction id\n"
Code replaced
- " \"hex\" : \"data\", (string) The serialized, hex -encoded data for 'txid'\n" - " \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
Code removed
- " \"blockhash\" : \"hash\", (string) the block hash\n" - " \"confirmations\" : n, (numeric) The confirmations\n" - " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n" - " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
Code removed
+ " \"redeemScript\": \"hex\" (string, required for P2SH) redeem script\n" + "4. \"sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n"
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
New FTC multisign address prefix f : - commit
https://github.com/FeatherCoin/Feathercoin/commit/ed07f1dda9678436dbb939de056f703aa63c087c
src/rpcwallet.cpp
Multisignature addresses
+ "\nReturns a new feathercoin address for receiving payments.\n" + "\"feathercoinaddress\" (string) The new feathercoin address\n" + "\nReturns the current feathercoin address for receiving payments to this account.\n" + "\"feathercoinaddress\" (string) The account feathercoin address\n" + "\nReturns a new feathercoin address, for receiving change.\n" + "setaccount \"feathercoinaddress\" \"account\"\n" + "1. \"feathercoinaddress\" (string, required) The feathercoin address to be associated with an account.\n" + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid feathercoin address"); + "getaccount \"feathercoinaddress\"\n" + "1. \"feathercoinaddress\" (string, required) The feathercoin address for account lookup.\n" + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid feathercoin address"); + " \"feathercoinaddress\" (string) a feathercoin address associated with the given account\n" + "sendtoaddress \"feathercoinaddress\" amount ( \"comment\" \"comment-to\" )\n" + "1. \"feathercoinaddress\" (string, required) The feathercoin address to send to.\n" + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid feathercoin address"); + " \"feathercoinaddress\", (string) The feathercoin address\n" + "signmessage \"feathercoinaddress\" \"message\"\n" + "1. \"feathercoinaddress\" (string, required) The feathercoin address to use for the private key.\n" + "getreceivedbyaddress \"feathercoinaddress\" ( minconf )\n" + "\nReturns the total amount received by the given feathercoinaddress in transactions with at least minconf confirmations.\n" + "1. \"feathercoinaddress\" (string, required) The feathercoin address for transactions.\n" + // feathercoin address + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid feathercoin address"); + "sendfrom \"fromaccount\" \"tofeathercoinaddress\" amount ( minconf \"comment\" \"comment-to\" )\n" + "2. \"tofeathercoinaddress\" (string, required) The feathercoin address to send funds to.\n" + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid feathercoin address"); + " \"address\":amount (numeric) The feathercoin address is the key, the numeric amount in btc is the value\n" + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid feathercoin address: ") + s.name_); + "Each key is a feathercoin address or hex-encoded public key.\n" + "2. \"keysobject\" (string, required) A json array of feathercoin addresses or hex-encoded public keys\n" + " \"address\" (string) feathercoin address or hex-encoded public key\n" + " \"address\":\"feathercoinaddress\", (string) The feathercoin address of the transaction. Not present for \n" + " \"address\":\"feathercoinaddress\", (string) The feathercoin address of the transaction. Not present for move transactions (category = move).\n" + " \"address\" : \"feathercoinaddress\", (string) The feathercoin address involved in the transaction\n"
Feathercoin name interface changes
+ "This is needed prior to performing transactions related to private keys such as sending feathercoins\n" + "\nNow set the passphrase to use the wallet, such as for signing or sending feathercoin\n" + + HelpExampleCli("signmessage", "\"feathercoinaddress\" \"test message\"") + + return "wallet encrypted; feathercoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; + "A locked transaction output will not be chosen by automatic coin selection, when spending feathercoins.\n" + " \"balance\": xxxxxxx, (numeric) the total feathercoin balance of the wallet\n"
Name changes to Feathercoin
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/feathercoin.qrc
+ <file alias="merchant_bittylicious">res/images/bittylicious.png</file> + <file alias="merchant_vircurex">res/images/vircurex.png</file>
Additional code jpgs?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/forms/aboutdialog.ui
+ <width>555</width>
size change
+ <widget class="QLabel" name="label_11"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item>
Additional code
- <string><html><head/><body><p><br/>This is not experiment,This is our real life and great history.Our goal is to let you have a good time.</p><p><br/>Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit -license.php.</p><p>This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</p></body></html></string>
Code removed
+ <string>This is not experiment,This is our real life and great history.</string>
Code added ?? review
+ <bool>false</bool>
code change defaults
+ <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Our goal is to let you have a good time.</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Distributed under the MIT/X11 software license, see the accompanying file</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>COPYING or http://www.opensource.org/licenses/mit-license.php.</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>This product includes software developed by the OpenSSL Project for use</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>software written by Eric Young ([email protected]) and UPnP software</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>written by Thomas Bernard.</string> + </property> + </widget> + </item> + <item>
Code added
- <include location="C:/Users/lizhi.lizhi-PC/.designer/feathercoin.qrc"/>
Code removed, noted from before?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/forms/merchantlist.ui
+ <width>805</width>
Code updated
+ <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property> + <property name="toolTip"> + <string>a altcoin currency exchange</string> + </property>
Code added
+ <property name="pixmap"> + <pixmap resource="../feathercoin.qrc">:/images/merchant_vircurex</pixmap> + </property>
Code added
+ <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item>
Code added
+ <pixmap resource="../feathercoin.qrc">:/images/merchant_bittylicious</pixmap>
Code replaced
+ <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item>
Code added
+ <item> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item>
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/forms/shiftdialog.ui
+ <height>428</height> + <number>1</number>
Code replaced
+ <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label_36"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>FTC/LTC</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_37"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_38"> + <property name="font"> + <font> + <underline>true</underline> + </font> + </property> + <property name="text"> + <string>0.0001234</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_8"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_39"> + <property name="font"> + <font> + <underline>true</underline> + </font> + </property> + <property name="text"> + <string>1000</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label_41"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>FTC/BC</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_40"> + <property name="text"> + <string>....</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_42"> + <property name="font"> + <font> + <underline>true</underline> + </font> + </property> + <property name="text"> + <string>0.0001234</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_10"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_43"> + <property name="font"> + <font> + <underline>true</underline> + </font> + </property> + <property name="text"> + <string>1000</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_9"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item>
Code added
+ <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property>
Code Added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/locale/bitcoin_zh_CN.ts
Very Large number of changes to translation file. translations and new referances
+ <TS language="zh_CN" version="2.1"> <context> <name>AboutDialog</name> <name>AboutDialog</name> <message> - <location filename="../forms/aboutdialog.ui" line=" + 14"/> + <source>About Feathercoin Core</source> + <translation>关于羽毛币核心</translation>
Start of code changes
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/merchantlist.cpp
+ if (obj == ui->label_left_6) { + QDesktopServices::openUrl(QUrl("https://vircurex.com/welcome/index?alt=btc&base=ftc")); + return true; + }
Code added
- QDesktopServices::openUrl(QUrl("https://mcxnow.com/exchange/FTC")); + QDesktopServices::openUrl(QUrl("https://bittylicious.com/"));
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update merchantlist : - commit
https://github.com/FeatherCoin/Feathercoin/commit/61959aba3255810c33aae1d7f9e72a32f2de3e85
src/qt/res/images/*
src/qt/res/images/bittylicious.png src/qt/res/images/bter.png src/qt/res/images/vircurex.png
Images added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add a head file : - commit
https://github.com/FeatherCoin/Feathercoin/commit/fe4e5fc6f2734ff0230487150449c0fd03cccf2f
src/qt/qrcodedialog.h
+ #ifndef QRCODEDIALOG_H + #define QRCODEDIALOG_H + + #include <QDialog> + #include <QImage> + + namespace Ui { + class QRCodeDialog; + } + class OptionsModel; + + class QRCodeDialog : public QDialog + { + Q_OBJECT + + public: + explicit QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent = 0); + ~QRCodeDialog(); + + void setModel(OptionsModel *model); + + private slots: + void on_lnReqAmount_textChanged(); + void on_lnLabel_textChanged(); + void on_lnMessage_textChanged(); + void on_btnSaveAs_clicked(); + void on_chkReqPayment_toggled(bool fChecked); + + void updateDisplayUnit(); + + private: + Ui::QRCodeDialog *ui; + OptionsModel *model; + QString address; + QImage myImage; + + void genCode(); + QString getURI(); + }; + + #endif // QRCODEDIALOG_H
New code / file
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/Makefile.am
+ stealth.h \ + stealth.cpp \
Add code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/base58.cpp
+ bool operator()(const CScriptID &id) const { return addr->Set(id); } + bool operator()(const CStealthAddress &stxAddr) const { return false; }
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/bitcoin-config.h
+/* Define to 1 libzxing must be available for support */ +#define USE_ZXING 1
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/crypter.cpp
+bool CCryptoKeyStore::LockKeyStore()
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/crypter.h
- CryptedKeyMap mapCryptedKeys; - - CKeyingMaterial vMasterKey; -
Code removed
+ CryptedKeyMap mapCryptedKeys; + + CKeyingMaterial vMasterKey; +
Code added
+ //bool Lock(); + bool LockKeyStore();
code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/key.cpp
+ bool CKey::SetSecret(const CSecret& vchSecret, bool fCompressedIn) + { + if (vchSecret.size() != 32) + return false; + + CECKey key; + key.SetSecretBytes(&vchSecret[0]); + + fCompressed = fCompressedIn; + fValid = true; + return true; + + /*EC_KEY_free(pkey); + pkey = EC_KEY_new_by_curve_name(NID_secp256k1); + if (pkey == NULL) + return false; + if (vchSecret.size() != 32) + return false; + BIGNUM *bn = BN_bin2bn(&vchSecret[0],32,BN_new()); + if (bn == NULL) + return false; + if (!EC_KEY_regenerate_key(pkey,bn)) + { + BN_clear_free(bn); + return false; + } + BN_clear_free(bn); + fValid = true; + if (fCompressed ) + SetCompressedPubKey(); + return true;*/ + } +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/key.h
+ std::vector<unsigned char> Raw() const { + std::vector<unsigned char> vchPubKey(begin(),end()); + return vchPubKey; + } +
Code added
+// CSecret is a serialization of just the secret parameter (32 bytes) +typedef std::vector<unsigned char, secure_allocator<unsigned char> > CSecret;
Code added
+ bool SetSecret(const CSecret& vchSecret, bool fCompressed = false);
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/main.cpp
+ unsigned int nTxnOut = 0;
Code added
+ { nDataOut++; + }
Bracketing added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/qt/addressbookpage.cpp
+ ui->tableView->horizontalHeader()->resizeSection(0, 140); + ui->tableView->horizontalHeader()->resizeSection(1, 600);
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/qt/addresstablemodel.cpp
+ #include "stealth.h" + bool stealth;
Code added
+ AddressTableEntry(Type type, const QString &label, const QString &address, const bool &stealth = false): + type(type), label(label), address(address), stealth(stealth) {}
Code replaced
+ std::set<CStealthAddress>::iterator it; + for (it = wallet->stealthAddresses.begin(); it != wallet->stealthAddresses.end(); + + it) + { + bool fMine = !(it->scan_secret.size() < 1); + cachedAddressTable.append(AddressTableEntry(fMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending, + QString::fromStdString(it->label), + QString::fromStdString(it->Encoded()), + true)); + };
Code added
+ std::string strTemp, strValue;
Code added
- wallet->SetAddressBook(curAddress, value.toString().toStdString(), strPurpose);
Code removed
+ //wallet->SetAddressBook(curAddress, value.toString().toStdString(), strPurpose); + strTemp = rec->address.toStdString(); + if (IsStealthAddress(strTemp)) + { + strValue = value.toString().toStdString(); + wallet->UpdateStealthAddress(strTemp, strValue, false); + } else + { + //wallet->SetAddressBookName(CBitcoinAddress(strTemp).Get(), value.toString().toStdString()); + wallet->SetAddressBook(CBitcoinAddress(strTemp).Get(), value.toString().toStdString(), strPurpose); +
Code added
+ std::string sTemp = value.toString().toStdString(); + if (IsStealthAddress(sTemp)) + { + printf("IsStealthAddress = INVALID_ADDRESS\n"); + editStatus = INVALID_ADDRESS; + return false; + }
Code added
- QString AddressTableModel::addRow(const QString &type, const QString &label, const QString &address) + QString AddressTableModel::addRow(const QString &type, const QString &label, const QString &address, int addressType)
Code replaced
+ /* if(!walletModel->validateAddress(address))
Code added
+ }*/ + if (strAddress.length() > 75) + { + CStealthAddress sxAddr; + if (!sxAddr.SetEncoded(strAddress)) + { + editStatus = INVALID_ADDRESS; + return QString(); + } + + // Check for duplicate addresses + { + LOCK(wallet->cs_wallet); + + if (wallet->stealthAddresses.count(sxAddr)) + { + editStatus = DUPLICATE_ADDRESS; + return QString(); + }; + + sxAddr.label = strLabel; + wallet->AddStealthAddress(sxAddr); + } + } else { + if (!walletModel->validateAddress(address)) + { + editStatus = INVALID_ADDRESS; + return QString(); + } + // Check for duplicate addresses + { + LOCK(wallet->cs_wallet); + if (wallet->mapAddressBook.count(CBitcoinAddress(strAddress).Get())) + { + editStatus = DUPLICATE_ADDRESS; + return QString(); + }; + //wallet->SetAddressBookName(CBitcoinAddress(strAddress).Get(), strLabel); + wallet->SetAddressBook(CBitcoinAddress(strAddress).Get(), strLabel,(type == Send ? "send" : "receive")); + }
Code added
- CPubKey newKey; + /* CPubKey newKey;
Code removed
+ */ + WalletModel::UnlockContext ctx(walletModel->requestUnlock()); + if(!ctx.isValid()) + { + // Unlock wallet failed or was cancelled + editStatus = WALLET_UNLOCK_FAILURE; + return QString(); + } + if (addressType == AT_Stealth) + { + CStealthAddress newStealthAddr; + std::string sError; + if (!wallet->NewStealthAddress(sError, strLabel, newStealthAddr) + || !wallet->AddStealthAddress(newStealthAddr)) + { + editStatus = KEY_GENERATION_FAILURE; + return QString(); + } + strAddress = newStealthAddr.Encoded(); + } else { + CPubKey newKey; + //if(!wallet->GetKeyFromPool(newKey, true)) + if(!wallet->GetKeyFromPool(newKey)) + { + editStatus = KEY_GENERATION_FAILURE; + return QString(); + } + strAddress = CBitcoinAddress(newKey.GetID()).ToString(); + + { + LOCK(wallet->cs_wallet); + //wallet->SetAddressBookName(CBitcoinAddress(strAddress).Get(), strLabel); + wallet->SetAddressBook(CBitcoinAddress(strAddress).Get(), strLabel,(type == Send ? "send" : "receive")); + } + }
Code added
- { + /*{ LOCK(wallet->cs_wallet); wallet->SetAddressBook(CBitcoinAddress(strAddress).Get(), strLabel, (type == Send ? "send" : "receive")); - } + }*/
Bracketing removed
+ /* { LOCK(wallet->cs_wallet); CBitcoinAddress address_parsed(address.toStdString()); std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(address_parsed.Get()); if (mi != wallet->mapAddressBook.end()) { return QString::fromStdString(mi->second.name); } + }*/
Bracketing commented out.
+ { + LOCK(wallet->cs_wallet); + std::string sAddr = address.toStdString(); + + if (sAddr.length() > 75) + { + CStealthAddress sxAddr; + if (!sxAddr.SetEncoded(sAddr)) + return QString(); + + std::set<CStealthAddress>::iterator it; + it = wallet->stealthAddresses.find(sxAddr); + if (it == wallet->stealthAddresses.end()) + return QString(); + + return QString::fromStdString(it->label); + } else + { + CBitcoinAddress address_parsed(sAddr); + std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(address_parsed.Get()); + if (mi != wallet->mapAddressBook.end()) + { + return QString::fromStdString(mi->second.name); + } + }
Code added