[Dev] Documenting Feathercoin Specific Software settings - Part 6
-
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
-
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.h
+ enum AddressType { + AT_Unknown = 0, /**< User specified label */ + AT_Normal = 1, /**< Bitcoin address */ + AT_Stealth = 2 /**< Stealth address */ + }; +
Code added
- Address = 1 /**< Bitcoin address */ + Address = 1, /**< Bitcoin address */ + Type = 2 /**< Address type */
? review
- QString addRow(const QString &type, const QString &label, const QString &address); + //QString addRow(const QString &type, const QString &label, const QString &address); + QString addRow(const QString &type, const QString &label, const QString &address, int addressType);
Bitcoin code commented out, review.
-
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/bitcoingui.cpp
+ + ActiveLabel::ActiveLabel(const QString & text, QWidget * parent): + QLabel(parent){} + + void ActiveLabel::mouseReleaseEvent(QMouseEvent * event) + { + emit clicked(); + }
Code added
+ walletModel(0),
Code added
- labelEncryptionIcon = new QLabel(); + labelEncryptionIcon = new ActiveLabel();
Code replaced
+ connect(labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger()));
Code added
+ disconnect(labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger())); + disconnect(labelEncryptionIcon, SIGNAL(clicked()), lockWalletAction, SLOT(trigger())); + connect (labelEncryptionIcon, SIGNAL(clicked()), lockWalletAction, SLOT(trigger()));
Code added
+ disconnect(labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger())); + disconnect(labelEncryptionIcon, SIGNAL(clicked()), lockWalletAction, SLOT(trigger())); + connect (labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger()));
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/bitcoingui.h
+#include <QLabel>
Code added
+ class ActiveLabel : public QLabel + { + Q_OBJECT + public: + ActiveLabel(const QString & text = "", QWidget * parent = 0); + ~ActiveLabel(){} + + signals: + void clicked(); + + protected: + void mouseReleaseEvent (QMouseEvent * event) ; + + }; +
Code added
- QLabel *labelEncryptionIcon; + ActiveLabel *labelEncryptionIcon;
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/qt/editaddressdialog.cpp
+ ui->addressEdit->setVisible(false); + ui->stealthCB->setEnabled(true); + ui->stealthCB->setVisible(true); + ui->stealthCB->setVisible(false); + ui->addressEdit->setVisible(true); + ui->stealthCB->setEnabled(false); + ui->stealthCB->setVisible(true); + ui->stealthCB->setVisible(false); + mapper->addMapping(ui->stealthCB, AddressTableModel::Type);
Code added
- address = model ->addRow( - mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive, - ui ->labelEdit ->text(), - ui ->addressEdit ->text());
Code removed
+ { + int typeInd = ui->stealthCB->isChecked() ? AddressTableModel::AT_Stealth : AddressTableModel::AT_Normal; + address = model->addRow( + mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive, + ui->labelEdit->text(), + ui->addressEdit->text(), + typeInd); + }
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/qt/forms/editaddressdialog.ui
+ <item row="2" column="0"> + <widget class="QCheckBox" name="stealthCB"> + <property name="text"> + <string>Stealth Address</string> + </property> + </widget> + </item>
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/receivecoinsdialog.cpp
- address = model ->getAddressTableModel() ->addRow(AddressTableModel::Receive, label, ""); + int typeInd = AddressTableModel::AT_Normal; + address = model ->getAddressTableModel() ->addRow(AddressTableModel::Receive, label, "",typeInd);
Code replaced
- ui->reqAmount->value(), ui->reqMessage->text()); + ui->reqAmount->value(), ui->reqMessage->text());
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/qt/sendcoinsdialog.cpp
+ //QMessageBox::information(NULL, "Info1", "Click_SendButton", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
Code added
-
Add stealth address : - commit
https://github.com/FeatherCoin/Feathercoin/commit/e993143a1688a6aa57c03da6f181f8bf2f375bf6
src/qt/sendcoinsentry.cpp
+ #include "stealth.h" + #include <QDebug>
Code added
+ + if (recipient.address.length() > 75 + && IsStealthAddress(recipient.address.toStdString())) + recipient.typeInd = AddressTableModel::AT_Stealth; + else + recipient.typeInd = AddressTableModel::AT_Normal; + + qDebug() << "SendCoinsEntry::getValue,recipient.typeInd =" + QString::number(recipient.typeInd);
Code added
+ + if (recipient.address.length() > 75 + && IsStealthAddress(recipient.address.toStdString())) + recipient.typeInd = AddressTableModel::AT_Stealth; + else + recipient.typeInd = AddressTableModel::AT_Normal; + + qDebug() << "SendCoinsEntry::getValue,recipient.typeInd ="+ QString::number(recipient.typeInd);
Code added