Skip to content

Commit

Permalink
removing tx timestamps & txid malleability
Browse files Browse the repository at this point in the history
  • Loading branch information
StealthSend authored and StealthSend committed Oct 24, 2018
1 parent 4eb5c16 commit 5be35d6
Show file tree
Hide file tree
Showing 38 changed files with 860 additions and 575 deletions.
2 changes: 1 addition & 1 deletion Stealth.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ win32 {

TEMPLATE = app
TARGET = "Stealth Qt"
VERSION = 2.1.0.3
VERSION = 2.2.0.0
INCLUDEPATH += src src/json src/qt src/tor
INCLUDEPATH += src/tor/adapter src/tor/common src/tor/ext
INCLUDEPATH += src/tor/ext/curve25519_donna src/tor/ext/ed25519/donna
Expand Down
6 changes: 3 additions & 3 deletions contrib/macdeploy/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Stealth [XST] Complete Anonymity 2.1.0.3</string>
<string>StealthCoin [XST] Complete Anonymity 2.2.0.0</string>
<key>CFBundleExecutable</key>
<string>Stealth Qt</string>
<key>CFBundleIdentifier</key>
<string>org.stealth.stealth-qt</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0.3</string>
<string>2.2.0.0</string>
<key>CFBundleSignature</key>
<string>oXST</string>
<key>CFBundleVersion</key>
<string>2.1.0.3</string>
<string>2.2.0.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ std::string CUnsignedAlert::ToString() const
return strprintf(
"CAlert(\n"
" nVersion = %d\n"
" nRelayUntil = %"PRI64d"\n"
" nExpiration = %"PRI64d"\n"
" nRelayUntil = %" PRI64d "\n"
" nExpiration = %" PRI64d "\n"
" nID = %d\n"
" nCancel = %d\n"
" setCancel = %s\n"
Expand Down
4 changes: 2 additions & 2 deletions src/bignum.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ class CBigNum
CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
// CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(int64 n) { init(); setint64(n); }
CBigNum(unsigned char n) { init(); setulong(n); }
CBigNum(unsigned short n) { init(); setulong(n); }
CBigNum(unsigned int n) { init(); setulong(n); }
CBigNum(size_t n) { init(); setulong((unsigned int) n); }
// CBigNum(size_t n) { init(); setulong((unsigned int) n); }
// CBigNum(unsigned long n) { init(); setulong(n); }
CBigNum(uint64 n) { init(); setuint64(n); }
explicit CBigNum(uint256 n) { init(); setuint256(n); }
Expand Down
26 changes: 17 additions & 9 deletions src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
"HTTP/1.1 %d %s\r\n"
"Date: %s\r\n"
"Connection: %s\r\n"
"Content-Length: %"PRIszu"\r\n"
"Content-Length: %" PRIszu "\r\n"
"Content-Type: application/json\r\n"
"Server: StealthCoin-json-rpc/%s\r\n"
"\r\n"
Expand Down Expand Up @@ -553,25 +553,33 @@ void ErrorReply(std::ostream& stream, const Object& objError, const Value& id)
bool ClientAllowed(const boost::asio::ip::address& address)
{
// Make sure that IPv4-compatible and IPv4-mapped IPv6 addresses are treated as IPv4 addresses
if (address.is_v6()
&& (address.to_v6().is_v4_compatible()
|| address.to_v6().is_v4_mapped()))
if (address.is_v6() &&
(address.to_v6().is_v4_compatible() ||
address.to_v6().is_v4_mapped()))
{
return ClientAllowed(address.to_v6().to_v4());
}

std::string ipv4addr = address.to_string();
std::string ipv4addr = address.to_string();

if (address == asio::ip::address_v4::loopback()
|| address == asio::ip::address_v6::loopback()
|| (address.is_v4()
if ((address == asio::ip::address_v4::loopback()) ||
(address == asio::ip::address_v6::loopback()) ||
(address.is_v4() &&
// Check whether IPv4 addresses match 127.0.0.0/8 (loopback subnet)
&& (address.to_v4().to_ulong() & 0xff000000) == 0x7f000000))
(address.to_v4().to_ulong() & 0xff000000) == 0x7f000000))
{
return true;
}

const string strAddress = address.to_string();
const vector<string>& vAllow = mapMultiArgs["-rpcallowip"];
BOOST_FOREACH(string strAllow, vAllow)
{
if (WildcardMatch(strAddress, strAllow))
{
return true;
}
}
return false;
}

Expand Down
10 changes: 0 additions & 10 deletions src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,6 @@ namespace Checkpoints
return (nBestHeight >= pindexSync->nHeight + nCoinbaseMaturity ||
pindexSync->GetBlockTime() + nStakeMinAge < GetAdjustedTime());
}

// Is the sync-checkpoint too old?
bool IsSyncCheckpointTooOld(unsigned int nSeconds)
{
LOCK(cs_hashSyncCheckpoint);
// sync-checkpoint should always be accepted block
assert(mapBlockIndex.count(hashSyncCheckpoint));
const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint];
return (pindexSync->GetBlockTime() + nSeconds < GetAdjustedTime());
}
}

