15
README.md
15
README.md
@@ -39,10 +39,25 @@ sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev li
|
|||||||
|
|
||||||
Komodo
|
Komodo
|
||||||
------
|
------
|
||||||
|
We have a release process that goes through several stages before it reaches master. This allows the most conservative users just use the master branch, which is only updated after the other branches have signed off on a release.
|
||||||
|
|
||||||
|
99% of the activity is in the dev branch, this is where I am testing each change one by one and there are literally thousands of updates. Only use this branch if you really want to be on the bleeding edge. I try to keep things stable, but there are times where necessarily there are bugs in the dev branch, since I am actively developing and debugging here. A good rule is to wait for at least 4 hours from the last update before using the dev branch (unless you know what you are doing)
|
||||||
|
|
||||||
|
After things look good in the dev branch, it is propagated to the beta branch, this is the version the notary nodes use. They are knowledegable command line server guys and so they have a keen eye for anything that wasnt caught during the dev cycle.
|
||||||
|
|
||||||
|
After the notary nodes verify things are working and the latest release is deemed stable, it is propagated to the dPoW branch. From here an automated Jenkins process builds it for all OS, and since the notary nodes are all unix, it is possible for some issues to be caught at this stage. The dPoW branch is what goes into the GUI installers.
|
||||||
|
|
||||||
|
After the GUI are updated and released and it is verified that no significant support issues were created, the master branch is finally updated.
|
||||||
|
|
||||||
|
Master branch: exchanges and users that build from the repo without changing branches
|
||||||
|
dPoW branch: autobuild into GUI installers, unix, osx, windows
|
||||||
|
beta branch: notary nodes, command line unix
|
||||||
|
dev branch: bleeding edge, possibly wont even compile, multiple updates per hour
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/jl777/komodo
|
git clone https://github.com/jl777/komodo
|
||||||
cd komodo
|
cd komodo
|
||||||
|
#you might want to: git checkout <branch>; git pull
|
||||||
./zcutil/fetch-params.sh
|
./zcutil/fetch-params.sh
|
||||||
# -j8 uses 8 threads - replace 8 with number of threads you want to use
|
# -j8 uses 8 threads - replace 8 with number of threads you want to use
|
||||||
./zcutil/build.sh -j8
|
./zcutil/build.sh -j8
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -x
|
set -x
|
||||||
delay=10
|
delay=60
|
||||||
source pubkey.txt
|
source pubkey.txt
|
||||||
echo $pubkey
|
echo $pubkey
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ bool AppInit(int argc, char* argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
fDaemon = GetBoolArg("-daemon", false);
|
fDaemon = GetBoolArg("-daemon", false);
|
||||||
if (fDaemon)
|
if (fDaemon)
|
||||||
{
|
{
|
||||||
|
|||||||
10
src/compat.h
10
src/compat.h
@@ -10,7 +10,7 @@
|
|||||||
#include "config/bitcoin-config.h"
|
#include "config/bitcoin-config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#ifdef _WIN32_WINNT
|
#ifdef _WIN32_WINNT
|
||||||
#undef _WIN32_WINNT
|
#undef _WIN32_WINNT
|
||||||
#endif
|
#endif
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#define MSG_DONTWAIT 0
|
#define MSG_DONTWAIT 0
|
||||||
#else
|
#else
|
||||||
typedef u_int SOCKET;
|
typedef u_int SOCKET;
|
||||||
@@ -64,7 +64,7 @@ typedef u_int SOCKET;
|
|||||||
#define SOCKET_ERROR -1
|
#define SOCKET_ERROR -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#ifndef S_IRUSR
|
#ifndef S_IRUSR
|
||||||
#define S_IRUSR 0400
|
#define S_IRUSR 0400
|
||||||
#define S_IWUSR 0200
|
#define S_IWUSR 0200
|
||||||
@@ -78,7 +78,7 @@ typedef u_int SOCKET;
|
|||||||
#define MSG_NOSIGNAL 0
|
#define MSG_NOSIGNAL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
// PRIO_MAX is not defined on Solaris
|
// PRIO_MAX is not defined on Solaris
|
||||||
#ifndef PRIO_MAX
|
#ifndef PRIO_MAX
|
||||||
#define PRIO_MAX 20
|
#define PRIO_MAX 20
|
||||||
@@ -94,7 +94,7 @@ size_t strnlen( const char *start, size_t max_len);
|
|||||||
#endif // HAVE_DECL_STRNLEN
|
#endif // HAVE_DECL_STRNLEN
|
||||||
|
|
||||||
bool static inline IsSelectableSocket(SOCKET s) {
|
bool static inline IsSelectableSocket(SOCKET s) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return (s < FD_SETSIZE);
|
return (s < FD_SETSIZE);
|
||||||
|
|||||||
14
src/init.cpp
14
src/init.cpp
@@ -40,7 +40,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ bool fFeeEstimatesInitialized = false;
|
|||||||
static CZMQNotificationInterface* pzmqNotificationInterface = NULL;
|
static CZMQNotificationInterface* pzmqNotificationInterface = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Win32 LevelDB doesn't use file descriptors, and the ones used for
|
// Win32 LevelDB doesn't use file descriptors, and the ones used for
|
||||||
// accessing block files don't count towards the fd_set size limit
|
// accessing block files don't count towards the fd_set size limit
|
||||||
// anyway.
|
// anyway.
|
||||||
@@ -236,7 +236,7 @@ void Shutdown()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
try {
|
try {
|
||||||
boost::filesystem::remove(GetPidFile());
|
boost::filesystem::remove(GetPidFile());
|
||||||
} catch (const boost::filesystem::filesystem_error& e) {
|
} catch (const boost::filesystem::filesystem_error& e) {
|
||||||
@@ -334,7 +334,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += HelpMessageOpt("-maxorphantx=<n>", strprintf(_("Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
strUsage += HelpMessageOpt("-maxorphantx=<n>", strprintf(_("Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||||
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
|
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
|
||||||
-(int)boost::thread::hardware_concurrency(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
|
-(int)boost::thread::hardware_concurrency(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
strUsage += HelpMessageOpt("-pid=<file>", strprintf(_("Specify pid file (default: %s)"), "komodod.pid"));
|
strUsage += HelpMessageOpt("-pid=<file>", strprintf(_("Specify pid file (default: %s)"), "komodod.pid"));
|
||||||
#endif
|
#endif
|
||||||
strUsage += HelpMessageOpt("-prune=<n>", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode disables wallet support and is incompatible with -txindex. "
|
strUsage += HelpMessageOpt("-prune=<n>", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode disables wallet support and is incompatible with -txindex. "
|
||||||
@@ -716,7 +716,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
// Disable confusing "helpful" text message on abort, Ctrl-C
|
// Disable confusing "helpful" text message on abort, Ctrl-C
|
||||||
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Enable Data Execution Prevention (DEP)
|
// Enable Data Execution Prevention (DEP)
|
||||||
// Minimum supported OS versions: WinXP SP3, WinVista >= SP1, Win Server 2008
|
// Minimum supported OS versions: WinXP SP3, WinVista >= SP1, Win Server 2008
|
||||||
// A failure is non-critical and needs no further attention!
|
// A failure is non-critical and needs no further attention!
|
||||||
@@ -733,7 +733,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (!SetupNetworking())
|
if (!SetupNetworking())
|
||||||
return InitError("Error: Initializing networking failed");
|
return InitError("Error: Initializing networking failed");
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
if (GetBoolArg("-sysperms", false)) {
|
if (GetBoolArg("-sysperms", false)) {
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (!GetBoolArg("-disablewallet", false))
|
if (!GetBoolArg("-disablewallet", false))
|
||||||
@@ -1047,7 +1047,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Komodo is probably already running.") + " %s.", strDataDir, e.what()));
|
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Komodo is probably already running.") + " %s.", strDataDir, e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
CreatePidFile(GetPidFile(), getpid());
|
CreatePidFile(GetPidFile(), getpid());
|
||||||
#endif
|
#endif
|
||||||
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
||||||
|
|||||||
@@ -547,7 +547,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
numvalid = bitweight(signedmask);
|
numvalid = bitweight(signedmask);
|
||||||
if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/5)) )
|
if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/5)) )
|
||||||
{
|
{
|
||||||
printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
if ( height > 500000 )
|
||||||
|
printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
}
|
}
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
|
|||||||
@@ -13,13 +13,18 @@
|
|||||||
* *
|
* *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define SATOSHIDEN ((uint64_t)100000000L)
|
||||||
|
#define dstr(x) ((double)(x) / SATOSHIDEN)
|
||||||
|
|
||||||
#define KOMODO_INTEREST ((uint64_t)(0.05 * COIN)) // 5%
|
#define KOMODO_INTEREST ((uint64_t)(0.05 * COIN)) // 5%
|
||||||
int64_t MAX_MONEY = 200000000 * 100000000LL;
|
int64_t MAX_MONEY = 200000000 * 100000000LL;
|
||||||
|
|
||||||
uint64_t komodo_earned_interest(int32_t height,int64_t paidinterest)
|
uint64_t komodo_earned_interest(int32_t height,int64_t paidinterest)
|
||||||
{
|
{
|
||||||
static uint64_t *interests; static int32_t maxheight;
|
static uint64_t *interests; static int32_t maxheight;
|
||||||
uint64_t total; int32_t ind,incr = 100000;
|
uint64_t total; int32_t ind,incr = 10000;
|
||||||
|
// need to make interests persistent before 2030, or just hardfork interest/mining rewards disable after MAX_MONEY is exceeded
|
||||||
|
return(0);
|
||||||
if ( height >= maxheight )
|
if ( height >= maxheight )
|
||||||
{
|
{
|
||||||
if ( interests == 0 )
|
if ( interests == 0 )
|
||||||
@@ -36,16 +41,20 @@ uint64_t komodo_earned_interest(int32_t height,int64_t paidinterest)
|
|||||||
}
|
}
|
||||||
ind = (height << 1);
|
ind = (height << 1);
|
||||||
if ( paidinterest < 0 ) // request
|
if ( paidinterest < 0 ) // request
|
||||||
|
{
|
||||||
return(interests[ind]);
|
return(interests[ind]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( interests[ind + 1] != paidinterest )
|
if ( interests[ind + 1] != paidinterest ) // need to handle skips like at 80000
|
||||||
{
|
{
|
||||||
|
//fprintf(stderr,"interests.%d %.8f %.8f vs paidinterest %.8f\n",height,dstr(interests[ind]),dstr(interests[ind+1]),dstr(paidinterest));
|
||||||
interests[ind + 1] = paidinterest;
|
interests[ind + 1] = paidinterest;
|
||||||
if ( height == 0 )
|
if ( height <= 1 )
|
||||||
interests[ind] = interests[ind + 1];
|
interests[ind] = 0;
|
||||||
else interests[ind] = interests[ind - 2] + interests[ind + 1];
|
else interests[ind] = interests[ind - 2] + interests[ind - 1];
|
||||||
total = interests[ind];
|
total = interests[ind] + paidinterest;
|
||||||
|
//fprintf(stderr,"reset interests[height.%d to maxheight.%d] <- %.8f\n",height,maxheight,dstr(total));
|
||||||
for (++height; height<maxheight; height++)
|
for (++height; height<maxheight; height++)
|
||||||
{
|
{
|
||||||
ind = (height << 1);
|
ind = (height << 1);
|
||||||
@@ -53,6 +62,7 @@ uint64_t komodo_earned_interest(int32_t height,int64_t paidinterest)
|
|||||||
interests[ind + 1] = 0;
|
interests[ind + 1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//else fprintf(stderr,"interests.%d %.8f %.8f\n",height,dstr(interests[ind]),dstr(interests[ind+1]));
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -64,9 +74,30 @@ uint64_t komodo_moneysupply(int32_t height)
|
|||||||
else return(COIN * 100000000 + (height-1) * 3 + komodo_earned_interest(height,-1));
|
else return(COIN * 100000000 + (height-1) * 3 + komodo_earned_interest(height,-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t _komodo_interestnew(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||||
|
{
|
||||||
|
int32_t minutes; uint64_t interest = 0;
|
||||||
|
if ( (minutes= (tiptime - nLockTime) / 60) >= 60 )
|
||||||
|
{
|
||||||
|
if ( minutes > 365 * 24 * 60 )
|
||||||
|
minutes = 365 * 24 * 60;
|
||||||
|
minutes -= 59;
|
||||||
|
interest = ((nValue / 10512000) * minutes);
|
||||||
|
}
|
||||||
|
return(interest);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||||
|
{
|
||||||
|
uint64_t interest = 0;
|
||||||
|
if ( komodo_moneysupply(txheight) < MAX_MONEY && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= 10*COIN )
|
||||||
|
interest = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
|
return(interest);
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||||
{
|
{
|
||||||
int32_t minutes,exception; uint64_t numerator,denominator,interest = 0; uint32_t activation;
|
int32_t minutes,exception; uint64_t interestnew,numerator,denominator,interest = 0; uint32_t activation;
|
||||||
activation = 1491350400; // 1491350400 5th April
|
activation = 1491350400; // 1491350400 5th April
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
return(0);
|
return(0);
|
||||||
@@ -109,13 +140,24 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
|
|||||||
numerator = (nValue / 20); // assumes 5%!
|
numerator = (nValue / 20); // assumes 5%!
|
||||||
if ( txheight < 250000 )
|
if ( txheight < 250000 )
|
||||||
interest = (numerator / denominator);
|
interest = (numerator / denominator);
|
||||||
else interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60);
|
else if ( txheight < 1000000 )
|
||||||
|
{
|
||||||
|
interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60);
|
||||||
|
interestnew = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
|
if ( interest < interestnew )
|
||||||
|
printf("path0 current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime);
|
||||||
|
}
|
||||||
|
else interest = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
}
|
}
|
||||||
else
|
else if ( txheight < 1000000 )
|
||||||
{
|
{
|
||||||
numerator = (nValue * KOMODO_INTEREST);
|
numerator = (nValue * KOMODO_INTEREST);
|
||||||
interest = (numerator / denominator) / COIN;
|
interest = (numerator / denominator) / COIN;
|
||||||
|
interestnew = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
|
if ( interest < interestnew )
|
||||||
|
printf("path0 current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime);
|
||||||
}
|
}
|
||||||
|
else interest = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -132,12 +174,16 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
|
|||||||
interest = (numerator / denominator) / COIN;
|
interest = (numerator / denominator) / COIN;
|
||||||
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
|
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
|
||||||
}
|
}
|
||||||
else
|
else if ( txheight < 1000000 )
|
||||||
{
|
{
|
||||||
numerator = (nValue / 20); // assumes 5%!
|
numerator = (nValue / 20); // assumes 5%!
|
||||||
interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60));
|
interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60));
|
||||||
//fprintf(stderr,"interest %llu %.8f <- numerator.%llu minutes.%d\n",(long long)interest,(double)interest/COIN,(long long)numerator,(int32_t)minutes);
|
//fprintf(stderr,"interest %llu %.8f <- numerator.%llu minutes.%d\n",(long long)interest,(double)interest/COIN,(long long)numerator,(int32_t)minutes);
|
||||||
|
interestnew = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
|
if ( interest < interestnew )//|| (interestnew < 0.9999*interest && (interest-interestnew) > 50000) )
|
||||||
|
printf("path1 current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime);
|
||||||
}
|
}
|
||||||
|
else interest = _komodo_interestnew(nValue,nLockTime,tiptime);
|
||||||
}
|
}
|
||||||
if ( 0 && numerator == (nValue * KOMODO_INTEREST) )
|
if ( 0 && numerator == (nValue * KOMODO_INTEREST) )
|
||||||
fprintf(stderr,"komodo_interest.%d %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu) prod.%llu\n",txheight,(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator,(long long)(numerator * minutes));
|
fprintf(stderr,"komodo_interest.%d %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu) prod.%llu\n",txheight,(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator,(long long)(numerator * minutes));
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize)
|
|||||||
{
|
{
|
||||||
static uint32_t lastcrc;
|
static uint32_t lastcrc;
|
||||||
FILE *fp; char fname[512]; uint32_t crc32,check,timestamp; int32_t i,n=0,retval,fsize,len=0; uint8_t data[8192];
|
FILE *fp; char fname[512]; uint32_t crc32,check,timestamp; int32_t i,n=0,retval,fsize,len=0; uint8_t data[8192];
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
sprintf(fname,"%s\\%s",GetDataDir(false).string().c_str(),(char *)"komodofeed");
|
sprintf(fname,"%s\\%s",GetDataDir(false).string().c_str(),(char *)"komodofeed");
|
||||||
#else
|
#else
|
||||||
sprintf(fname,"%s/%s",GetDataDir(false).string().c_str(),(char *)"komodofeed");
|
sprintf(fname,"%s/%s",GetDataDir(false).string().c_str(),(char *)"komodofeed");
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "uthash.h"
|
#include "uthash.h"
|
||||||
#include "utlist.h"
|
#include "utlist.h"
|
||||||
|
|
||||||
/*#ifdef WIN32
|
/*#ifdef _WIN32
|
||||||
#define PACKED
|
#define PACKED
|
||||||
#else
|
#else
|
||||||
#define PACKED __attribute__((packed))
|
#define PACKED __attribute__((packed))
|
||||||
|
|||||||
@@ -1305,7 +1305,7 @@ void komodo_statefname(char *fname,char *symbol,char *str)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
strcat(fname,"\\");
|
strcat(fname,"\\");
|
||||||
#else
|
#else
|
||||||
strcat(fname,"/");
|
strcat(fname,"/");
|
||||||
@@ -1315,7 +1315,7 @@ void komodo_statefname(char *fname,char *symbol,char *str)
|
|||||||
{
|
{
|
||||||
strcat(fname,symbol);
|
strcat(fname,symbol);
|
||||||
//printf("statefname.(%s) -> (%s)\n",symbol,fname);
|
//printf("statefname.(%s) -> (%s)\n",symbol,fname);
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
strcat(fname,"\\");
|
strcat(fname,"\\");
|
||||||
#else
|
#else
|
||||||
strcat(fname,"/");
|
strcat(fname,"/");
|
||||||
@@ -1347,7 +1347,7 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
password[i*2] = 0;
|
password[i*2] = 0;
|
||||||
sprintf(buf,"%s.conf",symbol);
|
sprintf(buf,"%s.conf",symbol);
|
||||||
BITCOIND_PORT = port;
|
BITCOIND_PORT = port;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
sprintf(fname,"%s\\%s",GetDataDir(false).string().c_str(),buf);
|
sprintf(fname,"%s\\%s",GetDataDir(false).string().c_str(),buf);
|
||||||
#else
|
#else
|
||||||
sprintf(fname,"%s/%s",GetDataDir(false).string().c_str(),buf);
|
sprintf(fname,"%s/%s",GetDataDir(false).string().c_str(),buf);
|
||||||
@@ -1371,7 +1371,7 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcpy(fname,GetDataDir().string().c_str());
|
strcpy(fname,GetDataDir().string().c_str());
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
while ( fname[strlen(fname)-1] != '\\' )
|
while ( fname[strlen(fname)-1] != '\\' )
|
||||||
fname[strlen(fname)-1] = 0;
|
fname[strlen(fname)-1] = 0;
|
||||||
strcat(fname,"komodo.conf");
|
strcat(fname,"komodo.conf");
|
||||||
@@ -1576,12 +1576,12 @@ void komodo_args(char *argv0)
|
|||||||
for (iter=0; iter<2; iter++)
|
for (iter=0; iter<2; iter++)
|
||||||
{
|
{
|
||||||
strcpy(fname,GetDataDir().string().c_str());
|
strcpy(fname,GetDataDir().string().c_str());
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
while ( fname[strlen(fname)-1] != '\\' )
|
while ( fname[strlen(fname)-1] != '\\' )
|
||||||
fname[strlen(fname)-1] = 0;
|
fname[strlen(fname)-1] = 0;
|
||||||
if ( iter == 0 )
|
if ( iter == 0 )
|
||||||
strcat(fname,".komodo\\komodo.conf");
|
strcat(fname,"Komodo\\komodo.conf");
|
||||||
else strcat(fname,".bitcoin\\bitcoin.conf");
|
else strcat(fname,"Bitcoin\\bitcoin.conf");
|
||||||
#else
|
#else
|
||||||
while ( fname[strlen(fname)-1] != '/' )
|
while ( fname[strlen(fname)-1] != '/' )
|
||||||
fname[strlen(fname)-1] = 0;
|
fname[strlen(fname)-1] = 0;
|
||||||
|
|||||||
@@ -2365,7 +2365,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
return false;
|
return false;
|
||||||
control.Add(vChecks);
|
control.Add(vChecks);
|
||||||
}
|
}
|
||||||
komodo_earned_interest(pindex->nHeight,sum);
|
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
|
komodo_earned_interest(pindex->nHeight,sum);
|
||||||
CTxUndo undoDummy;
|
CTxUndo undoDummy;
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
blockundo.vtxundo.push_back(CTxUndo());
|
blockundo.vtxundo.push_back(CTxUndo());
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ void ThreadShowMetricsScreen()
|
|||||||
|
|
||||||
// Get current window size
|
// Get current window size
|
||||||
if (isTTY) {
|
if (isTTY) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
||||||
cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||||
@@ -421,7 +421,7 @@ void ThreadShowMetricsScreen()
|
|||||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||||
cols = w.ws_col;
|
cols = w.ws_col;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isScreen) {
|
if (isScreen) {
|
||||||
|
|||||||
16
src/net.cpp
16
src/net.cpp
@@ -17,7 +17,7 @@
|
|||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
#include "crypto/common.h"
|
#include "crypto/common.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#else
|
#else
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
// Fix for ancient MinGW versions, that don't have defined these in ws2tcpip.h.
|
// Fix for ancient MinGW versions, that don't have defined these in ws2tcpip.h.
|
||||||
// Todo: Can be removed when our pull-tester is upgraded to a modern MinGW version.
|
// Todo: Can be removed when our pull-tester is upgraded to a modern MinGW version.
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#ifndef PROTECTION_LEVEL_UNRESTRICTED
|
#ifndef PROTECTION_LEVEL_UNRESTRICTED
|
||||||
#define PROTECTION_LEVEL_UNRESTRICTED 10
|
#define PROTECTION_LEVEL_UNRESTRICTED 10
|
||||||
#endif
|
#endif
|
||||||
@@ -930,7 +930,7 @@ static void AcceptConnection(const ListenSocket& hListenSocket) {
|
|||||||
// According to the internet TCP_NODELAY is not carried into accepted sockets
|
// According to the internet TCP_NODELAY is not carried into accepted sockets
|
||||||
// on all platforms. Set it again here just to be sure.
|
// on all platforms. Set it again here just to be sure.
|
||||||
int set = 1;
|
int set = 1;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int));
|
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int));
|
||||||
#else
|
#else
|
||||||
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (void*)&set, sizeof(int));
|
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (void*)&set, sizeof(int));
|
||||||
@@ -1727,7 +1727,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#ifdef SO_NOSIGPIPE
|
#ifdef SO_NOSIGPIPE
|
||||||
// Different way of disabling SIGPIPE on BSD
|
// Different way of disabling SIGPIPE on BSD
|
||||||
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
|
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
|
||||||
@@ -1753,13 +1753,13 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
|
|||||||
// and enable it by default or not. Try to enable it, if possible.
|
// and enable it by default or not. Try to enable it, if possible.
|
||||||
if (addrBind.IsIPv6()) {
|
if (addrBind.IsIPv6()) {
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int));
|
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int));
|
||||||
#else
|
#else
|
||||||
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
|
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
int nProtLevel = PROTECTION_LEVEL_UNRESTRICTED;
|
int nProtLevel = PROTECTION_LEVEL_UNRESTRICTED;
|
||||||
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_PROTECTION_LEVEL, (const char*)&nProtLevel, sizeof(int));
|
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_PROTECTION_LEVEL, (const char*)&nProtLevel, sizeof(int));
|
||||||
#endif
|
#endif
|
||||||
@@ -1800,7 +1800,7 @@ void static Discover(boost::thread_group& threadGroup)
|
|||||||
if (!fDiscover)
|
if (!fDiscover)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Get local host IP
|
// Get local host IP
|
||||||
char pszHostName[256] = "";
|
char pszHostName[256] = "";
|
||||||
if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
|
if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
|
||||||
@@ -1945,7 +1945,7 @@ public:
|
|||||||
delete pnodeLocalHost;
|
delete pnodeLocalHost;
|
||||||
pnodeLocalHost = NULL;
|
pnodeLocalHost = NULL;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Shutdown Windows Sockets
|
// Shutdown Windows Sockets
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#if HAVE_INET_PTON
|
#if HAVE_INET_PTON
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -129,7 +129,7 @@ bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsign
|
|||||||
aiHint.ai_socktype = SOCK_STREAM;
|
aiHint.ai_socktype = SOCK_STREAM;
|
||||||
aiHint.ai_protocol = IPPROTO_TCP;
|
aiHint.ai_protocol = IPPROTO_TCP;
|
||||||
aiHint.ai_family = AF_UNSPEC;
|
aiHint.ai_family = AF_UNSPEC;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
|
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
|
||||||
#else
|
#else
|
||||||
aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST;
|
aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST;
|
||||||
@@ -454,7 +454,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Disable Nagle's algorithm
|
//Disable Nagle's algorithm
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int));
|
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int));
|
||||||
#else
|
#else
|
||||||
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (void*)&set, sizeof(int));
|
setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (void*)&set, sizeof(int));
|
||||||
@@ -488,7 +488,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
socklen_t nRetSize = sizeof(nRet);
|
socklen_t nRetSize = sizeof(nRet);
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, (char*)(&nRet), &nRetSize) == SOCKET_ERROR)
|
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, (char*)(&nRet), &nRetSize) == SOCKET_ERROR)
|
||||||
#else
|
#else
|
||||||
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR)
|
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR)
|
||||||
@@ -505,7 +505,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
else if (WSAGetLastError() != WSAEISCONN)
|
else if (WSAGetLastError() != WSAEISCONN)
|
||||||
#else
|
#else
|
||||||
else
|
else
|
||||||
@@ -1348,7 +1348,7 @@ bool operator<(const CSubNet& a, const CSubNet& b)
|
|||||||
return (a.network < b.network || (a.network == b.network && memcmp(a.netmask, b.netmask, 16) < 0));
|
return (a.network < b.network || (a.network == b.network && memcmp(a.netmask, b.netmask, 16) < 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
std::string NetworkErrorString(int err)
|
std::string NetworkErrorString(int err)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@@ -1386,7 +1386,7 @@ bool CloseSocket(SOCKET& hSocket)
|
|||||||
{
|
{
|
||||||
if (hSocket == INVALID_SOCKET)
|
if (hSocket == INVALID_SOCKET)
|
||||||
return false;
|
return false;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
int ret = closesocket(hSocket);
|
int ret = closesocket(hSocket);
|
||||||
#else
|
#else
|
||||||
int ret = close(hSocket);
|
int ret = close(hSocket);
|
||||||
@@ -1398,7 +1398,7 @@ bool CloseSocket(SOCKET& hSocket)
|
|||||||
bool SetSocketNonBlocking(SOCKET& hSocket, bool fNonBlocking)
|
bool SetSocketNonBlocking(SOCKET& hSocket, bool fNonBlocking)
|
||||||
{
|
{
|
||||||
if (fNonBlocking) {
|
if (fNonBlocking) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
u_long nOne = 1;
|
u_long nOne = 1;
|
||||||
if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
|
if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
|
||||||
#else
|
#else
|
||||||
@@ -1409,7 +1409,7 @@ bool SetSocketNonBlocking(SOCKET& hSocket, bool fNonBlocking)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
u_long nZero = 0;
|
u_long nZero = 0;
|
||||||
if (ioctlsocket(hSocket, FIONBIO, &nZero) == SOCKET_ERROR) {
|
if (ioctlsocket(hSocket, FIONBIO, &nZero) == SOCKET_ERROR) {
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ extern bool fNameLookup;
|
|||||||
/** -timeout default */
|
/** -timeout default */
|
||||||
static const int DEFAULT_CONNECT_TIMEOUT = 5000;
|
static const int DEFAULT_CONNECT_TIMEOUT = 5000;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// In MSVC, this is defined as a macro, undefine it to prevent a compile and link error
|
// In MSVC, this is defined as a macro, undefine it to prevent a compile and link error
|
||||||
#undef SetPort
|
#undef SetPort
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
|
||||||
#include "support/cleanse.h"
|
#include "support/cleanse.h"
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "compat.h" // for Windows API
|
#include "compat.h" // for Windows API
|
||||||
#endif
|
#endif
|
||||||
#include "serialize.h" // for begin_ptr(vec)
|
#include "serialize.h" // for begin_ptr(vec)
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
static inline int64_t GetPerformanceCounter()
|
static inline int64_t GetPerformanceCounter()
|
||||||
{
|
{
|
||||||
int64_t nCounter = 0;
|
int64_t nCounter = 0;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
||||||
#else
|
#else
|
||||||
timeval t;
|
timeval t;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "config/bitcoin-config.h"
|
#include "config/bitcoin-config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#ifdef _WIN32_WINNT
|
#ifdef _WIN32_WINNT
|
||||||
#undef _WIN32_WINNT
|
#undef _WIN32_WINNT
|
||||||
#endif
|
#endif
|
||||||
@@ -49,7 +49,7 @@ static inline size_t GetSystemPageSize()
|
|||||||
|
|
||||||
bool MemoryPageLocker::Lock(const void* addr, size_t len)
|
bool MemoryPageLocker::Lock(const void* addr, size_t len)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return VirtualLock(const_cast<void*>(addr), len) != 0;
|
return VirtualLock(const_cast<void*>(addr), len) != 0;
|
||||||
#else
|
#else
|
||||||
return mlock(addr, len) == 0;
|
return mlock(addr, len) == 0;
|
||||||
@@ -58,7 +58,7 @@ bool MemoryPageLocker::Lock(const void* addr, size_t len)
|
|||||||
|
|
||||||
bool MemoryPageLocker::Unlock(const void* addr, size_t len)
|
bool MemoryPageLocker::Unlock(const void* addr, size_t len)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return VirtualUnlock(const_cast<void*>(addr), len) != 0;
|
return VirtualUnlock(const_cast<void*>(addr), len) != 0;
|
||||||
#else
|
#else
|
||||||
return munlock(addr, len) == 0;
|
return munlock(addr, len) == 0;
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE(AlertNotify)
|
|||||||
// Windows built-in echo semantics are different than posixy shells. Quotes and
|
// Windows built-in echo semantics are different than posixy shells. Quotes and
|
||||||
// whitespace are printed literally.
|
// whitespace are printed literally.
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
BOOST_CHECK_EQUAL(r[0], "Alert 1");
|
BOOST_CHECK_EQUAL(r[0], "Alert 1");
|
||||||
BOOST_CHECK_EQUAL(r[1], "Alert 2, cancels 1");
|
BOOST_CHECK_EQUAL(r[1], "Alert 2, cancels 1");
|
||||||
BOOST_CHECK_EQUAL(r[2], "Alert 2, cancels 1");
|
BOOST_CHECK_EQUAL(r[2], "Alert 2, cancels 1");
|
||||||
|
|||||||
30
src/util.cpp
30
src/util.cpp
@@ -23,7 +23,7 @@
|
|||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
// for posix_fallocate
|
// for posix_fallocate
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ void ParseParameters(int argc, const char* const argv[])
|
|||||||
strValue = str.substr(is_index+1);
|
strValue = str.substr(is_index+1);
|
||||||
str = str.substr(0, is_index);
|
str = str.substr(0, is_index);
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
boost::to_lower(str);
|
boost::to_lower(str);
|
||||||
if (boost::algorithm::starts_with(str, "/"))
|
if (boost::algorithm::starts_with(str, "/"))
|
||||||
str = "-" + str.substr(1);
|
str = "-" + str.substr(1);
|
||||||
@@ -419,7 +419,7 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message
|
|||||||
|
|
||||||
static std::string FormatException(const std::exception* pex, const char* pszThread)
|
static std::string FormatException(const std::exception* pex, const char* pszThread)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
char pszModule[MAX_PATH] = "";
|
char pszModule[MAX_PATH] = "";
|
||||||
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
|
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
|
||||||
#else
|
#else
|
||||||
@@ -455,7 +455,7 @@ boost::filesystem::path GetDefaultDataDir()
|
|||||||
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Zcash
|
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Zcash
|
||||||
// Mac: ~/Library/Application Support/Zcash
|
// Mac: ~/Library/Application Support/Zcash
|
||||||
// Unix: ~/.zcash
|
// Unix: ~/.zcash
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Windows
|
// Windows
|
||||||
if ( symbol[0] == 0 )
|
if ( symbol[0] == 0 )
|
||||||
return GetSpecialFolderPath(CSIDL_APPDATA) / "Komodo";
|
return GetSpecialFolderPath(CSIDL_APPDATA) / "Komodo";
|
||||||
@@ -502,7 +502,7 @@ static boost::filesystem::path ZC_GetBaseParamsDir()
|
|||||||
// Windows >= Vista: C:\Users\Username\AppData\Roaming\ZcashParams
|
// Windows >= Vista: C:\Users\Username\AppData\Roaming\ZcashParams
|
||||||
// Mac: ~/Library/Application Support/ZcashParams
|
// Mac: ~/Library/Application Support/ZcashParams
|
||||||
// Unix: ~/.zcash-params
|
// Unix: ~/.zcash-params
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Windows
|
// Windows
|
||||||
return GetSpecialFolderPath(CSIDL_APPDATA) / "ZcashParams";
|
return GetSpecialFolderPath(CSIDL_APPDATA) / "ZcashParams";
|
||||||
#else
|
#else
|
||||||
@@ -648,7 +648,7 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
|
|||||||
//fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT);
|
//fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
boost::filesystem::path GetPidFile()
|
boost::filesystem::path GetPidFile()
|
||||||
{
|
{
|
||||||
boost::filesystem::path pathPidFile(GetArg("-pid", "komodod.pid"));
|
boost::filesystem::path pathPidFile(GetArg("-pid", "komodod.pid"));
|
||||||
@@ -669,13 +669,13 @@ void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
|
|||||||
|
|
||||||
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
|
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
|
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
|
||||||
MOVEFILE_REPLACE_EXISTING) != 0;
|
MOVEFILE_REPLACE_EXISTING) != 0;
|
||||||
#else
|
#else
|
||||||
int rc = std::rename(src.string().c_str(), dest.string().c_str());
|
int rc = std::rename(src.string().c_str(), dest.string().c_str());
|
||||||
return (rc == 0);
|
return (rc == 0);
|
||||||
#endif /* WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -700,7 +700,7 @@ bool TryCreateDirectory(const boost::filesystem::path& p)
|
|||||||
void FileCommit(FILE *fileout)
|
void FileCommit(FILE *fileout)
|
||||||
{
|
{
|
||||||
fflush(fileout); // harmless if redundantly called
|
fflush(fileout); // harmless if redundantly called
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(fileout));
|
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(fileout));
|
||||||
FlushFileBuffers(hFile);
|
FlushFileBuffers(hFile);
|
||||||
#else
|
#else
|
||||||
@@ -815,7 +815,7 @@ void ShrinkDebugFile()
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
@@ -838,7 +838,7 @@ boost::filesystem::path GetTempPath() {
|
|||||||
#else
|
#else
|
||||||
// TODO: remove when we don't support filesystem v2 anymore
|
// TODO: remove when we don't support filesystem v2 anymore
|
||||||
boost::filesystem::path path;
|
boost::filesystem::path path;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
char pszPath[MAX_PATH] = "";
|
char pszPath[MAX_PATH] = "";
|
||||||
|
|
||||||
if (GetTempPathA(MAX_PATH, pszPath))
|
if (GetTempPathA(MAX_PATH, pszPath))
|
||||||
@@ -898,7 +898,7 @@ void SetupEnvironment()
|
|||||||
|
|
||||||
bool SetupNetworking()
|
bool SetupNetworking()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// Initialize Windows Sockets
|
// Initialize Windows Sockets
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
|
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
|
||||||
@@ -910,15 +910,15 @@ bool SetupNetworking()
|
|||||||
|
|
||||||
void SetThreadPriority(int nPriority)
|
void SetThreadPriority(int nPriority)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
SetThreadPriority(GetCurrentThread(), nPriority);
|
SetThreadPriority(GetCurrentThread(), nPriority);
|
||||||
#else // WIN32
|
#else // _WIN32
|
||||||
#ifdef PRIO_THREAD
|
#ifdef PRIO_THREAD
|
||||||
setpriority(PRIO_THREAD, 0, nPriority);
|
setpriority(PRIO_THREAD, 0, nPriority);
|
||||||
#else // PRIO_THREAD
|
#else // PRIO_THREAD
|
||||||
setpriority(PRIO_PROCESS, 0, nPriority);
|
setpriority(PRIO_PROCESS, 0, nPriority);
|
||||||
#endif // PRIO_THREAD
|
#endif // PRIO_THREAD
|
||||||
#endif // WIN32
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PrivacyInfo()
|
std::string PrivacyInfo()
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ boost::filesystem::path GetDefaultDataDir();
|
|||||||
const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
|
const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
|
||||||
void ClearDatadirCache();
|
void ClearDatadirCache();
|
||||||
boost::filesystem::path GetConfigFile();
|
boost::filesystem::path GetConfigFile();
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
boost::filesystem::path GetPidFile();
|
boost::filesystem::path GetPidFile();
|
||||||
void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
|
void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
|
||||||
#endif
|
#endif
|
||||||
@@ -133,7 +133,7 @@ public:
|
|||||||
missing_zcash_conf() : std::runtime_error("Missing komodo.conf") { }
|
missing_zcash_conf() : std::runtime_error("Missing komodo.conf") { }
|
||||||
};
|
};
|
||||||
void ReadConfigFile(std::map<std::string, std::string>& mapSettingsRet, std::map<std::string, std::vector<std::string> >& mapMultiSettingsRet);
|
void ReadConfigFile(std::map<std::string, std::string>& mapSettingsRet, std::map<std::string, std::vector<std::string> >& mapMultiSettingsRet);
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
||||||
#endif
|
#endif
|
||||||
boost::filesystem::path GetTempPath();
|
boost::filesystem::path GetTempPath();
|
||||||
@@ -150,7 +150,7 @@ std::string LicenseInfo();
|
|||||||
|
|
||||||
inline bool IsSwitchChar(char c)
|
inline bool IsSwitchChar(char c)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return c == '-' || c == '/';
|
return c == '-' || c == '/';
|
||||||
#else
|
#else
|
||||||
return c == '-';
|
return c == '-';
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user