[Dev] Documenting Feathercoin Specific Software settings - Part 14
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Updated the layout of paperwalletdialog.ui, removed “Dogecoin” :: commit
Updated the layout of paperwalletdialog.ui, removed “Dogecoin” button style references
https://github.com/FeatherCoin/Feathercoin/commit/d38d7f9345be22cb772ce58bdad96da9e48f23bc
src/qt/forms/paperwalletdialog.ui
Various layout changes through Qt. Help / descriptive text changed, needs review for translations compatibility.
- <string>Many Wallets?</string> + <string>Number of Wallets?</string>
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Updated layout of fixed transaction tab, shiftdialog.ui, returned tab :: commit
Updated layout of fixed transaction tab, shiftdialog.ui, returned tabs to main tab after corrections
https://github.com/FeatherCoin/Feathercoin/commit/78055c7579bbfbd3626bab680b2b30693ef22e83
src/qt/forms/shiftdialog.ui
Various layout changes through Qt. Help / descriptive text changed, needs review for translations compatibility.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Updated version and copyright date on about box :: commit
Updated version and copyright date on about box - review on next release
https://github.com/FeatherCoin/Feathercoin/commit/f0c6f462085db7534470188d86448c0dd4c0e012
src/qt/forms/aboutdialog.ui
Various layout changes through Qt. Help / descriptive text changed, needs review for translations compatibility.
- <string notr="true">0.9.3.0-Standard</string> + <string notr="true">0.9.3.2-Core</string>
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Updated 0.9.2 INSTALL instructions to Feathercoin :: commit
Updated version and copyright date on about box - review on next release
https://github.com/FeatherCoin/Feathercoin/commit/b491dff012d4987ffe5aa1c0cf6d3a1a0296ef0c
INSTALL
+Building Feathercoin -See doc/build-*.md for instructions on building bitcoind, +See doc/build-*.md for instructions on building the coin daemon, -implementation of Bitcoin. +implementation of Feathercoin.
Code replaced name change
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Readme.md Feathercoin Fork Policy and Bitcoin Core Development :: commit
Readme.md Feathercoin Fork Policy and Bitcoin Core Development Information
https://github.com/FeatherCoin/Feathercoin/commit/deede1266c0ede736ce5ecf998c74fa00f080612
Updated readme to be in-line with current FTC development policy, to be a fork of and integrate with Bitcoin developments.
+Feathercoin Core +================ + +What is Feathercoin? +-------------------- + +Feathercoin is now a Fork of the Bitcoin core project. It contains a it's own +set up of certain parameters, such as block times and extra features such as +enhanced mining difficulty calculations and it's own encryption algorithm. + +Feathercoin is an open source project, additional changes and fixes to those in +the Bitcoin source code are managed by the forum community as is, depending on +the change or scale of release. + +http://forum.feathercoin.com/ + +Development mailing list / Forum Thread : + +http://forum.feathercoin.com/category/71/technical-development + + +What is Bitcoin? +---------------- + +Bitcoin is an experimental digital currency that enables instant payments to +anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate +with no central authority: managing transactions and issuing money are carried +out collectively by the network. Bitcoin Core is the name of open source +software which enables the use of this currency. + +For more information, as well as an immediately useable, binary version of +the Bitcoin Core software, see https://bitcoin.org/en/download, or read the +[original whitepaper](https://bitcoincore.org/bitcoin.pdf). + + +[![Build Status](https://travis-ci.org/bitcoin/bitcoin.svg?branch=master)](https://travis-ci.org/bitcoin/bitcoin) + +https://bitcoincore.org + +License +------- + +Bitcoin Core is released under the terms of the MIT license. See [COPYING](COPYING) for more +information or see https://opensource.org/licenses/MIT. + +Development Process +------------------- + +The `master` branch is regularly built and tested, but is not guaranteed to be +completely stable. [Tags](https://github.com/bitcoin/bitcoin/tags) are created +regularly to indicate new official, stable release versions of Bitcoin Core. + +The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md). + +The developer [mailing list](https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev) +should be used to discuss complicated or controversial changes before working +on a patch set. + +Developer IRC can be found on Freenode at #bitcoin-core-dev. + +Testing +------- + +Testing and code review is the bottleneck for development; we get more pull +requests than we can review and test on short notice. Please be patient and help out by testing +other people's pull requests, and remember this is a security-critical project where any mistake might cost people +lots of money. + +### Automated Testing + +Developers are strongly encouraged to write [unit tests](/doc/unit-tests.md) for new code, and to +submit new unit tests for old code. Unit tests can be compiled and run +(assuming they weren't disabled in configure) with: `make check` + +There are also [regression and integration tests](/qa) of the RPC interface, written +in Python, that are run automatically on the build server. +These tests can be run (if the [test dependencies](/qa) are installed) with: `qa/pull-tester/rpc-tests.py` + +The Travis CI system makes sure that every pull request is built for Windows, Linux, and OS X, and that unit/sanity tests are run automatically. + +### Manual Quality Assurance (QA) Testing + +Changes should be tested by somebody other than the developer who wrote the +code. This is especially important for large or high-risk changes. It is useful +to add a test plan to the pull request description if testing the changes is +not straightforward. + +Translations +------------ + +Changes to translations as well as new translations can be submitted to +[Bitcoin Core's Transifex page](https://www.transifex.com/projects/p/bitcoin/). + +Translations are periodically pulled from Transifex and merged into the git repository. See the +[translation process](doc/translation_process.md) for details on how this works. + +**Important**: We do not accept translation changes as GitHub pull requests because the next +pull from Transifex would automatically overwrite them again. + +Translators should also subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bitcoin-translators).
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Added a simple Feathercoin build dependency list for Ubuntu to Docs :: commit
Updated help and documentatio, Added a simple Feathercoin build dependency list for an example Ubuntu build instructions to Documentation
https://github.com/FeatherCoin/Feathercoin/commit/0a31e8a3c7605cf18ef5f148883cd1f24c2d4374
doc/README.md
+Feathercoin 0.9.3.2
Code updated copyright, review all done?
+Example Build from source +The Feathercoin wallet contains a number of additional features which require additional libraries to the Bitcoin build instructions. + +### Quick build example for Ubuntu 16.04 + +sudo apt-get install git +sudo apt-get install autoconf automake debhelper dh-autoreconf +sudo apt-get install libssl-dev libdb++-dev libminiupnpc-dev binutils +sudo apt-get install autotools-dev +# You need the Qt5 run-time libraries to build Feathercoin-Qt. -You also need the zxing (Zebra Crossing) libraries for qrcode support. + -The libraries should be installed by your package manager,if you use an installation package for you distribution. +sudo apt-get install qtbase5-dev qttools5-dev-tools +sudo apt-get install libqt5printsupport5 libqtopengl5-dev +sudo apt-get install libqjson-dev + +sudo apt-get install libqt5gui5 libqt5core5 libqt5dbus5 + +sudo apt-get libssl-dev + +sudo apt-get install libzxing libqrencode-dev pkg-config libprotobuf-dev protobuf-compiler +sudo apt-get install debhelper +Download the .deb file or Install the binaries available for zxing after installing the Feathercoin PPA + +http://forum.feathercoin.com/topic/8327/guide-feathercoin-wallet-ppa-and-binaries-on-ubuntu-and-debian-linux +sudo apt-get update +sudo apt-get install libzxing +# copy the zxing files to source : +cp -R /usr/include/zxing ~/Feathercoin/src/zxing + +Install boost Libraries + +sudo apt-get install libboost-all-dev +sudo apt install libmessaging-menu-dev + +cd Feathercoin +make clean + autoupdate + ./autogen.sh + ./configure --with-gui=qt5 --enable-tests=no + make + +Possible issues +---------------- + +# Use alternate database, 4.8 is still most portable. +sudo apt-get install libdb5.3-dev + + + +Running +--------------------- +The following are some helpful notes on how to run Feathercoin on your native platform. + +### Unix
Updated build instructions example
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Additional work on Layout to paperwalletdialog.ui close button :: commit
Additional work on Layout to paperwalletdialog.ui close button
https://github.com/FeatherCoin/Feathercoin/commit/c62f8d602b62eafb9f2908aa6b9b04949e66ed81
src/qt/forms/paperwalletdialog.ui
Various layout updates.
Further minor tweaks to paperwallet, regress main.h changes
https://github.com/FeatherCoin/Feathercoin/commit/c62f8d602b62eafb9f2908aa6b9b04949e66ed81
src/qt/forms/paperwalletdialog.ui
Further Minor layout updates.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Update the Dependencies layout of FTC Build docs :: commit
Update the Dependencies layout of FTC Build from UNIX Source Instructions documentation. To make it easier to Control Feathercoin name changes / merge conflicts.
https://github.com/FeatherCoin/Feathercoin/commit/bf3de3ab3c685dd749ae98fc24cc68ec2d41f28c
doc/README.md
Mostly markdown changes for layout.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Update the Dependencies layout of FTC Build docs :: commit
Update the Dependencies layout of FTC Build from UNIX Source Instructions documentation. To make it easier to Control Feathercoin name changes / merge conflicts.
https://github.com/FeatherCoin/Feathercoin/commit/bf3de3ab3c685dd749ae98fc24cc68ec2d41f28c
doc/README.md
Minor changes, mostly layout, extra headers to describe code being installed and bold headers.
Update the Dependencies layout of FTC Build docs :: commit
Update the Dependencies layout of FTC Build from UNIX Source Instructions documentation. To make it easier to Control Feathercoin name changes / merge conflicts.
https://github.com/FeatherCoin/Feathercoin/commit/bf3de3ab3c685dd749ae98fc24cc68ec2d41f28c
doc/README.md
Minor changes, mostly layout, extra headers to describe code being installed and bold headers.
Layout changes to FTC Build from Source Guide :: commit
https://github.com/FeatherCoin/Feathercoin/commit/3eb6e1df2e45b25cf89ff97a8705d14cd6deee4a
doc/README.md
Minor changes, mostly layout, extra headers to describe code being installed and bold headers.
Updates to Layout of the FTC build from source Guide :: commit
https://github.com/FeatherCoin/Feathercoin/commit/7efe9a31b94cf871d296ffded73ba433656b014b
doc/README.md
Minor changes, mostly layout, extra headers to describe code being installed and bold headers.
+## Enable uPNP +--enable-upnp-default + +## Dependency issues with qr codes + +--with-qrcode=no +
Code added, extra cases / options / headers.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Expanded the operations dropdown of opennames dialog box :: commit
User interface review and improvements
https://github.com/FeatherCoin/Feathercoin/commit/eb53d17872c34bb1cffa4a8eec3732717aff5707
src/qt/forms/opennamedialog.ui
Minor layout change changes
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/checkpointsync.cpp
-//#include "bitcoinrpc.h"
Commented out - Code removed
-#include "main.h"
Code removed
-// ppcoin: sync-checkpoint master key +//sync-checkpoint master key
Code / comment replaced
- if (!SetBestChain(state, pindexCheckpoint))
//g_signals.SetBestChain(chainActive.GetLocator())
+ if (!SetBestChain(state, pindexCheckpoint))
Code replaced comment removed
- if (fDebug) - LogPrintf("AcceptPendingSyncCheckpoint : sync-checkpoint at %s\n", hashSyncCheckpoint.ToString().c_str()); + + LogPrintf("AcceptPendingSyncCheckpoint : sync-checkpoint at %s\n", hashSyncCheckpoint.ToString().c_str());
Code replaced LogPrintf interface
- if (mapOrphanBlocksA.count(hashPendingCheckpoint) - && hashBlock == + if (mapOrphanBlocks.count(hashPendingCheckpoint) WantedByOrphan(mapOrphanBlocksA[hashPendingCheckpoint])) + && hashBlock ==
Code replaced mapOrphanBlocksA is out
+ LogPrintf("ResetSyncCheckpoint: SetBestChain to hardened checkpoint %s\n", hash.ToString().c_str());
Code replaced
+ if (pfrom && hashPendingCheckpoint != 0 && (!mapBlockIndex.count(hashPendingCheckpoint)) && (!mapOrphanBlocks.count(hashPendingCheckpoint)))
Code replaced mapOrphanBlocksA.
-uint256 WantedByOrphan(const CBlock* pblockOrphan) +uint256 WantedByOrphan(const COrphanBlock* pblockOrphan)
Code replaced
+ while (mapOrphanBlocks.count(pblockOrphan->hashPrev)) + pblockOrphan = mapOrphanBlocks[pblockOrphan->hashPrev]; + return pblockOrphan->hashPrev;
Code replaced mapOrphanBlocksA.
+ LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 100,hashCheckpoint=%s\n",hashCheckpoint.ToString().c_str());
Code replaced / added
- if (!mapBlockIndex.count(hashCheckpoint)) - { + if (!mapBlockIndex.count(hashCheckpoint)) //count=0 + { + LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 110,mapBlockIndex.count=%d \n",mapBlockIndex.count(hashCheckpoint)
Code replaced
+ LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 130: pending for sync-checkpoint %s\n", hashCheckpoint.ToString().c_str());
Code replaced
+ // proof-of-stake because getblocks may not get it this time - pfrom->AskFor(CInv(MSG_BLOCK, mapOrphanBlocksA.count(hashCheckpoint)? WantedByOrphan(mapOrphanBlocksA[hashCheckpoint]) : hashCheckpoint)); + pfrom->AskFor(CInv(MSG_BLOCK, mapOrphanBlocks.count(hashCheckpoint)? WantedByOrphan(mapOrphanBlocks[hashCheckpoint]) : hashCheckpoint)); + LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 140 ,AskFor.\n");
Code replaced
+ LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 201 hashCheckpoint=%s ,nHeight=%d\n",hashCheckpoint.ToString().c_str(),mapBlockIndex[hashCheckpoint]->nHeight); + LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 210,pindexCheckpoint=%s\n",pindexCheckpoint->ToString()); + LogPrintf("CSyncCheckpoint::ProcessSyncCheckpoint 220,IsInMainChain=%d\n",pindexCheckpoint->IsInMainChain()); + LogPrintf("ProcessSyncCheckpoint SetBestChain Invalid,hashInvalidCheckpoint=%s.\n",hashInvalidCheckpoint.ToString().c_str()); + LogPrintf("ProcessSyncCheckpoint: sync-checkpoint at %s\n", hashCheckpoint.ToString().c_str());
Code replaced / added LogPrintf(
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/checkpointsync.h
+#include "main.h"
Code added
-uint256 WantedByOrphan(const CBlock* pblockOrphan); +uint256 WantedByOrphan(const COrphanBlock* pblockOrphan);
Code replaced
+ // returns true if wasn't already sent 如果不是已经发送(未发送返回true) if (pnode->hashCheckpointKnown != hashCheckpoint) { pnode->hashCheckpointKnown = hashCheckpoint; - pnode->PushMessage("checkpoint", *this); + pnode->PushMessage("checkpoint", *this); //发送CSyncCheckpoint
Comments / code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/main.cpp
- -struct COrphanBlock { - uint256 hashBlock; - uint256 hashPrev; - vector<unsigned char> vchBlock; -};
Code removed
- LogPrintf("SetBestChain: chainActive + LOCK(cs_main); Height=%d,BlockHash=%s\n",pindex->nHeight,pindex->GetBlockHash().ToString()); + CBlockIndex *pindexOldTip = chainActive.Tip(); + LogPrintf("SetBestChain: chainActive nHeight=%d,BlockHash=%s\n",pindexOldTip->nHeight,pindexOldTip->GetBlockHash().ToString());
Code replaced
- if (!ConnectTip(state,pindexNew)) - { - LogPrintf("SetBestChain: false.\n"); - return false; - } - + return true; + + // All modifications to the coin state will be done in this cache. + // Only when all have succeeded, we push it to pcoinsTip. + CCoinsViewCache view(*pcoinsTip, true); + + // Find the fork (从pindexOldTip退到pindexNew) + CBlockIndex* pfork = pindexOldTip; + CBlockIndex* plonger = pindexNew; + while (pfork && pfork != plonger) + { + while (plonger->nHeight > pfork->nHeight) { + plonger = plonger->pprev; + assert(plonger != NULL); + } + if (pfork == plonger) + break; + pfork = pfork->pprev; + assert(pfork != NULL); + } + LogPrintf("SetBestChain: pfork nHeight=%d,BlockHash=%s\n",pfork->nHeight,pfork->GetBlockHash().ToString()); + + // List of what to disconnect (从pindexOldTip退到pindexNew=pfork) + vector<CBlockIndex*> vDisconnect; + for (CBlockIndex* pindex = pindexOldTip; pindex != pfork; pindex = pindex->pprev) + vDisconnect.push_back(pindex); + + // List of what to connect (typically only pindexNew) + vector<CBlockIndex*> vConnect; + for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev) + vConnect.push_back(pindex); + reverse(vConnect.begin(), vConnect.end()); + + if (vDisconnect.size() > 0) { + LogPrintf("REORGANIZE: Disconnect %"PRIszu" blocks; %s...\n", vDisconnect.size(), pfork->GetBlockHash().ToString()); + LogPrintf("REORGANIZE: Connect %"PRIszu" blocks; ...%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString()); + } +
Code replaced
+ // return false;
Commented out
+bool CBlockIndex::IsInMainChain() const +{ + //return (pnext || this == chainActive.Tip()); + return chainActive.Contains(this); +} +
Commented out?
- vRecv >> checkpoint; + vRecv >> checkpoint; //收到的检查点 + LogPrintf("Receive checkpoint,hashCheckpoint=%s\n.",checkpoint.hashCheckpoint.ToString().c_str());
Code replaced
+ LogPrintf("checkpoint.ProcessSyncCheckpoint(pfrom)=true, hashCheckpoint=%s\n.",checkpoint.hashCheckpoint.ToString().c_str()); + LogPrintf("checkpoint.ProcessSyncCheckpoint Relay=OK \n.");
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/main.h
-//static const char* OPENNAME_MAGIC_BYTES_MAINSET="08"; static const unsigned char OPENNAME_MAGIC_BYTES_MAINSET=0x08; -//static const char* OPENNAME_MAGIC_BYTES_TESTSET="88";
Code removed
+struct COrphanBlock { + uint256 hashBlock; + uint256 hashPrev; + vector<unsigned char> vchBlock; +};
Code added
-extern std::map<uint256, CBlock*> mapOrphanBlocksA; //for checkpointsync.cpp +extern std::map<uint256, CBlock*> mapOrphanBlocksA; +extern std::map<uint256, COrphanBlock*> mapOrphanBlocks;
Review ?? mapOrphanBlocksA; stays iin this time?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/net.cpp
+#include "main.h"
Code added
-{ - // main.h:PushGetBlocks(CNode* pnode, CBlockIndex* pindexBegin, uint256 hashEnd); // Filter out duplicate requests - /*if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd) +{ + if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd)
Code replaced
- PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd);*/ //'CBlockIndex*' to 'const CBlockLocator&' + //PushMessage("getblocks", CBlockLocator(pindexBegin->phashBlock), hashEnd); + PushMessage("getblocks", chainActive.GetLocator(pindexBegin), hashEnd);
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/rpcnet.cpp
+#include "base58.h"
Code added
+ +// make a public-private key pair (first introduced in ppcoin) +Value makekeypair(const Array& params, bool fHelp) +{ + if (fHelp || params.size() > 1) + throw runtime_error( + "makekeypair [prefix]\n" + "Make a public/private key pair.\n" + "[prefix] is optional preferred prefix for the public key.\n"); + + string strPrefix = ""; + if (params.size() > 0) + strPrefix = params[0].get_str(); + + CKey key; + //CPubKey pubkey; + bool fCompressed; + int nCount = 0; + do + { + key.MakeNewKey(false); + //pubkey = key.GetPubKey(); + nCount++; + } while (nCount < 10000 && strPrefix != HexStr(key.GetPubKey().Raw()).substr(0, strPrefix.size())); + //while (nCount < 10000 && strPrefix != HexStr(pubkey.begin(), pubkey.end()).substr(0, strPrefix.size())); + + //if (strPrefix != HexStr(pubkey.begin(), pubkey.end()).substr(0, strPrefix.size())) + if (strPrefix != HexStr(key.GetPubKey().Raw()).substr(0, strPrefix.size())) + return Value::null; + + CSecret vchSecret = key.GetSecret(fCompressed); + + Object result; + //result.push_back(Pair("PublicKey", HexStr(pubkey.begin(), pubkey.end()))); + //result.push_back(Pair("PrivateKey", CBitcoinSecret(key).ToString())); + result.push_back(Pair("PublicKey", HexStr(key.GetPubKey().Raw()))); + result.push_back(Pair("PrivateKey", CBitcoinSecret(vchSecret, fCompressed).ToString())); + return result; +}
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/rpcserver.cpp
+ { "makekeypair", &makekeypair, true, false, true },
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
src/rpcserver.h
+extern json_spirit::Value makekeypair(const json_spirit::Array& params, bool fHelp);
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/7b5d133d41fef537a49145346a31b8358d5b83c2
Code review
I think that more logprintf statements should be executed only,if the debug flag is set.
The current log is to exhaustive and a 'normal ’ user doesn’t need it. Please insert back the 'if fDebug…'statements and add themto the new log entriesWas this checked for compliance?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch missing :: commit
Bug fix
https://github.com/FeatherCoin/Feathercoin/commit/f0229d3371cf2811ded7ad8641c1a1834862c2d9
src/main.cpp
- LogPrintf("CheckProofOfWork() hash=%s \n",hash.ToString().c_str()); + //LogPrintf("CheckProofOfWork() hash=%s \n",hash.ToString().c_str()); + //LogPrintf("CheckProofOfWork() nBits=%i \n",nBits); + //LogPrintf("CheckProofOfWork() bnTarget.getuint256=%s \n",bnTarget.getuint256().ToString().c_str()); + LogPrintf("SetBestChain:100 chainActive nHeight=%d,BlockHash=%s\n",pindexOldTip->nHeight,pindexOldTip->GetBlockHash().ToString()); + LogPrintf("SetBestChain:100 pindexNew + LogPrintf("SetBestChain:110 pfork nHeight=%d,BlockHash=%s\n",pfork->nHeight,pfork->GetBlockHash().ToString()); + LogPrintf("SetBestChain:120: Disconnect %"PRIszu" blocks; %s...\n", vDisconnect.size(), pfork->GetBlockHash().ToString()); + LogPrintf("SetBestChain:120: Connect %"PRIszu" blocks; ...%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString());
Code replaced
+ // Disconnect shorter branch + vector<CTransaction> vResurrect; + BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) { + CBlock block; + if (!ReadBlockFromDisk(block, pindex)) + return state.Abort(_("Failed to read block")); + int64 nStart = GetTimeMicros(); + bool fClean = true; + if (!DisconnectBlock(block, state, pindex, view, &fClean)) + return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); + if (fBenchmark) + LogPrintf("- Disconnect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); + + // Queue memory transactions to resurrect. + // We only do this for blocks after the last checkpoint (reorganisation before that + // point should only happen with -reindex/-loadblock, or a misbehaving peer. + BOOST_FOREACH(const CTransaction& tx, block.vtx) + if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate()) + vResurrect.push_back(tx); + } + + // Connect longer branch + vector<CTransaction> vDelete; + BOOST_FOREACH(CBlockIndex *pindex, vConnect) { + CBlock block; + if (!ReadBlockFromDisk(block, pindex)) + return state.Abort(_("Failed to read block")); + int64 nStart = GetTimeMicros(); + if (!ConnectBlock(block, state, pindex, view)) { + if (state.IsInvalid()) { + InvalidChainFound(pindexNew); + InvalidBlockFound(pindex,state); + } + return error("SetBestBlock() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); + } + if (fBenchmark) + LogPrintf("- Connect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); + + // Queue memory transactions to delete + BOOST_FOREACH(const CTransaction& tx, block.vtx) + vDelete.push_back(tx); + } + LogPrintf("SetBestChain:130: \n"); + + // Flush changes to global coin state + int64 nStart = GetTimeMicros(); + int nModified = view.GetCacheSize(); + assert(view.Flush()); + int64 nTime = GetTimeMicros() - nStart; + if (fBenchmark) + LogPrintf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified); + + if (!WriteChainState(state)) + return false; + + // Resurrect memory transactions that were in the disconnected branch + BOOST_FOREACH(CTransaction& tx, vResurrect) { + // ignore validation errors in resurrected transactions + CValidationState stateDummy; + list<CTransaction> removed; + if (!AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL)) + mempool.remove(tx, removed, true); + } + // Delete redundant memory transactions that are in the connected branch + list<CTransaction> txConflicted; + BOOST_FOREACH(CTransaction& tx, vDelete) { + list<CTransaction> removed; + mempool.remove(tx, removed); + mempool.removeConflicts(tx, txConflicted); + } + mempool.check(pcoinsTip); + LogPrintf("SetBestChain:140: \n"); + + UpdateTip(pindexNew); + + // Tell wallet about transactions that went from mempool to conflicted: + BOOST_FOREACH(const CTransaction &tx, txConflicted) { + SyncWithWallets(tx.GetHash(), tx, NULL); + }
Code added
+ LogPrintf("SetBestChain:150 true.\n");
Code replaced
- //return (pnext || this == chainActive.Tip());
Comment removed