src/monacoin
src/monacoind
src/test_monacoin
-!src/leveldb-*/Makefile
+!src/leveldb*/Makefile
.monacoin
*.*~*
*.rej
-Copyright (c) 2009-2013 Bitcoin Developers
-Copyright (c) 2011-2013 Litecoin Developers
-Copyright (c) 2013 Monacoin Developers
+Copyright (c) 2009-2014 Bitcoin Developers
+Copyright (c) 2011-2014 Litecoin Developers
+Copyright (c) 2013-2014 Dr Kimoto Chan
+Copyright (c) 2013-2014 Monacoin Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
http://www.monacoin.com
-Copyright (c) 2009-2013 Bitcoin Developers
-Copyright (c) 2011-2013 Litecoin Developers
-Copyright (c) 2013 Monacoin Developers
+Copyright (c) 2009-2014 Bitcoin Developers
+Copyright (c) 2011-2014 Litecoin Developers
+Copyright (c) 2013-2014 Dr Kimoto Chan
+Copyright (c) 2013-2014 Monacoin Developers
What is Monacoin?
----------------
TEMPLATE = app
TARGET = monacoin-qt
macx:TARGET = "Monacoin-Qt"
-VERSION = 0.8.6.1
+VERSION = 0.8.6.2
INCLUDEPATH += src src/json src/qt
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
elif cmd == "getaccount":
try:
- addr = raw_input("Enter a Bitcoin address: ")
+ addr = raw_input("Enter a Monacoin address: ")
print access.getaccount(addr)
except:
print "\n---An error occurred---\n"
elif cmd == "getreceivedbyaddress":
try:
- addr = raw_input("Enter a Bitcoin address (optional): ")
+ addr = raw_input("Enter a Monacoin address (optional): ")
mc = raw_input("Minimum confirmations (optional): ")
try:
print access.getreceivedbyaddress(addr, mc)
reference_datetime: "2011-01-30 00:00:00"
remotes: []
files:
-- "boost_1_54_0.tar.bz2"
+- "boost_1_55_0.tar.bz2"
- "boost-mingw-gas-cross-compile-2013-03-03.patch"
script: |
# Defines
INSTALLPREFIX="$OUTDIR/staging/boost"
HOST=i686-w64-mingw32
# Input Integrity Check
- echo "047e927de336af106a24bceba30069980c191529fd76b8dff8eb9a328b48ae1d boost_1_54_0.tar.bz2" | shasum -c
+ echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c
echo "d2b7f6a1d7051faef3c9cf41a92fa3671d905ef1e1da920d07651a43299f6268 boost-mingw-gas-cross-compile-2013-03-03.patch" | shasum -c
mkdir -p "$INSTALLPREFIX"
- tar xjf boost_1_54_0.tar.bz2
- cd boost_1_54_0
+ tar xjf boost_1_55_0.tar.bz2
+ cd boost_1_55_0
GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2)
echo "using gcc : $GCCVERSION : $HOST-g++
:
# Patch Mirror: http://rose.makesad.us/~paulproteus/mirrors/boost-mingw-gas-cross-compile-2013-03-03.patch
patch -p0 < ../boost-mingw-gas-cross-compile-2013-03-03.patch
- # Bug Workaround: boost-1.54.0 broke the ability to disable zlib
+ # Bug Workaround: boost-1.54.0 broke the ability to disable zlib, still broken in 1.55
# https://svn.boost.org/trac/boost/ticket/9156
sed -i 's^\[ ac.check-library /zlib//zlib : <library>/zlib//zlib^^' libs/iostreams/build/Jamfile.v2
sed -i 's^<source>zlib.cpp <source>gzip.cpp \]^^' libs/iostreams/build/Jamfile.v2
cd "$INSTALLPREFIX"
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
- zip -r boost-win32-1.54.0-gitian-r6.zip *
- cp boost-win32-1.54.0-gitian-r6.zip $OUTDIR
+ zip -r boost-win32-1.55.0-gitian-r6.zip *
+ cp boost-win32-1.55.0-gitian-r6.zip $OUTDIR
- "zip"
- "unzip"
- "faketime"
-- "unzip"
reference_datetime: "2011-01-30 00:00:00"
remotes: []
files:
}
isEmpty(BDB_LIB_SUFFIX) {
-@@ -361,15 +361,15 @@
+@@ -361,15 +361,23 @@
}
isEmpty(BDB_INCLUDE_PATH) {
isEmpty(BOOST_INCLUDE_PATH) {
- macx:BOOST_INCLUDE_PATH = /opt/local/include
+ macx:BOOST_INCLUDE_PATH = /usr/local/opt/boost/include
++}
++
++isEmpty(OPENSSL_LIB_PATH) {
++ macx:OPENSSL_LIB_PATH = /usr/local/opt/openssl/lib
++}
++
++isEmpty(OPENSSL_INCLUDE_PATH) {
++ macx:OPENSSL_INCLUDE_PATH = /usr/local/opt/openssl/include
}
win32:DEFINES += WIN32
Litecoin 0.8.x BETA
====================
-Copyright (c) 2009-2013 Bitcoin Developers
-Copyright (c) 2011-2013 Litecoin Developers
+Copyright (c) 2009-2014 Bitcoin Developers
+Copyright (c) 2011-2014 Litecoin Developers
+Copyright (c) 2013-2014 Dr Kimoto Chan
+Copyright (c) 2011-2014 Monacoin Developers
+
Distributed under the MIT/X11 software license, see the accompanying
file COPYING or http://www.opensource.org/licenses/mit-license.php.
Litecoin 0.8.x BETA
-Copyright (c) 2009-2013 Bitcoin Developers
-Copyright (c) 2011-2013 Litecoin Developers
+Copyright (c) 2009-2014 Bitcoin Developers
+Copyright (c) 2011-2014 Litecoin Developers
+Copyright (c) 2013-2014 Dr Kimoto Chan
+Copyright (c) 2011-2014 Monacoin Developers
Distributed under the MIT/X11 software license, see the accompanying
file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in
apt-get install qt4-qmake libqt4-dev build-essential libboost-dev libboost-system-dev \
libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev \
- libssl-dev libdb4.8++-dev
+ libssl-dev libdb4.8++-dev libminiupnpc-dev
for Ubuntu >= 12.04 (please read the 'Berkely DB version warning' below):
+0.8.6.2 changes
+=============
+
+- Windows only: Fixes issue where network connectivity can fail.
+
+- Cleanup of SSE2 scrypt detection.
+
+- Minor fixes:
+ - s/Bitcoin/Litecoin/ in the Coin Control example
+ - Fix custom build on MacOS X 10.9
+ - Fix QT5 custom build
+ - Update Debian build instructions
+ - Update Homebrew build
+
0.8.6.1 changes
=============
#!/usr/bin/env python
# Jonas Schnelli, 2013
-# make sure the Bitcoin-Qt.app contains the right plist (including the right version)
+# make sure the Monacoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
bitcoinDir = "./";
inFile = bitcoinDir+"/share/qt/Info.plist"
-outFile = "Bitcoin-Qt.app/Contents/Info.plist"
+outFile = "Monacoin-Qt.app/Contents/Info.plist"
version = "unknown";
fileForGrabbingVersion = bitcoinDir+"bitcoin-qt.pro"
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
-!define VERSION 0.8.6.1
+!define VERSION 0.8.6.2
!define COMPANY "Monacoin project"
!define URL http://www.monacoin.org/
!insertmacro MUI_LANGUAGE English
# Installer attributes
-OutFile monacoin-0.8.6.1-win32-setup.exe
+OutFile monacoin-0.8.6.2-win32-setup.exe
InstallDir $PROGRAMFILES\Monacoin
CRCCheck on
XPStyle on
BrandingText " "
ShowInstDetails show
-VIProductVersion 0.8.6.1
+VIProductVersion 0.8.6.2
VIAddVersionKey ProductName Monacoin
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
map<uint256, CAlert> mapAlerts;
CCriticalSection cs_mapAlerts;
-static const char* pszMainKey = "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9";
-static const char* pszTestKey = "04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a";
+static const char* pszMainKey = "04fc55d919cdea21e8171fea24c3cf23864ff64a53404829ad50af86e1be1b8217115701b348d50c6aaba6983bc148d3c9e6fa8c11365889774fc1db6da6840c06";
+static const char* pszTestKey = "04887665070e79d20f722857e58ec8f402733f710135521a0b63441419bf5665ba4623bed13fca0cb2338682ab2a54ad13ce07fbc81c3c2f0912a4eb8521dd3cfb";
void CUnsignedAlert::SetNull()
{
static inline unsigned short GetDefaultRPCPort()
{
- return GetBoolArg("-testnet", false) ? 9402 : 19402;
+ return GetBoolArg("-testnet", false) ? 19402 : 9402;
}
Object JSONRPCError(int code, const string& message)
{
typedef std::map<int, uint256> MapCheckpoints;
- //
+ // How many times we expect transactions after the last checkpoint to
+ // be slower. This number is a compromise, as it can't be accurate for
+ // every system. When reindexing from a fast disk with a slow CPU, it
+ // can be up to 20, while when downloading from a slow network with a
+ // fast multicore CPU, it won't be much higher than 1.
+ static const double fSigcheckVerificationFactor = 5.0;
+
+ struct CCheckpointData {
+ const MapCheckpoints *mapCheckpoints;
+ int64 nTimeLastCheckpoint;
+ int64 nTransactionsLastCheckpoint;
+ double fTransactionsPerDay;
+ };
+
// What makes a good checkpoint block?
// + Is surrounded by blocks with reasonable timestamps
// (no blocks before with a timestamp after, none after with
// timestamp before)
// + Contains no strange transactions
- //
-
- // no checkpoint now, can be added in later releases
static MapCheckpoints mapCheckpoints =
- boost::assign::map_list_of
- ( 0, uint256("0xff9f1c0116d19de7c9963845e129f9ed1bfc0b376eb54fd7afa42e0d418c8bb6"))
+ boost::assign::map_list_of
+ ( 58700, uint256("0xa9c5d9878864b77ba52b068787b83ce2fcf526c5899f40af51c9d441eeb4c84d"))
+ ;
+ static const CCheckpointData data = {
+ &mapCheckpoints,
+ 1393245819, // * UNIX timestamp of last checkpoint block
+ 277936, // * total number of transactions between genesis and last checkpoint
+ // (the tx=... number in the SetBestChain debug.log lines)
+ 5000.0 // * estimated number of transactions per day after checkpoint
+ };
- ;
+ const CCheckpointData &Checkpoints() {
+#if 0
+ if (fTestNet)
+ return dataTestnet;
+ else
+#endif
+ return data;
+ }
bool CheckBlock(int nHeight, const uint256& hash)
{
if (fTestNet) return true; // Testnet has no checkpoints
+ if (!GetBoolArg("-checkpoints", true))
+ return true;
+
+ const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
- MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight);
- if (i == mapCheckpoints.end()) return true;
+ MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
+ if (i == checkpoints.end()) return true;
return hash == i->second;
- // return true;
+ }
+
+ // Guess how far we are in the verification process at the given block index
+ double GuessVerificationProgress(CBlockIndex *pindex) {
+ if (fTestNet) return 0.0; // Testnet has no checkpoints
+ if (pindex==NULL)
+ return 0.0;
+
+ int64 nNow = time(NULL);
+
+ double fWorkBefore = 0.0; // Amount of work done before pindex
+ double fWorkAfter = 0.0; // Amount of work left after pindex (estimated)
+ // Work is defined as: 1.0 per transaction before the last checkoint, and
+ // fSigcheckVerificationFactor per transaction after.
+
+ const CCheckpointData &data = Checkpoints();
+
+ if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
+ double nCheapBefore = pindex->nChainTx;
+ double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
+ double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint)/86400.0*data.fTransactionsPerDay;
+ fWorkBefore = nCheapBefore;
+ fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
+ } else {
+ double nCheapBefore = data.nTransactionsLastCheckpoint;
+ double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
+ double nExpensiveAfter = (nNow - pindex->nTime)/86400.0*data.fTransactionsPerDay;
+ fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
+ fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
+ }
+
+ return fWorkBefore / (fWorkBefore + fWorkAfter);
}
int GetTotalBlocksEstimate()
{
- if (fTestNet) return 0;
-
- return mapCheckpoints.rbegin()->first;
- // return 0;
+ if (fTestNet) return 0; // Testnet has no checkpoints
+ if (!GetBoolArg("-checkpoints", true))
+ return 0;
+
+ const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
+
+ return checkpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
- if (fTestNet) return NULL;
+ if (fTestNet) return NULL; // Testnet has no checkpoints
+ if (!GetBoolArg("-checkpoints", true))
+ return NULL;
- BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
+ const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
+
+ BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
{
const uint256& hash = i.second;
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
if (t != mapBlockIndex.end())
return t->second;
- // return NULL;
}
return NULL;
}
}
-
// Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
+
+ double GuessVerificationProgress(CBlockIndex *pindex);
}
-#endif
+#endif
\ No newline at end of file
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 6
-#define CLIENT_VERSION_BUILD 1
+#define CLIENT_VERSION_BUILD 2
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
-#define COPYRIGHT_YEAR 2013
+#define COPYRIGHT_YEAR 2014
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#include <signal.h>
#endif
-#if defined(USE_SSE2)
-#if !defined(MAC_OSX) && (defined(_M_IX86) || defined(__i386__) || defined(__i386))
-#ifdef _MSC_VER
-// MSVC 64bit is unable to use inline asm
-#include <intrin.h>
-#else
-// GCC Linux or i686-w64-mingw32
-#include <cpuid.h>
-#endif
-#endif
-#endif
-
using namespace std;
using namespace boost;
sigaction(SIGHUP, &sa_hup, NULL);
#endif
-#if defined(USE_SSE2)
- unsigned int cpuid_edx=0;
-#if !defined(MAC_OSX) && (defined(_M_IX86) || defined(__i386__) || defined(__i386))
- // 32bit x86 Linux or Windows, detect cpuid features
-#if defined(_MSC_VER)
- // MSVC
- int x86cpuid[4];
- __cpuid(x86cpuid, 1);
- cpuid_edx = (unsigned int)buffer[3];
-#else
- // Linux or i686-w64-mingw32 (gcc-4.6.3)
- unsigned int eax, ebx, ecx;
- __get_cpuid(1, &eax, &ebx, &ecx, &cpuid_edx);
-#endif
-#endif
-#endif
-
// ********************************************************* Step 2: parameter interactions
fTestNet = GetBoolArg("-testnet");
int64 nStart;
+#if defined(USE_SSE2)
+ scrypt_detect_sse2();
+#endif
+
// ********************************************************* Step 5: verify wallet database integrity
if (!fDisableWallet) {
// ********************************************************* Step 7: load block chain
-#if defined(USE_SSE2)
- scrypt_detect_sse2(cpuid_edx);
-#endif
-
fReindex = GetBoolArg("-reindex");
// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2011-2012 Litecoin Developers
+// Copyright (c) 2013-2014 Dr Kimoto Chan
+// Copyright (c) 2013-2014 Monacoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
int64 nTransactionFee = 0;
int64 nMinimumInputValue = DUST_HARD_LIMIT;
+int64 nSwitchKGWblock = 1000000;
//////////////////////////////////////////////////////////////////////////////
//
return bnResult.GetCompact();
}
-unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
{
unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
return bnNew.GetCompact();
}
+unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64 TargetBlocksSpacingSeconds, uint64 PastBlocksMin, uint64 PastBlocksMax) {
+ /* current difficulty formula, megacoin - kimoto gravity well */
+ const CBlockIndex *BlockLastSolved = pindexLast;
+ const CBlockIndex *BlockReading = pindexLast;
+ const CBlockHeader *BlockCreating = pblock;
+ BlockCreating = BlockCreating;
+ uint64 PastBlocksMass = 0;
+ int64 PastRateActualSeconds = 0;
+ int64 PastRateTargetSeconds = 0;
+ double PastRateAdjustmentRatio = double(1);
+ CBigNum PastDifficultyAverage;
+ CBigNum PastDifficultyAveragePrev;
+ double EventHorizonDeviation;
+ double EventHorizonDeviationFast;
+ double EventHorizonDeviationSlow;
+
+ if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }
+
+ for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
+ if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
+ PastBlocksMass++;
+
+ if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); }
+ else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; }
+ PastDifficultyAveragePrev = PastDifficultyAverage;
+
+ PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
+ PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
+ PastRateAdjustmentRatio = double(1);
+ if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; }
+ if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
+ PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
+ }
+ EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(144)), -1.228));
+ EventHorizonDeviationFast = EventHorizonDeviation;
+ EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
+
+ if (PastBlocksMass >= PastBlocksMin) {
+ if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
+ }
+ if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
+ BlockReading = BlockReading->pprev;
+ }
+
+ CBigNum bnNew(PastDifficultyAverage);
+ if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
+ bnNew *= PastRateActualSeconds;
+ bnNew /= PastRateTargetSeconds;
+ }
+ if (bnNew > bnProofOfWorkLimit) { bnNew = bnProofOfWorkLimit; }
+
+ /// debug print
+ printf("Difficulty Retarget - Kimoto Gravity Well\n");
+ printf("PastRateAdjustmentRatio = %g\n", PastRateAdjustmentRatio);
+ printf("Before: %08x %s\n", BlockLastSolved->nBits, CBigNum().SetCompact(BlockLastSolved->nBits).getuint256().ToString().c_str());
+ printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+
+ return bnNew.GetCompact();
+}
+
+unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+ static const int64 BlocksTargetSpacing = nTargetSpacing;
+ unsigned int TimeDaySeconds = 60 * 60 * 24;
+ int64 PastSecondsMin = TimeDaySeconds * 0.25;
+ int64 PastSecondsMax = TimeDaySeconds * 7;
+ uint64 PastBlocksMin = PastSecondsMin / BlocksTargetSpacing;
+ uint64 PastBlocksMax = PastSecondsMax / BlocksTargetSpacing;
+
+ return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
+}
+
+unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+ int DiffMode = 1;
+ if (fTestNet) {
+ if (pindexLast->nHeight+1 >= 0) { DiffMode = 2; }
+ }
+ else {
+ if (pindexLast->nHeight+1 >= nSwitchKGWblock) { DiffMode = 2; }
+ }
+
+ if (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
+ else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
+ return GetNextWorkRequired_V2(pindexLast, pblock);
+}
+
+
bool CheckProofOfWork(uint256 hash, unsigned int nBits)
{
CBigNum bnTarget;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
loop
{
-#if defined(USE_SSE2)
- // Detection would work, but in cases where we KNOW it always has SSE2,
- // it is faster to use directly than to use a function pointer or conditional.
-#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
- // Always SSE2: x86_64 or Intel MacOS X
scrypt_1024_1_1_256_sp_sse2(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad);
-#else
- // Detect SSE2: 32bit x86 Linux or Windows
- scrypt_1024_1_1_256_sp(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad);
-#endif
-#else
- // Generic scrypt
- scrypt_1024_1_1_256_sp_generic(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad);
-#endif
if (thash <= hashTarget)
{
INCLUDEPATHS= \
-I"$(CURDIR)" \
-I"$(DEPSDIR)/include" \
- -I"c:/deps/boost_1_54_0" \
+ -I"c:/deps/boost_1_55_0" \
-I"c:/deps/db-4.8.30.NC/build_unix" \
-I"c:/deps/openssl-1.0.1e/include"
LIBPATHS= \
-L"$(CURDIR)/leveldb" \
-L"$(DEPSDIR)/lib" \
- -L"c:/deps/boost_1_54_0/stage/lib" \
+ -L"c:/deps/boost_1_55_0/stage/lib" \
-L"c:/deps/db-4.8.30.NC/build_unix" \
-L"c:/deps/openssl-1.0.1e"
DEBUGFLAGS = -g
endif
+# osx 10.9 has changed the stdlib default to libc++. To prevent some link error, you may need to use libstdc++
+CFLAGS += -stdlib=libstdc++
+
# ppc doesn't work because we don't support big-endian
CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
unsigned int pnSeed[] =
{
- 0x6ab5368e, 0x63109859, 0x6c47bb25, 0x87d888c1, 0x1d9b2e48, 0x63a6c545, 0xf3ca1a48, 0x23b6b242,
- 0x8a67c7c6, 0x70a6f1c0, 0xc585c96d, 0x5cc4fd36, 0x239be836, 0x6660dc36, 0x2664cb36, 0xa602cd36,
- 0xb83dfc36, 0x70a2fe18, 0x2c589d55, 0xf969ec2e, 0x702ab643, 0x6a97e655, 0xad9751ce, 0x57e5025a,
- 0x9d065643, 0xe7b5ff60, 0x959d0d5a, 0x9667a318, 0xeba0c118, 0xb380d418, 0x170ccdde, 0x3548d9a2,
- 0x3261ff53, 0x42df0676, 0x9d7445ae, 0x1db3e953, 0xafc0b1b7, 0x1648934b, 0x535ee644, 0x4b89b64f,
- 0x56ed3060, 0x0810a15f, 0x03590ccf, 0x80752452, 0x0cc87162, 0xfec159d5, 0xcf0df618, 0x48865456,
- 0xdec8e55a, 0x91e6ee5b, 0xc4739518, 0x24d45453, 0xd5e5be44, 0xdafcff57, 0x0e73ca18, 0x83c4d148,
- 0x5a51ee53, 0x367e1c56, 0x2d651f54, 0x5eb4be43, 0x621589b2, 0x81dddedd, 0xd7499f56, 0xa48a694c,
- 0xd408c762, 0x88d36144, 0x6891772e, 0x38e89c73, 0x8ce3a856, 0x52fa1fb0, 0xd9d5796d, 0x27318945,
- 0x2e680452, 0x619bc445, 0xd0dc092e, 0x7192c962, 0xc2c9e405, 0xb9e3e747, 0xe459c9c1, 0x9d043b25,
- 0xe2b235c6, 0xed2dcf18, 0xb3d03cae, 0x3d2dafb8, 0xd46a0e45, 0x4a32f1d8, 0x350be560, 0xab0a648a,
- 0x87b6bc43, 0x6745629b, 0x72b9c362, 0x03a91c05, 0x7320bd3b, 0x32920b18, 0xbc2ca162, 0x216c4f7d,
- 0x64151a4e, 0x4b63e20c, 0xe703c3be, 0xc2d5fab2, 0x2b28b762, 0xde47b0ba, 0xf2e19dd9, 0x99044fad,
- 0x8252a5c0, 0x6e8be597, 0x4f0bb56c, 0xfaa52252, 0x8f764b52, 0xe5b21cad, 0x020cab4d, 0xc8e8f763,
- 0x2eaacc6d, 0x2ce4dd4e, 0xfe27345c, 0xb21f09b0, 0x8b4199d9, 0x6b53c248, 0x42a8966d, 0xd5387145,
- 0xc091c257, 0x2fe06751, 0xecf66552, 0x37dd0418, 0x8073c57c, 0x5471d54e, 0x56953360, 0x0d1ffcdf,
- 0xb4554318, 0x16cb54c6, 0xa064d05e, 0x2b0fa93a, 0xec26d162, 0x9ca91b42, 0xdcfa4457, 0x1b5c0a7a,
- 0x4561a17c, 0xcc52a662, 0xf9d47ad9, 0xfa418cb2, 0x88085618, 0x007aa55f, 0xfa2e4d4d, 0x8516a843,
- 0x634ac658, 0x2c36f62e, 0x3f0cbe5e, 0xd0e87257, 0x37d5e6bc, 0x5941c1c7, 0x5ee001ae, 0xc2791e6c,
- 0x0c6220b2, 0xab1ba258, 0x4719c076, 0xabb6a942, 0x6e588b52, 0x101a4352, 0x9604b362, 0x16607fc7,
- 0x4a687d45, 0xc217feb2, 0xaebb6b18, 0x4439412e, 0x41330360, 0xca23946d, 0x1c699d76, 0xcd302344,
- 0x4683afad, 0xad3c644f, 0x95ab4f05, 0xb34ec562, 0x57e3ff50, 0xcb950847, 0x743ced60, 0xb6734347,
- 0x6237a2b2, 0x1517e244, 0xfd0b128b, 0xb7eb605f, 0x6a9717ad, 0x7e8d65ae, 0xdddc4cad, 0xc63530a6,
- 0xfcd78559, 0xc779e25e, 0xf683de58, 0x7cd1ff50, 0x6e0931ad, 0x7c1b46ad, 0x9f4b4252, 0xf421482e,
- 0xeca7e697, 0xfe466544, 0x46fa2240, 0xd33328bc, 0x7be6d7bd, 0xc205c27b, 0xa04c07d8, 0x5bcdb350,
- 0x847bc74a, 0x14967f45, 0x59b341ad, 0x9ce4d783, 0xc38300c0, 0x4f1b4aad, 0x018daa32, 0x95d7f854,
- 0x4bd58543, 0xfe8446ad, 0xc3288f18, 0xcda2e253, 0x662e4852, 0x9338e24e, 0xc2fd1218, 0xa7198252,
- 0x481858b8, 0x55b74374, 0xbd458d5e, 0xb2cc6d54, 0x2ca11b4e, 0x62d1be58, 0xf0637fbc, 0xd9943950,
- 0x0f6f4a47, 0x188a6144, 0x768ea0d8, 0xd2c31c54, 0x29462ed5, 0x2b546ad5, 0x8ba12d6c, 0x1a3f7255,
- 0xa836e23c, 0xdcde0552, 0xda5b3945, 0x7e3720b2, 0x8c098018, 0x42cddd50, 0x0c52a65f, 0x8cce175e,
- 0x96554242, 0x7309c779, 0xcb2537ca, 0xecfb70d9, 0x19c0b259, 0x7b559ed8, 0x2f03ae44, 0x1b2b0f05,
- 0x9e72165e, 0x4ac7413e, 0xa22cbb6a, 0x9fc7624d, 0xbb101a54, 0xfdb0c23e, 0x84a65a47, 0x1efded62,
- 0x1f47f554, 0xe5c16ad2, 0x76b62332, 0xe4613d46, 0xd74f6ec1, 0x3d0e2b32, 0x6725fe5e, 0xb62a8729,
- 0x922e9925, 0x7efc2544, 0x12af60d4, 0x5e042f44, 0x5fcaff54, 0x144a3493, 0x5788ec47, 0x729175b2,
- 0x493b316c, 0x949d4542, 0x4ffc8856, 0x18a95b61, 0xdaabc547, 0xc879d855, 0x7d8488c1, 0x3cb7b052,
- 0xbe8ade6f, 0x6ef6a555, 0x737e5247, 0x7368e252, 0x5fbe1056, 0xb848e217, 0x44a44105, 0xb7610150,
- 0x3c2eed62, 0x2b0c9e6d, 0x2a1698b4, 0x4e6fa443, 0xb6c3fe4d, 0xd86c8a43, 0x48b27125, 0x9d9c60cb,
- 0x349a6d4c, 0xae336259, 0x81d7976d, 0x8e9fe2c0, 0x5f20c2dd, 0x6f289e52, 0xe954cf51, 0xc96eb248,
- 0x1c29f562, 0xb01e3842, 0x119511b9, 0x4811856d, 0x172ff854, 0x7dab5451, 0x52520752, 0xc414ed52,
- 0x368f4105, 0x7767b047, 0x1c459f32, 0x05b5e697, 0xb5273160, 0x99eaec69, 0x0cd7a951, 0x36e1f13e,
- 0xee815148, 0x5773e8bc, 0xf61f35ad, 0xa0b903ae, 0x2d811660, 0x98aec3be, 0x851afa59, 0xce25a518,
- 0xfcaaf2a2, 0x90bde760, 0x04cb16ad, 0x70a30432, 0xa6cd3e47, 0x0ccac672, 0xb238a018, 0xf7db8156,
- 0xed1e0331, 0xe2590ccf, 0x0cde9e56, 0x5cc39744, 0x4e3c957c, 0xc57e67d3, 0x6b547662, 0x073cd243,
- 0x670d9a18, 0x4666ae58, 0x661abd59, 0x64c94732, 0x8371cc82, 0x2f460843, 0x03bcfa45, 0xa23cac70,
- 0x1fa47b46, 0xec86b4ad, 0x183e3105, 0x6dea2446, 0x0331bcd1, 0x2673cf18, 0x5ccbdaac, 0xa0483850,
- 0x9b28c34a, 0xc69b9b62, 0xac944946, 0x3723b456, 0x4a53485d, 0x365fa8bc, 0x3adfbd5e, 0xdefbb143,
- 0x6ca64746, 0xadea802e, 0x89c0bbad, 0xefcc854f, 0x38cca5bc, 0xacc61e5e, 0x5bc43ab8, 0x3003795b,
- 0x391c2352, 0xe410f6ad, 0x3fa6f957, 0xd6b095d4, 0xeb00ba43, 0xf92f174c, 0xb45c0644, 0x6b299c53,
- 0xff0cf172, 0xaafe4a4c, 0xeb4aea5c, 0xb61dae43, 0x22115347, 0xfd510e6c, 0xe037fc50, 0xa5498e3d,
- 0xd36b8118, 0x0b6a0250, 0xd3260c5e, 0xe540424b, 0xbb630732, 0xa5cca46d, 0xdbb27a47, 0x5874ba6a,
- 0x581d4342, 0xa68b7125, 0x0b3b9f58, 0x2b8a8d18, 0x3155e763, 0x455e6951, 0xe79c0260, 0x683a474b,
- 0xfcabe697, 0xf3d1e13c, 0x8c0eb57c, 0x34a9e155, 0xc51d1e4c, 0x26fc8748, 0x3817ba6a, 0xbc36225f,
- 0x8dc42e5a, 0x51676c4e, 0x0f77a843, 0xf45ebebc, 0x2dc05874, 0x9be1ac5f, 0x1471595c, 0xa6d260d8,
- 0x3e2a008e, 0x0a2ff462, 0xfbe632c6, 0xf701af5d, 0x6cca155c, 0xf2e2af51, 0xb5c47a47, 0x322968d5,
- 0xfe651b4e, 0x11bccecd, 0xc2140418, 0xa741a465, 0xc8f45f48, 0x0400b0b4, 0x0e36c14e, 0x1f028cb2,
- 0x221db552, 0x4876ced5, 0x8e7c4abc, 0xd4b4734c, 0xce4b79d9, 0xf2879056, 0xa761794d, 0xc89c96b2,
- 0xd042af44, 0xd5f63418, 0x744731ad, 0xa94e7cae, 0x52b85b4d, 0x01978932, 0xa6abd1d3, 0xd4fae247,
- 0x71cd9344, 0xde60bb6a, 0xec358489, 0x6e054cdc, 0xc92728bc, 0x231ea8bc, 0x74a5a2bc, 0x6d6f135d,
- 0x26dd6596, 0x9d5386d1, 0x268bf232, 0x3867324a, 0x315e5353, 0x1ed2a443, 0xd79a9d51, 0x39dfe550,
- 0x3f1ef181, 0x2f65fe79, 0xf6caf04d, 0x3fd33644, 0xd9abf043, 0x1a84c94e, 0x61618445, 0x7bd81318,
- 0xb4f8764c, 0x8c6ae963, 0x7d659c5c, 0x9f294257, 0x5711be58, 0x3ac6b247, 0xe4f07d60, 0xe6bf7162,
- 0x96742752, 0x23329cca, 0xc219cd5c, 0xa6f23418, 0xf4908053, 0x63130652, 0xf68fc948, 0x028fb54b,
- 0x83ec1a18, 0xe88b4e8b, 0xf057ffcf, 0x4b3efe60, 0x359fff60, 0xba675642, 0xd5fe664c, 0xc8a2b862,
- 0x4f8f576d, 0xb7827462, 0x1cc0c954, 0x6655aa7c, 0x9bc71451, 0x1039b456, 0x91d5e37c, 0x1ccb6c53,
- 0x2e36313e, 0x6afd5251, 0xee91107c, 0xe9c0844b, 0xf133e347, 0xc1cd1b41, 0x3a0ab052, 0x30dee25a,
- 0xa75bd152, 0x319da1b8, 0xd8f97561, 0x2fa794d5, 0x92a70d6c, 0xd6b470d5, 0xb524c90e, 0x109a64ae,
- 0x7038af89, 0x3205e418, 0x313a015e, 0xd2d3175e, 0xc07593b8, 0x179ee97a, 0x78fdec47, 0x775d6d3a,
- 0xccc93a40, 0xdbbbd9ad, 0x803c6f12, 0xfd4bc14a, 0x8ed15250, 0x19c65958, 0xc8300c5e, 0x87757db2,
- 0x82fe0444, 0x3ce0035e, 0x19f0e762, 0x160c4c57, 0x069b0418, 0x9c6e4356, 0xa10df12e, 0x1936654d,
- 0xd30b2848, 0x464aa5b2, 0xbb0b1b55, 0x03f3d318, 0x0431e06c, 0x0d94f15b, 0xabc2ed47, 0xf23a00c2,
- 0x3bee4954, 0xd1e72a52, 0xd464d054, 0xcf141118, 0xf57f4bc8, 0xd8b1ac6c, 0x136ea959, 0x63275d4a,
- 0x391e8c18, 0xd4dd4832, 0x96610b6d, 0x9cfb5153, 0x4a80ee48, 0x345e7cbc, 0xde810b59, 0x134a4c90,
- 0x4544ed5e, 0xdc801956, 0x9d6b3ac6, 0x0a037786, 0xdcaafd62, 0xd65ee05a, 0x158b754c, 0x53427dd5,
- 0xa32774bc, 0xa22af3a2, 0x0c1f7157, 0xa0b58429, 0x349f3156, 0x9cd6a34d, 0x67eb1c56, 0x20b5e597,
- 0xd40f7162, 0xa4cb0379, 0x0e1efc53, 0xe5c8e554, 0x3ebf8052, 0x6ee00847, 0x99206883, 0xc851767d
+ 0x7E17F285, 0xF713F285, 0x5D33F285, 0xE132F285
};
void DumpAddresses()
// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
-const int ABOUTDIALOG_COPYRIGHT_YEAR = 2013;
+const int ABOUTDIALOG_COPYRIGHT_YEAR = 2014;
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui->setupUi(this);
// Set current copyright year
- ui->copyrightLabel->setText(tr("Copyright") + QString(" © 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin developers") + QString("<br>") + tr("Copyright") + QString(" © ") + tr("2011-%1 The Litecoin developers").arg(ABOUTDIALOG_COPYRIGHT_YEAR) + QString("<br>") + tr("Copyright") + QString(" © ") + tr("2013-%1 The Monacoin developers").arg(ABOUTDIALOG_COPYRIGHT_YEAR));
+ ui->copyrightLabel->setText(tr("Copyright") + QString(" © 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin developers") + QString("<br>") + tr("Copyright") + QString(" © ") + tr("2011-%1 The Litecoin developers").arg(ABOUTDIALOG_COPYRIGHT_YEAR) + QString("<br>") + tr("Copyright") + QString(" © ") + tr("2013-%1 Dr Kimoto Chan").arg(ABOUTDIALOG_COPYRIGHT_YEAR) + QString("<br>") + tr("Copyright") + QString(" © ") + tr("2013-%1 The Monacoin developers").arg(ABOUTDIALOG_COPYRIGHT_YEAR));
}
void AboutDialog::setModel(ClientModel *model)
double ClientModel::getVerificationProgress() const
{
- return 0.0;
-// return Checkpoints::GuessVerificationProgress(pindexBest);
+ return Checkpoints::GuessVerificationProgress(pindexBest);
}
void ClientModel::updateTimer()
connect(ui->treeWidget, SIGNAL(itemChanged( QTreeWidgetItem*, int)), this, SLOT(viewItemChanged( QTreeWidgetItem*, int)));
// click on header
-// ui->treeWidget->header()->setSectionsClickable(true);
- ui->treeWidget->header()->setClickable(true);
+ #if QT_VERSION < 0x050000
+ ui->treeWidget->header()->setClickable(true);
+ #else
+ ui->treeWidget->header()->setSectionsClickable(true);
+ #endif
connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int)));
// ok button
<property name="text">
<string notr="true">Copyright &copy; 2009-YYYY The Bitcoin developers
Copyright &copy; 2011-YYYY The Litecoin developers
+Copyright &copy; 2013-YYYY TDr Kimoto Chan
Copyright &copy; 2013-YYYY The Monacoin developers</string>
</property>
<property name="textFormat">
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR
-#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin developers 2011-" STRINGIZE(COPYRIGHT_YEAR) " The Litecoin developers 2013-" STRINGIZE(COPYRIGHT_YEAR) " The Monacoin developers "
+#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin developers 2011-" STRINGIZE(COPYRIGHT_YEAR) " The Litecoin developers 2013-" STRINGIZE(COPYRIGHT_YEAR) " The Dr Kimoto Chan 2013-" STRINGIZE(COPYRIGHT_YEAR) " The Monacoin developers "
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
#endif
#if QT_VERSION >= 0x040700
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
- ui->lineEditCoinControlChange->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
+ ui->lineEditCoinControlChange->setPlaceholderText(tr("Enter a Monacoin address (e.g. MVB6QmKELCUwFEEBQ291wrcNKBXqUJ5FRw)"));
#endif
addEntry();
#include <string.h>
#include <openssl/sha.h>
+#if defined(USE_SSE2) && !defined(USE_SSE2_ALWAYS)
+#ifdef _MSC_VER
+// MSVC 64bit is unable to use inline asm
+#include <intrin.h>
+#else
+// GCC Linux or i686-w64-mingw32
+#include <cpuid.h>
+#endif
+#endif
+
static inline uint32_t be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
/* Operate on columns. */
x04 ^= ROTL(x00 + x12, 7); x09 ^= ROTL(x05 + x01, 7);
x14 ^= ROTL(x10 + x06, 7); x03 ^= ROTL(x15 + x11, 7);
-
+
x08 ^= ROTL(x04 + x00, 9); x13 ^= ROTL(x09 + x05, 9);
x02 ^= ROTL(x14 + x10, 9); x07 ^= ROTL(x03 + x15, 9);
-
+
x12 ^= ROTL(x08 + x04, 13); x01 ^= ROTL(x13 + x09, 13);
x06 ^= ROTL(x02 + x14, 13); x11 ^= ROTL(x07 + x03, 13);
-
+
x00 ^= ROTL(x12 + x08, 18); x05 ^= ROTL(x01 + x13, 18);
x10 ^= ROTL(x06 + x02, 18); x15 ^= ROTL(x11 + x07, 18);
-
+
/* Operate on rows. */
x01 ^= ROTL(x00 + x03, 7); x06 ^= ROTL(x05 + x04, 7);
x11 ^= ROTL(x10 + x09, 7); x12 ^= ROTL(x15 + x14, 7);
-
+
x02 ^= ROTL(x01 + x00, 9); x07 ^= ROTL(x06 + x05, 9);
x08 ^= ROTL(x11 + x10, 9); x13 ^= ROTL(x12 + x15, 9);
-
+
x03 ^= ROTL(x02 + x01, 13); x04 ^= ROTL(x07 + x06, 13);
x09 ^= ROTL(x08 + x11, 13); x14 ^= ROTL(x13 + x12, 13);
-
+
x00 ^= ROTL(x03 + x02, 18); x05 ^= ROTL(x04 + x07, 18);
x10 ^= ROTL(x09 + x08, 18); x15 ^= ROTL(x14 + x13, 18);
}
uint32_t i, j, k;
V = (uint32_t *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63));
-
+
PBKDF2_SHA256((const uint8_t *)input, 80, (const uint8_t *)input, 80, 1, B, 128);
for (k = 0; k < 32; k++)
}
#if defined(USE_SSE2)
-#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
-/* Always SSE2 */
-void scrypt_detect_sse2(unsigned int cpuid_edx)
+// By default, set to generic scrypt function. This will prevent crash in case when scrypt_detect_sse2() wasn't called
+void (*scrypt_1024_1_1_256_sp_detected)(const char *input, char *output, char *scratchpad) = &scrypt_1024_1_1_256_sp_generic;
+
+void scrypt_detect_sse2()
{
+#if defined(USE_SSE2_ALWAYS)
printf("scrypt: using scrypt-sse2 as built.\n");
-}
-#else
-/* Detect SSE2 */
-void (*scrypt_1024_1_1_256_sp)(const char *input, char *output, char *scratchpad);
+#else // USE_SSE2_ALWAYS
+ // 32bit x86 Linux or Windows, detect cpuid features
+ unsigned int cpuid_edx=0;
+#if defined(_MSC_VER)
+ // MSVC
+ int x86cpuid[4];
+ __cpuid(x86cpuid, 1);
+ cpuid_edx = (unsigned int)buffer[3];
+#else // _MSC_VER
+ // Linux or i686-w64-mingw32 (gcc-4.6.3)
+ unsigned int eax, ebx, ecx;
+ __get_cpuid(1, &eax, &ebx, &ecx, &cpuid_edx);
+#endif // _MSC_VER
-void scrypt_detect_sse2(unsigned int cpuid_edx)
-{
if (cpuid_edx & 1<<26)
{
- scrypt_1024_1_1_256_sp = &scrypt_1024_1_1_256_sp_sse2;
+ scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_sse2;
printf("scrypt: using scrypt-sse2 as detected.\n");
}
else
{
- scrypt_1024_1_1_256_sp = &scrypt_1024_1_1_256_sp_generic;
+ scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_generic;
printf("scrypt: using scrypt-generic, SSE2 unavailable.\n");
}
+#endif // USE_SSE2_ALWAYS
}
#endif
-#endif
void scrypt_1024_1_1_256(const char *input, char *output)
{
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
-#if defined(USE_SSE2)
- // Detection would work, but in cases where we KNOW it always has SSE2,
- // it is faster to use directly than to use a function pointer or conditional.
-#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
- // Always SSE2: x86_64 or Intel MacOS X
- scrypt_1024_1_1_256_sp_sse2(input, output, scratchpad);
-#else
- // Detect SSE2: 32bit x86 Linux or Windows
- scrypt_1024_1_1_256_sp(input, output, scratchpad);
-#endif
-#else
- // Generic scrypt
- scrypt_1024_1_1_256_sp_generic(input, output, scratchpad);
-#endif
-}
+ scrypt_1024_1_1_256_sp(input, output, scratchpad);
+}
\ No newline at end of file
#define SCRYPT_H
#include <stdlib.h>
#include <stdint.h>
+
static const int SCRYPT_SCRATCHPAD_SIZE = 131072 + 63;
void scrypt_1024_1_1_256(const char *input, char *output);
void scrypt_1024_1_1_256_sp_generic(const char *input, char *output, char *scratchpad);
#if defined(USE_SSE2)
-extern void scrypt_detect_sse2(unsigned int cpuid_edx);
+#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
+#define USE_SSE2_ALWAYS 1
+#define scrypt_1024_1_1_256_sp(input, output, scratchpad) scrypt_1024_1_1_256_sp_sse2((input), (output), (scratchpad))
+#else
+#define scrypt_1024_1_1_256_sp(input, output, scratchpad) scrypt_1024_1_1_256_sp_detected((input), (output), (scratchpad))
+#endif
+
+void scrypt_detect_sse2();
void scrypt_1024_1_1_256_sp_sse2(const char *input, char *output, char *scratchpad);
-extern void (*scrypt_1024_1_1_256_sp)(const char *input, char *output, char *scratchpad);
+extern void (*scrypt_1024_1_1_256_sp_detected)(const char *input, char *output, char *scratchpad);
+#else
+#define scrypt_1024_1_1_256_sp(input, output, scratchpad) scrypt_1024_1_1_256_sp_generic((input), (output), (scratchpad))
#endif
void
p[2] = (x >> 16) & 0xff;
p[3] = (x >> 24) & 0xff;
}
-#endif
+#endif
\ No newline at end of file
#define HASHCOUNT 5
const char* inputhex[HASHCOUNT] = { "020000004c1271c211717198227392b029a64a7971931d351b387bb80db027f270411e398a07046f7d4a08dd815412a8712f874a7ebf0507e3878bd24e20a3b73fd750a667d2f451eac7471b00de6659", "0200000011503ee6a855e900c00cfdd98f5f55fffeaee9b6bf55bea9b852d9de2ce35828e204eef76acfd36949ae56d1fbe81c1ac9c0209e6331ad56414f9072506a77f8c6faf551eac7471b00389d01", "02000000a72c8a177f523946f42f22c3e86b8023221b4105e8007e59e81f6beb013e29aaf635295cb9ac966213fb56e046dc71df5b3f7f67ceaeab24038e743f883aff1aaafaf551eac7471b0166249b", "010000007824bc3a8a1b4628485eee3024abd8626721f7f870f8ad4d2f33a27155167f6a4009d1285049603888fe85a84b6c803a53305a8d497965a5e896e1a00568359589faf551eac7471b0065434e", "0200000050bfd4e4a307a8cb6ef4aef69abc5c0f2d579648bd80d7733e1ccc3fbc90ed664a7f74006cb11bde87785f229ecd366c2d4e44432832580e0608c579e4cb76f383f7f551eac7471b00c36982" };
const char* expected[HASHCOUNT] = { "00000000002bef4107f882f6115e0b01f348d21195dacd3582aa2dabd7985806" , "00000000003a0d11bdd5eb634e08b7feddcfbbf228ed35d250daf19f1c88fc94", "00000000000b40f895f288e13244728a6c2d9d59d8aff29c65f8dd5114a8ca81", "00000000003007005891cd4923031e99d8e8d72f6e8e7edc6a86181897e105fe", "000000000018f0b426a4afc7130ccb47fa02af730d345b4fe7c7724d3800ec8c" };
+#if defined(USE_SSE2)
+ scrypt_detect_sse2();
+#endif
uint256 scrypthash;
std::vector<unsigned char> inputbytes;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
#if defined(USE_SSE2)
// Test SSE2 scrypt
scrypt_1024_1_1_256_sp_sse2((const char*)&inputbytes[0], BEGIN(scrypthash), scratchpad);
+ BOOST_CHECK_EQUAL(scrypthash.ToString().c_str(), expected[i]);
#endif
// Test generic scrypt
scrypt_1024_1_1_256_sp_generic((const char*)&inputbytes[0], BEGIN(scrypthash), scratchpad);
// git will put "#define GIT_ARCHIVE 1" on the next line inside archives.
#define GIT_ARCHIVE 1
#ifdef GIT_ARCHIVE
-# define GIT_COMMIT_ID "88e2a2e"
+# define GIT_COMMIT_ID ""
# define GIT_COMMIT_DATE "Thu, 5 Dec 2013 22:52:50 -1000"
#endif