[Dev] Documenting Feathercoin Specific Software settings - Part 3
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix lost files 2- commit
https://github.com/FeatherCoin/Feathercoin/commit/388d6bdb1cfd96b8634b5c7f5f8b392990abe7d2
src/qt/winshutdownmonitor.cpp
A new file? where from?
+ // Copyright (c) 2014 The Bitcoin developers + // Distributed under the MIT/X11 software license, see the accompanying + // file COPYING or http://www.opensource.org/licenses/mit-license.php. + + #include "winshutdownmonitor.h" + + #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000 + #include "init.h" + + #include <windows.h> + + #include <QDebug> + + // If we don't want a message to be processed by Qt, return true and set result to + // the value that the window procedure should return. Otherwise return false. + bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult) + {
Start of code, 57 lines of code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix lost files 2- commit
https://github.com/FeatherCoin/Feathercoin/commit/388d6bdb1cfd96b8634b5c7f5f8b392990abe7d2
src/qt/winshutdownmonitor.h
A new file? where from?
+ // Copyright (c) 2014 The Bitcoin developers + // Distributed under the MIT/X11 software license, see the accompanying + // file COPYING or http://www.opensource.org/licenses/mit-license.php. + + #ifndef WINSHUTDOWNMONITOR_H + #define WINSHUTDOWNMONITOR_H + + #ifdef WIN32 + #include <QByteArray> + #include <QString> + + #if QT_VERSION >= 0x050000 + #include <windef.h> // for HWND + + #include <QAbstractNativeEventFilter> + + class WinShutdownMonitor : public QAbstractNativeEventFilter + { + public: + /** Implements QAbstractNativeEventFilter interface for processing Windows messages */ + bool nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult); + + /** Register the reason for blocking shutdown on Windows to allow clean client exit */ + static void registerShutdownBlockReason(const QString& strReason, const HWND& mainWinId); + }; + #endif + #endif + + #endif // WINSHUTDOWNMONITOR_H
Code to replacement / new file
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix lost files / compile error 3- commit
https://github.com/FeatherCoin/Feathercoin/commit/e81b798f50f1536dbf9cd0f0c3649fbea074e22b
src/netbase.cpp
- if(chainActive.Height() != cachedNumBlocks) -#ifdef USE_IPV6 aiHint.ai_family = AF_UNSPEC; -#else - aiHint.ai_family = AF_INET; -#endif
Remove ifdef from just IPv6
#ifdef USE_IPV6
if (aiTrav->ai_family == AF_INET6)Remove ifdef from just IPv6
- if (ret) + if (ret) { + closesocket(hSocket);
Replaced if ret true code
- #ifdef USE_IPV6 struct sockaddr_storage sockaddr;
Remove ifdef from just IPv6
+ LogPrintf("select() for %s failed: %s\n", addrConnect.ToString(), NetworkErrorString(WSAGetLastError())); + LogPrintf("connect() to %s failed after select(): %s\n", addrConnect.ToString(), NetworkErrorString(nRet)); + LogPrintf("connect() to %s failed: %s\n", addrConnect.ToString(), NetworkErrorString(WSAGetLastError()));
Log print interface replace
+ closesocket(hSocket);
Additional code
+ case 4: + closesocket(hSocket); + return false;
Case 4 socket code updated
-#ifdef USE_IPV6 CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr) -#ifdef USE_IPV6 struct sockaddr_storage sockaddr; -#ifdef USE_IPV6 bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const -#ifdef USE_IPV6 CService::CService(const struct in6_addr& ipv6Addr, unsigned short portIn) : CNetAddr(ipv6Addr), port(portIn) -#ifdef USE_IPV6 CService::CService(const struct sockaddr_in6 &addr) : -#ifdef USE_IPV6 case AF_INET6: *this = CService(*(const struct sockaddr_in6*)paddr); -#ifdef USE_IPV6 if (IsIPv6()) { if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6))
Remove ifdef from just IPv6
+ + #ifdef WIN32 + std::string NetworkErrorString(int err) + { + char buf[256]; + buf[0] = 0; + if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + buf, sizeof(buf), NULL)) + { + return strprintf("%s (%d)", buf, err); + } + else + { + return strprintf("Unknown error (%d)", err); + } + } + #else + std::string NetworkErrorString(int err) + { + char buf[256]; + const char *s = buf; + buf[0] = 0; + /* Too bad there are two incompatible implementations of the + * thread-safe strerror. */ + #ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */ + s = strerror_r(err, buf, sizeof(buf)); + #else /* POSIX variant always returns message in buffer */ + (void) strerror_r(err, buf, sizeof(buf)); + #endif + return strprintf("%s (%d)", s, err); + } + #endif +
Additional code error handling
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update GUICONSTANTS
https://github.com/FeatherCoin/Feathercoin/commit/c2bb55f2fef05129089bf48d12b190f44f2e4ca3
src/qt/guiconstants.h
+ #define QAPP_ORG_NAME "Feathercoin" + #define QAPP_ORG_DOMAIN "feathercoin.com" + #define QAPP_APP_NAME_DEFAULT "Feathercoin-Qt" + #define QAPP_APP_NAME_TESTNET "Feathercoin-Qt-testnet"
Code replaced Feathercoin name change
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update SECRET_KEY commit
https://github.com/FeatherCoin/Feathercoin/commit/6b63d986fc8389b1dd73d450406e731f2a0fc679
src/chainparams.cpp
+ base58Prefixes[SECRET_KEY] = list_of(142);// 14 + 128 + base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xBC)(0x26); + base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xDA)(0xEE);
Replace Bitcoin code
+ base58Prefixes[SECRET_KEY] = list_of(193);//65+128
Replace Bitcoin code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update SECRET_KEY commit
https://github.com/FeatherCoin/Feathercoin/commit/6b63d986fc8389b1dd73d450406e731f2a0fc679
src/rpcmisc.cpp
+ "1. \"bitcoinaddress\" (string, required) The bitcoin address to use for the signature.\n"
Name change to Feathercoin
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update SECRET_KEY commit
https://github.com/FeatherCoin/Feathercoin/commit/6b63d986fc8389b1dd73d450406e731f2a0fc679
src/rpcwallet.cpp
+ "\"feathercoinaddress\" (string) A feathercoin address associated with the keys.\n"
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
fix MIN_PEER_PROTO_VERSION
https://github.com/FeatherCoin/Feathercoin/commit/85a6a4a9e2b0cf9c6e57957ced258bff3322e1a6
src/version.h
// disconnect from peers older than this proto version + static const int MIN_PEER_PROTO_VERSION = 60007;
Replace Bitcoin code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
team working with Bitmessage
https://github.com/FeatherCoin/Feathercoin/commit/78699b2fa3b63e225f2dd90944bee04dbd8124d0
src/qt/bitcoingui.cpp
FTC link to BitMessage. Other fixes later
+ #include <QProcess>
Additional code
+ + bitmessageAction = new QAction(QIcon(":/icons/bitmessage"), tr("Run B&itmessage..."), this); + bitmessageAction->setStatusTip(tr("Start Bitmessage from feathercoin wallett")); + bitmessageAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
Additional code
+ connect(bitmessageAction, SIGNAL(triggered()), this, SLOT(openBitmessageClicked()));
Additional code
- advanced->addSeparator();
Code removed
+ bitmessageAction->setEnabled(enabled); + void BitcoinGUI::openBitmessageClicked() + { + QProcess *process = new QProcess; + QString program="./bitmessagemain"; + QStringList arguments; + arguments << ""; + process->start(program,arguments); + } +
Additional code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
team working with Bitmessage
https://github.com/FeatherCoin/Feathercoin/commit/78699b2fa3b63e225f2dd90944bee04dbd8124d0
src/qt/bitcoingui.h
+ QAction *bitmessageAction;
Code added
+ /** Start Bitmessage Process */ + void openBitmessageClicked();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
team working with Bitmessage
https://github.com/FeatherCoin/Feathercoin/commit/78699b2fa3b63e225f2dd90944bee04dbd8124d0
src/qt/transactionview.cpp
+#include <QProcess>
Code added
+ QAction *sendMesslAction = new QAction(tr("Send transaction to Bitmessage"), this); + contextMenu->addAction(sendMesslAction); + connect(sendMesslAction, SIGNAL(triggered()), this, SLOT(sendMess())); + void TransactionView::sendMess() + { + if(!transactionView->selectionModel()) + return; + QModelIndexList selection = transactionView->selectionModel()->selectedRows(); + if(!selection.isEmpty()) + { + QString address = selection.at(0).data(TransactionTableModel::AddressRole).toString(); + QString amount = selection.at(0).data(TransactionTableModel::FormattedAmountRole).toString(); + QString txid = selection.at(0).data(TransactionTableModel::TxIDRole).toString(); + QString txDesc="Sent " + amount + " FTC to you, TransactionID=" + txid; + + QProcess *process = new QProcess; + QString program="./bitmessagemain "; + QStringList arguments; + arguments << amount << txid << txDesc; + process->start(program,arguments); + } + } +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
team working with Bitmessage
https://github.com/FeatherCoin/Feathercoin/commit/78699b2fa3b63e225f2dd90944bee04dbd8124d0
src/qt/transactionview.h
+ void sendMess();
additional code