[Dev] Documenting Feathercoin Specific Software settings - Part 2
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/forms/merchantlist.ui
Appears to be a new file for reports. Defines ui, update through Qt?. Add MerchantListView FTC reports commit
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MerchantListView</class> + <widget class="QWidget" name="MerchantListView"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>790</width> + <height>419</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property>
First part of ui definitions, 300 lines of code.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/guiutil.cpp
Add MerchantListView FTC reports commit
+ if(!uri.isValid() || uri.scheme() != QString("feathercoin"))
Name change to Feathercoin.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/merchantlist.cpp
New file for reports. Add MerchantListView FTC reports commit
+// Copyright (c) 2013-2014 The Feathercoin developers +// from overviewpage + +#include "merchantlist.h" +#include "ui_merchantlist.h" + +#include "bitcoinunits.h" +#include "clientmodel.h" +#include "guiconstants.h" +#include "guiutil.h" +#include "optionsmodel.h" +#include "transactionfilterproxy.h" +#include "transactiontablemodel.h" +#include "walletmodel.h" + +#include <QAbstractItemDelegate> +#include <QPainter> +#include <QDesktopServices> +#include <QUrl> + +#define DECORATION_SIZE 64 +#define NUM_ITEMS 3 + +class MerViewDelegate : public QAbstractItemDelegate
Initial code 250 lines added file
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/merchantlist.h
New file for FTC reports. Add MerchantListView FTC reports commit
+// Copyright (c) 2013-2014 The Feathercoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef MERCHANTLISTVIEW_H +#define MERCHANTLISTVIEW_H + +#include <QWidget> + +class ClientModel; +class TransactionFilterProxy; +class MerViewDelegate; +class WalletModel; + +namespace Ui { + class MerchantListView;
Initial code then, 64 lines of code in new file.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/reportview.h
Add MerchantListView FTC reports commit
+// Copyright (c) 2013-2014 The Feathercoin developers
Copyright.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/transactionview.cpp
Updates to account for new FTC reports. Add MerchantListView FTC reports commit
+#include <QDesktopServices> +#include <QSignalMapper> +#include <QUrl>
Additional code, scrypt interface
+ dateWidget->addItem(tr("Yesterday"), Yesterday); + dateWidget->addItem(tr("Last week"), LastWeek);
FTC report requirement?
+ totalWidget= new QLabel(tr("Total:"),this); + vlayout->addWidget(totalWidget);
Totalisation added code for FTC reports?
+ QAction *showTotalAction = new QAction(tr("Show transaction total"), this);
report code
+ contextMenu->addAction(showTotalAction); + + mapperThirdPartyTxUrls = new QSignalMapper(this); // Connect actions + connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, SLOT(openThirdPartyTxUrl(QString))); +
Additional code FTC reports
+ connect(showTotalAction, SIGNAL(triggered()), this, SLOT(showTotal())); + + if (model->getOptionsModel()) + { + // Add third party transaction URLs to context menu + QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); + for (int i = 0; i < listUrls.size(); ++i) + { + QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); + if (!host.isEmpty()) + { + QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label + if (i == 0) + contextMenu->addSeparator(); + contextMenu->addAction(thirdPartyTxUrlAction); + connect(thirdPartyTxUrlAction, SIGNAL(triggered()), mapperThirdPartyTxUrls, SLOT(map())); + mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed()); + } + } + } + + connect(transactionView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(showTotal())); + showTotal();
Block of added code for FTC reports
+ case Yesterday:{ + QDate startOfDay = current.addDays(-1); + transactionProxyModel->setDateRange( + QDateTime(startOfDay), + QDateTime(current)); + } break;
Additional FTC report code block
+ case LastWeek: { + //from Monday to Sunday + QDate startOfWeek = current.addDays(-(current.dayOfWeek()+6)); + QDate endOfWeek = current.addDays(-(current.dayOfWeek()-1)); + transactionProxyModel->setDateRange( + QDateTime(startOfWeek), + QDateTime(endOfWeek)); + } break;
Additional FTC report code block
+ showTotal();
Show title is called a number of times dependent on if statements which define the type of filter being applied.
+ void TransactionView::showTotal() + { + float fTotal=0; + for (int i=0;i<=transactionProxyModel->rowCount();i + + ) + fTotal + =transactionProxyModel->data(transactionProxyModel->index(i,4)).toFloat(); + + totalWidget->setText(tr("Date:") + dateWidget->currentText() + " " + tr("Type:") + typeWidget->currentText() + " " + tr("Total:") + QObject::tr("%1").arg(fTotal) + " FTC"); + } + + void TransactionView::openThirdPartyTxUrl(QString url) + { + if(!transactionView || !transactionView->selectionModel()) + return; + QModelIndexList selection = transactionView->selectionModel()->selectedRows(0); + if(!selection.isEmpty()) + QDesktopServices::openUrl(QUrl::fromUserInput(url.replace("%s", selection.at(0).data(TransactionTableModel::TxHashRole).toString()))); + } +
Block of additional FTC report code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/transactionview.h
Updates to account for / add new FTC reports. Add MerchantListView FTC reports commit
+class QSignalMapper;
Include class
+ Yesterday, + LastWeek,
Include addition time domains for reports
+ QLabel *totalWidget; + QSignalMapper *mapperThirdPartyTxUrls; + void openThirdPartyTxUrl(QString url); + void showTotal();
Additions for FTC reports.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/walletframe.cpp
Updates to account for / add new FTC reports. Add MerchantListView FTC reports commit
+ void WalletFrame::gotoMerchantListPage() + { + QMap<QString, WalletView*>::const_iterator i; + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); + + i) + i.value()->gotoMerchantListPage(); + } +
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/walletframe.h
Add MerchantListView FTC reports commit
+ /** Switch to merchant list page */ + void gotoMerchantListPage();
Additions for FTC reports
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/walletview.cpp
Add MerchantListView FTC reports commit
+#include "merchantlist.h" + merchantlistPage = new MerchantListView(); + addWidget(merchantlistPage); + overviewPage->setWalletModel(walletModel); + merchantlistPage->setWalletModel(walletModel);
Additions for reports
- overviewPage->setWalletModel(walletModel);
Bitcoin code removed
+ void WalletView::gotoMerchantListPage() + { + setCurrentWidget(merchantlistPage); + } +
Additions for FTC reports
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
https://github.com/FeatherCoin/Feathercoin/commit/516a78744d2eac208b61a864f81d59dc9055568d
src/qt/walletview.h
Add MerchantListView FTC reports commit
+class MerchantListView;
FTC report interface change
+ /** Switch to merchant list page */ + void gotoMerchantListPage();
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dACP and neoscrypt commit (2?)
+AM_PROG_AS
Additional code
+ bdb_prefix=`$BREW --prefix berkeley-db5`
Database updated
- BITCOIN_FIND_BDB48
Code replaced.
+ BITCOIN_FIND_BDB51
Bitcoin code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/Makefile.am
ACP and neoscrypt commit
+ bin_PROGRAMS += feathercoind + bin_PROGRAMS += feathercoin-cli
Name change.
+ auxpow.h \ + checkpointsync.h \ + scrypt.h \ + neoscrypt.h \
auxilliary proof of work, scrypt, neoscrpt headers added
+ auxpow.cpp \ + base58.cpp \ + scrypt.cpp \ + neoscrypt.c \ + neoscrypt_asm.S \
Add cpp file references
+ if GLIBC_BACK_COMPAT + libbitcoin_common_a_SOURCES += compat/glibc_compat.cpp + libbitcoin_common_a_SOURCES += compat/glibcxx_compat.cpp + endif +
Additional code
+# feathercoind binary # +feathercoind_LDADD = \
Bitcoin code replaced
+feathercoind_LDADD += libbitcoin_wallet.a +feathercoind_SOURCES = feathercoind.cpp +feathercoind_SOURCES += feathercoind-res.rc +feathercoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) +# feathercoin-cli binary # +feathercoin_cli_LDADD = \ +feathercoin_cli_SOURCES = feathercoin-cli.cpp +feathercoin_cli_SOURCES += feathercoin-cli-res.rc
Interface change to feathercoin name change.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/checkpoints.cpp
ACP and neoscrypt commit, (2nd commit?)
+ + uint256 GetLatestHardenedCheckpoint() + { + const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints; + return (checkpoints.rbegin()->second); + }
Additional code for checkpoints
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/checkpoints.h
ACP and neoscrypt commit, (2nd commit?)
+ // Returns the block hash of latest hardened checkpoint + uint256 GetLatestHardenedCheckpoint();
Additional checkpoint code.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/checkpointsync.cpp
Additional file for checkpoints. Large.
ACP and neoscrypt commit,
+ // Copyright (c) 2012-2013 PPCoin developers + // Copyright (c) 2013 Primecoin developers + // Distributed under conditional MIT/X11 software license, + // see the accompanying file COPYING + // + // The synchronized checkpoint system is first developed by Sunny King for + // ppcoin network in 2012, giving cryptocurrency developers a tool to gain + // additional network protection against 51% attack. + // + // Primecoin also adopts this security mechanism, and the enforcement of + // checkpoints is explicitly granted by user, thus granting only temporary + // consensual central control to developer at the threats of 51% attack. + // + // Concepts + // + // In the network there can be a privileged node known as 'checkpoint master'. + // This node can send out checkpoint messages signed by the checkpoint master + // key. Each checkpoint is a block hash, representing a block on the blockchain + // that the network should reach consensus on. + // + // Besides verifying signatures of checkpoint messages, each node also verifies + // the consistency of the checkpoints. If a conflicting checkpoint is received, + // it means either the checkpoint master key is compromised, or there is an + // operator mistake. In this situation the node would discard the conflicting + // checkpoint message and display a warning message. This precaution controls + // the damage to network caused by operator mistake or compromised key. + // + // Operations + // + // Checkpoint master key can be established by using the 'makekeypair' command + // The public key in source code should then be updated and private key kept + // in a safe place. + // + // Any node can be turned into checkpoint master by setting the 'checkpointkey' + // configuration parameter with the private key of the checkpoint master key. + // Operator should exercise caution such that at any moment there is at most + // one node operating as checkpoint master. When switching master node, the + // recommended procedure is to shutdown the master node and restart as + // regular node, note down the current checkpoint by 'getcheckpoint', then + // compare to the checkpoint at the new node to be upgraded to master node. + // When the checkpoint on both nodes match then it is safe to switch the new + // node to checkpoint master. + // + // The configuration parameter 'checkpointdepth' specifies how many blocks + // should the checkpoints lag behind the latest block in auto checkpoint mode. + // A depth of 0 is the strongest auto checkpoint policy and offers the greatest + // protection against 51% attack. A negative depth means that the checkpoints + // should not be automatically generated by the checkpoint master, but instead + // be manually entered by operator via the 'sendcheckpoint' command. The manual + // mode is also the default mode (default value -1 for checkpointdepth). + // + // Command 'enforcecheckpoint' and configuration parameter 'checkpointenforce' + // are for the users to explicitly consent to enforce the checkpoints issued + // from checkpoint master. To enforce checkpoint, user needs to either issue + // command 'enforcecheckpoint true', or set configuration parameter + // checkpointenforce=1. The current enforcement setting can be queried via + // command 'getcheckpoint', where 'subscribemode' displays either 'enforce' + // or 'advisory'. The 'enforce' mode of subscribemode means checkpoints are + // enforced. The 'advisory' mode of subscribemode means checkpoints are not + // enforced but a warning message would be displayed if the node is on a + // different blockchain fork from the checkpoint, and this is the default mode. + // +
Documentation. for checkpoints code. New file 530 lines of code.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/checkpointsync.h
Additional file for checkpoints. Large.
ACP and neoscrypt commit
+ // Copyright (c) 2011-2013 PPCoin developers + // Copyright (c) 2013 Primecoin developers + // Distributed under conditional MIT/X11 open source software license + // see the accompanying file COPYING + #ifndef PRIMECOIN_CHECKPOINTSYNC_H + #define PRIMECOIN_CHECKPOINTSYNC_H + + #include "net.h" + #include "util.h" + + class uint256; + class CBlock; + class CBlockIndex; + class CSyncCheckpoint;
Add new file 129 lines code.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/core.h
ACP and neoscrypt commit
+// Copyright (c) 2009-2013 The Bitcoin developers
Bitcoin code replaced?
+#include "neoscrypt.h" +#include "chainparams.h" +// DogeCoin aux chain ID = 0x0062 (98), Feathercoin unused
Code additions
- { - uint256 thash; - scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(thash)); - return thash;
Bitcoin code removed
+ /* Calculates block proof-of-work hash using either NeoScrypt or Scrypt */ + uint256 GetPoWHash() const { + //from 0.8.7 main.h + int nForkFour = 432000; + int nTestnetFork = 600; + unsigned int nSwitchV2 = 1413936000; // Wed, 22 Oct 2014 00:00:00 GMT + unsigned int nTestnetSwitchV2 = 1406473140; // Sun, 27 Jul 2014 14:59:00 GMT + + unsigned int profile = 0x0; + uint256 hash; + + /* All blocks generated up to this time point are Scrypt only */ + if((TestNet() && (nTime < nTestnetSwitchV2)) || + (!TestNet() && (nTime < nSwitchV2))) { + profile = 0x3; + } else { + /* All these blocks must be v2 + with valid nHeight */ + int nHeight = GetBlockHeight(); + if(TestNet()) { + if(nHeight < nTestnetFork) + profile = 0x3; + } else { + if(nHeight < nForkFour) + profile = 0x3; + } + } + + if (profile==0x0) + { + neoscrypt((unsigned char *) &nVersion, (unsigned char *) &hash, profile); + } + if (profile==0x3) + { + scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(hash)); + } + //scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(hash)); + + return(hash); } } + /* Extracts block height from v2 + coin base; + * ignores nVersion because it's unrealiable */ + int GetBlockHeight() const { + /* Prevents a crash if called on a block header alone */ + if(vtx.size()) { + /* Serialised CScript */ + std::vector<unsigned char>::const_iterator scriptsig = vtx[0].vin[0].scriptSig.begin(); + unsigned char i, scount = scriptsig[0]; + /* Optimise: nTime is 4 bytes always, + * nHeight must be less for a long time; + * check against a threshold when the time comes */ + if(scount < 4) { + int height = 0; + unsigned char *pheight = (unsigned char *) &height; + for(i = 0; i < scount; i + + ) + pheight[i] = scriptsig[i + 1]; + /* v2 + block with nHeight in coin base */ + return(height); + } + } + /* Not found */ + return(-1); + } +
Bitcoin code replaced.
+ void print() const;
Position change?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/db.cpp
ACP and neoscrypt commit
- dbenv.set_lk_max_objects(40000); + dbenv.set_lk_max_locks(200000); + dbenv.set_lk_max_objects(200000); //from 0.8.7
Bitcoin code replaced.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add Implemented ACP and neoscrypt commit
https://github.com/FeatherCoin/Feathercoin/commit/c8ca4c906144910c62acd34e23a4ed624c0fbf7dsrc/init.cpp
ACP and neoscrypt commit. 2nd Commit
+ + if (mapArgs.count("-checkpointkey")) // ppcoin: checkpoint master priv key + { + if (!SetCheckpointPrivKey(GetArg("-checkpointkey", ""))) + return InitError(_("Unable to sign checkpoint, wrong checkpointkey?")); + } +
Additional code checkpoints
+ return InitError(_("Initialization sanity check failed. Feathercoin Core is shutting down."));
Bitcoin code replaced.