Skip to content

Commit

Permalink
Merge pull request #77 from DigitalNoteXDN/v2.0.0.4-testing
Browse files Browse the repository at this point in the history
V2.0.0.4 testing merge
  • Loading branch information
rubber-duckie-au committed Sep 11, 2021
2 parents a0fb5d7 + 45eb8cc commit 69775b1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DigitalNote_config.pri
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DIGITALNOTE_VERSION_MAJOR = 2
DIGITALNOTE_VERSION_MINOR = 0
DIGITALNOTE_VERSION_REVISION = 0
DIGITALNOTE_VERSION_BUILD = 3
DIGITALNOTE_VERSION_BUILD = 4

DIGITALNOTE_LIB_LEVELDB_DIR = $${DIGITALNOTE_PATH}/src/leveldb
DIGITALNOTE_LIB_LEVELDB_NEW_DIR = $${DIGITALNOTE_PATH}/src/leveldb-2.11
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 3
#define CLIENT_VERSION_BUILD 4

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
3 changes: 2 additions & 1 deletion src/ctransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "util.h"
#include "cautofile.h"
#include "cdatastream.h"
#include "checkpoints.h"

#include "ctransaction.h"

Expand Down Expand Up @@ -494,7 +495,7 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs, std::map<uint256
// Skip ECDSA signature verification when connecting blocks (fBlock=true)
// before the last blockchain checkpoint. This is safe because block merkle hashes are
// still computed and checked, and any change will be caught at the next checkpoint.
if (!(fBlock && !IsInitialBlockDownload()))
if (!(fBlock && (nBestHeight < Checkpoints::GetTotalBlocksEstimate())))
{
// Verify signature
if (!VerifySignature(txPrev, *this, i, flags, 0))
Expand Down
30 changes: 30 additions & 0 deletions src/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3843,6 +3843,13 @@ bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTrans

bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType)
{
std::string _txFrom, _txTo;

_txFrom = txFrom.GetHash().ToString();
_txTo = txTo.GetHash().ToString();

LogPrintf("VerifySignature from %s to %s\n", _txFrom.c_str(), _txTo.c_str());

assert(nIn < txTo.vin.size());

const CTxIn& txin = txTo.vin[nIn];
Expand All @@ -3859,6 +3866,29 @@ bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsig
return false;
}

/*
Exploit happpend on 31st Aug 2021 17:17:26
Reference:
https://xdn-explorer.com/block/00000000000371f620dba8ef1576407b558686d8b00ca275c3debbfaee6a3db8
*/
if(
(
(
_txFrom == "81140f106083298143e0e0bd044705b83a891bf2072721dfa43f7237be5931fb" ||
_txFrom == "164a0151731efc1536fd75e7d5c4a61e17ef67df1d0f4649b3689d604a41a955"
) &&
_txTo == "2a639be55df3d7789c73e05aab30edce8fc867d1aae76728e2d59dd2c19b39ab"
) ||
(
_txFrom == "2a639be55df3d7789c73e05aab30edce8fc867d1aae76728e2d59dd2c19b39ab" &&
_txTo == "adb24c4a4f50bf848ded522fad8de1546bcc16f1ae838a5b51888bcd753dd25b"
)
)
{
return true;
}

return VerifyScript(txin.scriptSig, txout.scriptPubKey, txTo, nIn, flags, nHashType);
}

Expand Down
10 changes: 5 additions & 5 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ static const int DATABASE_VERSION = 70509;
//
// network protocol versioning
//
static const int PROTOCOL_VERSION = 62051;
static const int PROTOCOL_VERSION = 62052;

// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;

// disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 62049;
static const int MIN_PEER_PROTO_VERSION = 62052;

// minimum peer version accepted by MNenginePool
static const int MIN_POOL_PEER_PROTO_VERSION = 62050;
Expand All @@ -45,16 +45,16 @@ static const int MIN_INSTANTX_PROTO_VERSION = 62050;
//! minimum peer version that can receive masternode payments
// V1 - Last protocol version before update
// V2 - Newest protocol version
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 62050;
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 62050;
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 62051;
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 62051;

// nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this
static const int CADDR_TIME_VERSION = 31402;

// only request blocks from nodes outside this range of versions
static const int NOBLKS_VERSION_START = 0;
static const int NOBLKS_VERSION_END = 62050;
static const int NOBLKS_VERSION_END = 62051;

// hard cutoff time for legacy network connections
static const int64_t HRD_LEGACY_CUTOFF = 9993058800; // OFF (NOT TOGGLED)
Expand Down

0 comments on commit 69775b1

Please sign in to comment.