[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/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.
-
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/m4/bitcoin_find_bdb51.m4
ACP and neoscrypt commit. New file 66 lines.
[FAQ] What is a .m4 file?
m4 is a general-purpose macro processor included in all UNIX-like operating systems, and is a component of the POSIX standard.
The language was designed by Brian Kernighan and Dennis Ritchie for the original versions of UNIX. It is an extension of an earlier macro processor m3, written by Ritchie for the AP-3 minicomputer.[1]
The macro preprocessor operates as a text-replacement tool. It is employed to re-use text templates, typically in computer programming applications, but also in text editing and text-processing applications. Most users require m4 as a dependency of GNU autoconf.
https://en.wikipedia.org/wiki/M4_(computer_language)
+ AC_DEFUN([BITCOIN_FIND_BDB51],[ + AC_MSG_CHECKING([for Berkeley DB C + + headers]) + BDB_CPPFLAGS= + BDB_LIBS= + bdbpath=X + bdb51path=X + bdbdirlist= + for _vn in 5.1 51 5 ''; do + for _pfx in b lib ''; do + bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" + done + done + for searchpath in $bdbdirlist ''; do
Start of Additional 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/m4/bitcoin_qt.m4
ACP and neoscrypt commit.
+ AC_MSG_WARN([$1; feathercoin-qt frontend will not be built]) + AC_MSG_CHECKING(whether to build Feathercoin Core GUI)
Name changes to feathercoin
-
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/main.cpp
ACP and neoscrypt commit. 2nd commit
+#include "checkpointsync.h" +unsigned int nTransactionsUpdated = 0; + +int nBaseMaturity = BASE_MATURITY; + int nBestHeight = -1; + uint256 nBestChainWork = 0; + uint256 nBestInvalidWork = 0; + uint256 hashBestChain = 0; + CBlockIndex* pindexBest = NULL;
Additional code
-// The 1st hard fork -const int nForkOne = 33000; -// The 2nd hard fork -const int nForkTwo = 87948; -// The 3rd hard fork -const int nForkThree = 204639;
Bitcoin fork code removed
+ static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // Feathercoin: starting difficulty is 1 / 2^12 + /* The difficulty after switching to NeoScrypt (0.015625) */ + static CBigNum bnNeoScryptSwitch(~uint256(0) >> 26); + +
Bitcoin code replaced with Neoscrypt code.
+map<uint256, CBlock*> mapOrphanBlocksA; + +static CBlockIndex* pblockindexFBBHLast;
Added code
+ if(nHeight >= nForkThree || (TestNet()))
Bitcoin fork code replaced
- // Subsidy is cut in half every 2100000 blocks, which will occur approximately every 4 years
- nSubsidy >>= (nHeight / 1799985); // 200,010 blocks at 200FTC and 1,599,975 at 80FTC
+ // Halving subsidy happens every 2,100,000 blocks. The code below takes account for the + // fact that the first 204,639 blocks took 2.5 minutes and after changed to 1 minute. + nSubsidy >>= (nHeight + 306960) / 2100000;
Bitcoin code replaced
+ return nSubsidy + nFees;
Code moved
+// Feathercoin: eHRC at 3rd hard fork
FTC code updated
+ /* The 4th hard fork and testnet hard fork */ + if((nHeight >= nForkFour) || (TestNet && (nHeight >= nTestnetFork))) { + if(!fNeoScrypt) fNeoScrypt = true; + /* Difficulty reset after the switch */ + if((nHeight == nForkFour) || (TestNet() && (nHeight == nTestnetFork))) + return(bnNeoScryptSwitch.GetCompact()); + } +
Fork included
- if (TestNet()) fHardFork = false;
Bitcoin code removed
+ bool fHardFork = (nHeight == nForkOne) || (nHeight == nForkTwo) || (nHeight == nForkThree) || (nHeight == nForkFour); + if(TestNet()) { + if (nHeight == nTestnetFork) { + fHardFork = true; + } else { + fHardFork = false; + } + }
Code Added
+ // Additional averaging over 4x nInterval window + if((nHeight >= nForkTwo) && (nHeight < nForkThree)) { + nInterval *= 4; + + const CBlockIndex* pindexFirst = pindexLast; + for(int i = 0; pindexFirst && i < nInterval; i + + ) + pindexFirst = pindexFirst->pprev; + + int nActualTimespanLong = + (pindexLast->GetBlockTime() - pindexFirst->GetBlockTime())/4; + + // Average between short and long windows + int nActualTimespanAvg = (nActualTimespan + nActualTimespanLong)/2; + + // Apply .25 damping + nActualTimespan = nActualTimespanAvg + 3*nTargetTimespan; + nActualTimespan /= 4; + + LogPrintf("RETARGET: nActualTimespanLong = %d, nActualTimeSpanAvg = %d, nActualTimespan (damped) = %d\n", + nActualTimespanLong, nActualTimespanAvg, nActualTimespan); + } +
Code added
+ LogPrintf("pindex->GetBlockHash()=%s \n",pindex->GetBlockHash().ToString()); + LogPrintf("view.GetBestBlock()=%s \n",view.GetBestBlock().ToString());
Code added
+ LogPrintf("ConnectBlock hashPrevBlock=%s \n",hashPrevBlock.ToString()); + LogPrintf("ConnectBlock view.GetBestBlock()=%s \n",view.GetBestBlock().ToString()); +
Code added
+ + if (!IsSyncCheckpointEnforced()) // checkpoint advisory mode + { + if (pindexBest->pprev && !CheckSyncCheckpoint(pindexBest->GetBlockHash(), pindexBest->pprev)) + strCheckpointWarning = _("Warning: checkpoint on different blockchain fork, contact developers to resolve the issue"); + else + strCheckpointWarning = ""; + } } }
Checkpointing code added
+ //0.8.7 ACP code have some problem in 0.9.3,so I delete them. + bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) + { + return true; + } +
Checkpointing code added
+ + // ppcoin: check that the block satisfies synchronized checkpoint + // checkpoint advisory mode + if (!IsSyncCheckpointEnforced() && !CheckSyncCheckpoint(hash, pindexPrev)) + return error("checkpoint AcceptBlock() : rejected by synchronized checkpoint");
Checkpointing code
+ + // ppcoin: check pending sync-checkpoint + AcceptPendingSyncCheckpoint();
Checkpointing code
+ + // ppcoin: ask for pending sync-checkpoint if any + if (!IsInitialBlockDownload()) + AskForPendingSyncCheckpoint(pfrom);
Checkpointing code
+ + // ppcoin: if responsible for sync-checkpoint send it + if (pfrom && !CSyncCheckpoint::strMasterPrivKey.empty() && + (int)GetArg("-checkpointdepth", -1) >= 0) + SendSyncCheckpoint(AutoSelectSyncCheckpoint()); +
Checkpointing code
+ + // ppcoin: load hashSyncCheckpoint + if (!pblocktree->ReadSyncCheckpoint(hashSyncCheckpoint)) + LogPrintf("LoadBlockIndexDB(): synchronized checkpoint not read\n"); + else + LogPrintf("LoadBlockIndexDB(): synchronized checkpoint %s\n", hashSyncCheckpoint.ToString().c_str());
Checkpointing code
+ + // ppcoin: initialize synchronized checkpoint + if (!WriteSyncCheckpoint(Params().HashGenesisBlock())) + return error("LoadBlockIndex() : failed to init sync checkpoint");
Checkpointing code
+ // ppcoin: if checkpoint master key changed must reset sync-checkpoint + if (!CheckCheckpointPubKey()) + return error("LoadBlockIndex() : failed to reset checkpoint master pubkey");
Checkpointing code
+ // Checkpoint warning + if (strCheckpointWarning != "") + { + nPriority = 900; + strStatusBar = strCheckpointWarning; + }
Checkpointing code
+ + // ppcoin: if detected invalid checkpoint enter safe mode + if (hashInvalidCheckpoint != 0) + { + nPriority = 3000; + strStatusBar = strRPC = _("WARNING: Inconsistent checkpoint found! Stop enforcing checkpoints and notify developers to resolve the issue."); + }
Checkpointing
+ + // ppcoin: relay sync-checkpoint + { + LOCK(cs_hashSyncCheckpoint); + if (!checkpointMessage.IsNull()) + checkpointMessage.RelayTo(pfrom); + }
Checkpointing
+ + // ppcoin: ask for pending sync-checkpoint if any + if (!IsInitialBlockDownload()) + AskForPendingSyncCheckpoint(pfrom);
Checkpointing
+ else if (strCommand == "checkpoint") // ppcoin synchronized checkpoint + { + CSyncCheckpoint checkpoint; + vRecv >> checkpoint; + + if (checkpoint.ProcessSyncCheckpoint(pfrom)) + { + // Relay + pfrom->hashCheckpointKnown = checkpoint.hashCheckpoint; + LOCK(cs_vNodes); + BOOST_FOREACH(CNode* pnode, vNodes) + checkpoint.RelayTo(pnode); + } + }
Checkpointing
-
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/main.h
ACP and neoscrypt commit. 2nd commit
+#include "neoscrypt.h" + /* Maturity threshold for PoW base transactions, in blocks (confirmations) */ + extern int nBaseMaturity; + static const int BASE_MATURITY = 100; +
Additional code
+ // The 1st hard fork + const int nForkOne = 33000; + // The 2nd hard fork + const int nForkTwo = 87948; + // The 3rd hard fork + const int nForkThree = 204639; + // The 4th hard fork + const int nForkFour = 432000; + + static const int nTestnetFork = 600; + + static const unsigned int nSwitchV2 = 1413936000; // Wed, 22 Oct 2014 00:00:00 GMT + static const unsigned int nTestnetSwitchV2 = 1406473140; // Sun, 27 Jul 2014 14:59:00 GMT + +
Additional code
+ extern int nBestHeight; + extern uint256 nBestChainWork; + extern uint256 nBestInvalidWork; + extern uint256 hashBestChain; + extern CBlockIndex* pindexBest; + extern unsigned int nTransactionsUpdated; +extern std::map<uint256, CBlock*> mapOrphanBlocksA; //for checkpointsync.cpp
Additional code
+/** Connect/disconnect blocks until pindexNew is the new tip of the active block chain */ +bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew);
Additional code
+ // (memory only) pointer to the index of the *active* successor of this block + CBlockIndex* pnext; +
Additional code
+ pnext = NULL; + pnext = NULL; + + bool IsInMainChain() const + { + return (pnext || this == pindexBest); + }
Additional 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/miner.cpp
ACP and neoscrypt commit.
+ unsigned int profile = fNeoScrypt ? 0x0 : 0x3;
Additional code
- char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
Bitcoin code removed
- scrypt_1024_1_1_256_sp(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad);
Bitcoin code replaced
+ //scrypt_1024_1_1_256_sp(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad); + neoscrypt((unsigned char *) &pblock->nVersion, (unsigned char *) &hash, profile);
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/neoscrypt.c
ACP and neoscrypt commit. Large New file
/* * Copyright (c) 2009 Colin Percival, 2011 ArtForz * Copyright (c) 2012 Andrew Moon (floodyberry) * Copyright (c) 2012 Samuel Neves <[email protected]> * Copyright (c) 2014 John Doering <[email protected]> * All rights reserved. #include <stdlib.h> #include <stdint.h> #include <string.h> #include "neoscrypt.h"
Start of neoscrypt 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/neoscrypt.h
ACP and neoscrypt commit. Large New file
+ #if (__cplusplus) + extern "C" { + #endif + + void neoscrypt(const unsigned char *input, unsigned char *output, unsigned int profile); + + #if (__cplusplus) + } + #else + + #define SCRYPT_BLOCK_SIZE 64 + #define SCRYPT_HASH_BLOCK_SIZE 64 + #define SCRYPT_HASH_DIGEST_SIZE 32 + + typedef uint8_t hash_digest[SCRYPT_HASH_DIGEST_SIZE];
Start of new 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/neoscrypt_asm.S
ACP and neoscrypt commit. Large New file
#if (ASM) && (__x86_64__) /* neoscrypt_blkcpy(dst, src, len) = SSE2 based block memcpy(); * len must be a multiple of 64 bytes aligned properly */ .globl neoscrypt_blkcpy neoscrypt_blkcpy: #if (WIN64) movq %rdi, %r10 movq %rsi, %r11 movq %rcx, %rdi movq %rdx, %rsi movq %r8, %rdx #endif
Start of code full file. 735 lines
-
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/net.cpp
ACP and neoscrypt commit.
+ void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd) + { + // main.h:PushGetBlocks(CNode* pnode, CBlockIndex* pindexBegin, uint256 hashEnd); + // Filter out duplicate requests + /*if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd) + return; + pindexLastGetBlocksBegin = pindexBegin; + hashLastGetBlocksEnd = hashEnd; + + PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd);*/ //'CBlockIndex*' to 'const CBlockLocator&' + } +
pindex code addition
+ for (int nHost = 1; nHost <= 2; nHost++)
Bitcoin Code replaced (seen this before?)
+ else if (nHost == 2) + { + addrConnect = CService("74.208.43.192", 80); // www.showmyip.com + + if (nLookup == 1) + { + CService addrIP("www.showmyip.com", 80, true); + if (addrIP.IsValid()) + addrConnect = addrIP; + } + + pszGet = "GET /simple/ HTTP/1.1\r\n" + "Host: www.showmyip.com\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n" + "Connection: close\r\n" + "\r\n"; + + pszKeyword = NULL; // Returns just IP address + }
Needs review. ACP site?
-
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/net.h
ACP and neoscrypt commit.
+ /** The maximum number of entries in mapAskFor */ + static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
Additional code
+ struct LocalServiceInfo { + int nScore; + int nPort; + }; + + extern CCriticalSection cs_mapLocalHost; + extern map<CNetAddr, LocalServiceInfo> mapLocalHost;
Additional code
- std::set<CAddress> setAddrKnown; + mruset<CAddress> setAddrKnown;
Bitcoin code replaced
+ uint256 hashCheckpointKnown; //ppcoin: known sent sync-checkpoint
Additional checkpoint code
- CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false) : ssSend(SER_NETWORK, INIT_PROTO_VERSION) + CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false) : ssSend(SER_NETWORK, INIT_PROTO_VERSION), setAddrKnown(5000)
Bitcoin code replaced
+ if (mapAskFor.size() > MAPASKFOR_MAX_SZ) + return; + + + void PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd);
Additional code