// stealth: sync-checkpoint master key (520 bits, 130 hex)
Expand Down
1 change: 0 additions & 1 deletion src/checkpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ namespace Checkpoints
bool SetCheckpointPrivKey(std::string strPrivKey);
bool SendSyncCheckpoint(uint256 hashCheckpoint);
bool IsMatureSyncCheckpoint();
bool IsSyncCheckpointTooOld(unsigned int nSeconds);
}

// ppcoin: synchronized checkpoint
Expand Down
4 changes: 2 additions & 2 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 4
#define CLIENT_VERSION_BUILD 0

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
Expand Down
2 changes: 1 addition & 1 deletion src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ void CDBEnv::Flush(bool fShutdown)
else
mi++;
}
printf("DBFlush(%s)%s ended %15"PRI64d"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
printf("DBFlush(%s)%s ended %15" PRI64d "ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
if (fShutdown)
{
char** listp;
Expand Down
16 changes: 8 additions & 8 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ bool AppInit2()
printf("Shutdown requested. Exiting.\n");
return false;
}
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
printf(" block index %15" PRI64d "ms\n", GetTimeMillis() - nStart);

if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
{
Expand Down Expand Up @@ -952,7 +952,7 @@ bool AppInit2()
}

printf("%s", strErrors.str().c_str());
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
printf(" wallet %15" PRI64d "ms\n", GetTimeMillis() - nStart);

RegisterWallet(pwalletMain);

Expand All @@ -972,7 +972,7 @@ bool AppInit2()
printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
printf(" rescan %15" PRI64d "ms\n", GetTimeMillis() - nStart);
}

// ********************************************************* Step 9: import blocks
Expand Down Expand Up @@ -1013,7 +1013,7 @@ bool AppInit2()
printf("Invalid or missing peers.dat; recreating\n");
}

printf("Loaded %i addresses from peers.dat %"PRI64d"ms\n",
printf("Loaded %i addresses from peers.dat %" PRI64d "ms\n",
addrman.size(), GetTimeMillis() - nStart);

// ********************************************************* Step 11: start node
Expand All @@ -1024,11 +1024,11 @@ bool AppInit2()
RandAddSeedPerfmon();

//// debug print
printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size());
printf("mapBlockIndex.size() = %" PRIszu "\n", mapBlockIndex.size());
printf("nBestHeight = %d\n", nBestHeight);
printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain->setKeyPool.size());
printf("mapWallet.size() = %"PRIszu"\n", pwalletMain->mapWallet.size());
printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain->mapAddressBook.size());
printf("setKeyPool.size() = %" PRIszu "\n", pwalletMain->setKeyPool.size());
printf("mapWallet.size() = %" PRIszu "\n", pwalletMain->mapWallet.size());
printf("mapAddressBook.size() = %" PRIszu "\n", pwalletMain->mapAddressBook.size());

if (!NewThread(StartNode, NULL))
InitError(_("Error: could not start node"));
Expand Down
2 changes: 1 addition & 1 deletion src/irc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void ThreadIRCSeed2(void* parg)
if (GetLocal(addrLocal, &addrIPv4) && nNameRetry<3)
strMyName = EncodeAddress(GetLocalAddress(&addrConnect));
if (strMyName == "")
strMyName = strprintf("x%"PRI64u"", GetRand(1000000000));
strMyName = strprintf("x%" PRI64u "", GetRand(1000000000));

Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str());
Expand Down
Loading

0 comments on commit 5be35d6

Please sign in to comment.