[Dev] Documenting Feathercoin Specific Software settings - Part 1
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/3527a5ffa10cda80fb9a2095c6ba394b7cb590ec
src/qt/optionsmodel.cpp
+ settings.setValue("nDisplayUnit", BitcoinUnits::FTC);
FTC name change
+ if (!settings.contains("strThirdPartyTxUrls")) + settings.setValue("strThirdPartyTxUrls", ""); + strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString(); +
Scrypt interface change
+ settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE); + case ThirdPartyTxUrls: + return strThirdPartyTxUrls; + case ThirdPartyTxUrls: + if (strThirdPartyTxUrls != value.toString()) { + strThirdPartyTxUrls = value.toString(); + settings.setValue("strThirdPartyTxUrls", strThirdPartyTxUrls); + setRestartRequired(true); + } + break;
Scrypt interface transaction fee setting.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/3527a5ffa10cda80fb9a2095c6ba394b7cb590ec
src/qt/overviewpage.cpp
+ TxViewDelegate(): QAbstractItemDelegate(), unit(BitcoinUnits::FTC)
FTC name change
+ // update the display unit, to not use the default ("FTC")
Update a comment ?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/30516a6ce8d723cc3d8eb624e2d30431843f01a0
key.cpp
+int CompareBigEndian(const unsigned char *c1, size_t c1len, const unsigned char *c2, size_t c2len) { + while (c1len > c2len) { + if (*c1) + return 1; + c1 + +; + c1len--; + } + while (c2len > c1len) { + if (*c2) + return -1; + c2 + +; + c2len--; + } + while (c1len > 0) { + if (*c1 > *c2) + return 1; + if (*c2 > *c1) + return -1; + c1 + +; + c2 + +; + c1len--; + } + return 0; +} + +// Order of secp256k1's generator minus 1. +const unsigned char vchMaxModOrder[32] = { + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, + 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, + 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x40 +}; + +// Half of the order of secp256k1's generator minus 1. +const unsigned char vchMaxModHalfOrder[32] = { + 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x5D,0x57,0x6E,0x73,0x57,0xA4,0x50,0x1D, + 0xDF,0xE9,0x2F,0x46,0x68,0x1B,0x20,0xA0 +}; + +const unsigned char vchZero[0] = {}; +
Update to FTC specific settings
- // it's easy enough to do directly. - static const unsigned char vchMax[32] = { +} - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x40 - }; - bool fIsZero = true; - for (int i=0; i<32 && fIsZero; i++) - if (vch[i] != 0) - fIsZero = false; - if (fIsZero) - return false; - for (int i=0; i<32; i++) { - if (vch[i] < vchMax[i]) - return true; - if (vch[i] > vchMax[i]) - return false; - } - return true;
Bitcoin code replaced
+ return CompareBigEndian(vch, 32, vchZero, 0) > 0 && + CompareBigEndian(vch, 32, vchMaxModOrder, 32) <= 0; + + bool CKey::CheckSignatureElement(const unsigned char *vch, int len, bool half) { + return CompareBigEndian(vch, len, vchZero, 0) > 0 && + CompareBigEndian(vch, len, half ? vchMaxModHalfOrder : vchMaxModOrder, 32) <= 0; +bool ECC_InitSanityCheck() { + EC_KEY *pkey = EC_KEY_new_by_curve_name(NID_secp256k1); + if(pkey == NULL) + return false; + EC_KEY_free(pkey); + + // TODO Is there more EC functionality that could be missing? + return true; +}
Scrypt interface replacement.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/30516a6ce8d723cc3d8eb624e2d30431843f01a0
key.h
+ // Check whether an element of a signature (r or s) is valid. + static bool CheckSignatureElement(const unsigned char *vch, int len, bool half); +/** Check that required EC support is available at runtime */ +bool ECC_InitSanityCheck(void); +
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/30516a6ce8d723cc3d8eb624e2d30431843f01a0
src/qt/addressbookpage.cpp
+ ui->labelExplanation->setText(tr("These are your Feathercoin addresses for sending payments. Always check the amount and the receiving address before sending coins.")); + ui->labelExplanation->setText(tr("These are your Feathercoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
Name change FTC
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/30516a6ce8d723cc3d8eb624e2d30431843f01a0
wallet.cpp
-#include "checkpoints.h" +#include "checkpoints.h"
Order change for headers?
+ int64_t nTransactionFee = DEFAULT_TRANSACTION_FEE;
Bitcoin code replaced
+static std::vector<CKeyID> vChangeAddresses;
Scrypt code added.
+bool CWallet::LoadCScript(const CScript& redeemScript) +{ + /* A sanity check was added in pull #3843 to avoid adding redeemScripts + * that never can be redeemed. However, old wallets may still contain + * these. Do not add them to the wallet and warn. */ + if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE) + { + std::string strAddr = CBitcoinAddress(redeemScript.GetID()).ToString(); + LogPrintf("%s: Warning: This wallet contains a redeemScript of size %i which exceeds maximum size %i thus can never be redeemed. Do not use address %s.\n", + __func__, redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE, strAddr); + return true; + } + + return CCryptoKeyStore::AddCScript(redeemScript); +} +
Scrypt code added.
+ mapWallet[hash].BindWallet(this);
Scrypt code included
+ LOCK2(cs_main, cs_wallet);
Lock interface changes x6
+ // send change to one of the specified change addresses, if specified at init + else if (vChangeAddresses.size()) + { + CKeyID keyID = vChangeAddresses[GetRandInt(vChangeAddresses.size())]; + scriptChange.SetDestination(keyID); + } + + // send change to newly generated address
Scrypt change rules
+ LogPrintf("keypool added key %d, size=%u\n", nEnd, setKeyPool.size());
Log interface charge
+ +// Add an address to the list of fixed change addresses to use. Fixed +// addresses can be used to reduce the pace at which wallets expand +// due to number of change addresses +void AddFixedChangeAddress(const CKeyID &changeAddress) +{ + vChangeAddresses.push_back(changeAddress); +}
Scrypt interface change
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/30516a6ce8d723cc3d8eb624e2d30431843f01a0
wallet.h
+// -paytxfee default +static const int64_t DEFAULT_TRANSACTION_FEE = 0;
Additional
+static const int nHighTransactionFeeWarning = 0.05 * COIN;
Bitcoin code replaced
- nWalletVersion = FEATURE_BASE; - nWalletMaxVersion = FEATURE_BASE; - fFileBacked = false; - nMasterKeyMaxID = 0; - pwalletdbEncryption = NULL; - nOrderPosNext = 0; - nNextResend = 0; - nLastResend = 0; - nWalletVersion = FEATURE_BASE; - nWalletMaxVersion = FEATURE_BASE;
Bitcoin code removed
+ SetNull();
Scrypt interface additions set null function.
+ } + void SetNull() + { + nWalletVersion = FEATURE_BASE; + nWalletMaxVersion = FEATURE_BASE; + fFileBacked = false; + nTimeFirstKey = 0;
Scrypt interface code added
+ bool LoadCScript(const CScript& redeemScript);
Bitcoin code replaced.
+ READWRITE(LIMITED_STRING(strComment, 65536)); + READWRITE(LIMITED_STRING(strOtherAccount, 65536)); + READWRITE(LIMITED_STRING(strComment, 65536));
Bitcoin code replaced.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/30516a6ce8d723cc3d8eb624e2d30431843f01a0
walletdb.cpp
- if (CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid()) - wtx.BindWallet(pwallet); - else return false; return false; - // Undo serialize changes in 31600 - if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703) - { - if (!ssValue.empty()) - { - char fTmp; - char fUnused; - ssValue >> fTmp >> fUnused >> wtx.strFromAccount; - strErr = strprintf("LoadWallet() upgrading tx ver=%d %d '%s' %s", - wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount, hash.ToString()); - wtx.fTimeReceivedIsTxTime = fTmp; - } - else - { - strErr = strprintf("LoadWallet() repairing tx ver=%d %s", wtx.fTimeReceivedIsTxTime, hash.ToString()); - wtx.fTimeReceivedIsTxTime = 0; - } - wss.vWalletUpgrade.push_back(hash); - } -
Bitcoin code removed
+ if (!(CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid()))
Scrypt code replaces
- // Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc: - if (wss.fIsEncrypted && (wss.nFileVersion == 40000 || wss.nFileVersion == 50000)) - return DB_NEED_REWRITE; -
Bitcoin Code removed
- RenameThread("bitcoin-wallet"); + RenameThread("feathercoin-wallet");
Bitcoin code replaced
- LogPrintf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size()); + LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
Bitcoin code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
chainparams.cpp
- base58Prefixes[PUBKEY_ADDRESS] = list_of(0); + //how to do feathercoin ? + base58Prefixes[PUBKEY_ADDRESS] = list_of(14); // FeatherCoin addresses start with F
Feathercoin address setting
- base58Prefixes[PUBKEY_ADDRESS] = list_of(111); + base58Prefixes[PUBKEY_ADDRESS] = list_of(65); // Boost sucks, and should not be used. Workaround for Boost not being compatible with C++11;
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/askpassphrasedialog.cpp
+ tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR FEATHERCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"), + tr("Feathercoin will close now to finish the encryption process. " + "your feathercoins from being stolen by malware infecting your computer.") +
Name change interface
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/bitcoingui.cpp
+// Copyright (c) 2013-2014 The Feathercoin developers
Update copyright
+ + QPalette palette; + palette.setBrush(QPalette::Background,QBrush(QPixmap(":/images/mainbg"))); + this->setPalette(palette); + this->setAutoFillBackground(true); + + accountReportAction = new QAction(QIcon(":/icons/account-report"), tr("&Report"), this); + accountReportAction->setStatusTip(tr("Get my account report")); + accountReportAction->setToolTip(accountReportAction->statusTip()); + accountReportAction->setCheckable(true); + accountReportAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); + tabGroup->addAction(accountReportAction); + connect(accountReportAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); + connect(accountReportAction, SIGNAL(triggered()), this, SLOT(gotoAccountReportPage()));
Interface addition scrypt
+ aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Feathercoin Core"), this); + aboutAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&About Feathercoin Core"), this); + aboutAction->setStatusTip(tr("Show information about Feathercoin")); + signMessageAction->setStatusTip(tr("Sign messages with your Feathercoin addresses to prove you own them")); + verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Feathercoin addresses"));
Bitcoin Code replaced
+ toolbar->addAction(accountReportAction); + accountReportAction->setEnabled(enabled); +void BitcoinGUI::gotoAccountReportPage() +{ + accountReportAction->setChecked(true); + if (walletFrame) walletFrame->gotoAccountReportPage(); +} +
Additional code
+ labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Feathercoin network", "", count));
Replace Bitcoin code
+ QString strTitle = tr("Feathercoin"); // default title
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/bitcoingui.h
+ QAction *accountReportAction;
Addition
+ void setNumBlocks(int count); + /** Switch to account report page */ + void gotoAccountReportPage(); +
Bitcoincode replace scrypt interface
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/clientmodel.cpp
+#include "rpcserver.h"
Include added
+ cachedNumBlocks(0),
Bitcoin code replaced.
+ LOCK(cs_main); +double ClientModel::getCurrDifficulty() const +{ + return (double)GetDifficulty(); +} +
Code added.
+ LOCK(cs_main); + // Get required lock upfront. This avoids the GUI from getting stuck on + // periodical polls if the core is holding the locks for a longer time - + // for example, during a wallet rescan. + TRY_LOCK(cs_main, lockMain); + if(!lockMain) + return;
Locks added.
- int newNumBlocksOfPeers = getNumBlocksOfPeers();
Bitcoin code removed
+ if (cachedNumBlocks != newNumBlocks || + emit numBlocksChanged(newNumBlocks);
Bitcoin code replaced
-int ClientModel::getNumBlocksOfPeers() const -{ - return GetNumBlocksOfPeers(); -} -
Code added.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/clientmodel.h
- //! Return conservative estimate of total number of blocks, or 0 if unknown - int getNumBlocksOfPeers() const; - int cachedNumBlocksOfPeers;
Bitcoin code removed
+ // Return Current block + double getCurrDifficulty() const;
Code added
+ void numBlocksChanged(int count);
Bitcoin code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/feathercoin.qrc
+ <file alias="account-report">res/icons/account-report.png</file> + <file alias="mainlogo">res/images/LOGO.png</file> + <file alias="mainbg">res/images/mainbg.png</file>
Additional image files are defined.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/forms/aboutdialog.ui
Further changes are made in later commits. Name and directory interface changes to definitions.
+ <string>About Feathercoin Core</string> + <pixmap>:/images/about</pixmap> + <string><b>Feathercoin Core</b> version</string> + <string notr="true">0.9.3-Standard</string>
Bitcoin code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/forms/helpmessagedialog.ui
Help message dialog customizations in GUI. Further commits.
+ <height>327</height> + <string>Feathercoin Core - Command-line options</string> + <pixmap>:/images/about</pixmap> + <pixmap>:/images/about</pixmap> + <width>748</width> + <height>276</height>
Bitcoin code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/forms/overviewpage.ui
overviewpage message dialog customizations in GUI. Further commits. Note, that changes are usually made to the GUI via the Qt creator IDE.
Large sections of this file have been updated - Review how to handle Qt layout file updates?
+ <height>344</height>
Bitcoin code replaced
- <widget class="QFrame" name="frame">
Bitcoin code removed
+ <widget class="QLabel" name="labelMainlogo"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="../feathercoin.qrc">:/images/mainlogo</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="labelOverviewPage"> + <property name="font"> + <font> + <family>Arial Rounded MT Bold</family> + <pointsize>11</pointsize> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>OverviewPage</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="labelOverview1"> + <property name="text"> + <string>Feathercoin</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="labelOverview2"> + <property name="text"> + <string>Feathercoin</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QFrame" name="frame_2">
Code for Feathercoin background image?, from Dogecoin?
+ <layout class="QVBoxLayout" name="verticalLayout">
Bitcoin code replaced
- <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <layout class="QFormLayout" name="formLayout_2"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <property name="horizontalSpacing"> - <number>12</number>
Bitcoin code removed
+ <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum>
Code added
+ <resources> + <include location="../feathercoin.qrc"/> + </resources>
Additonal code, after long section of code replacement, with FTC layout.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/overviewpage.cpp
overviwpage.cpp integrates with the ui file.
+ int shareBalance=0; //Ready for POS
Additional code scrypt interface.
[FAQ] What is POS?
Proof of share or POS. An transaction algorythm that pays wallets based on their exposed contents, in addition or instead of POW (proof of work).
+ ui->labelShare->setText(BitcoinUnits::formatWithUnit(unit, shareBalance));
Additional code
- // only show immature (newly mined) balance if it's non -zero, so as not to complicate things - // for the non -mining users - bool showImmature = immatureBalance != 0;
Bitcoin code removed
+ bool showImmature =true;
Replaced Bitcoin code
+ + setOverview(); + } + + void OverviewPage::setOverview() + { + ui->labelOverview1->setText(tr("Current Block :")+tr(" %1 ").arg(clientModel->getNumBlocks())); + ui->labelOverview2->setText(tr("Current Difficulty :")+tr(" %1").arg(clientModel->getCurrDifficulty()));
Additional code
+ // Show RPC information when blocks had changed + connect(model, SIGNAL(numBlocksChanged(int)), this, SLOT(setOverview()));
Additional code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/89e49238366fd9597ca3f8e5b2711f48e402372b
src/qt/overviewpage.h
overviwpage.h integrates with the ui file.
+ void setOverview();
Additional code