Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into client-api
Browse files Browse the repository at this point in the history
  • Loading branch information
sproxet committed Nov 27, 2023
2 parents 614baae + 39c41e5 commit 8aaaf3d
Show file tree
Hide file tree
Showing 48 changed files with 587 additions and 240 deletions.
12 changes: 10 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ pipeline {
}
stage('Test') {
steps {
dir('dist') {
sh 'make check'
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE'){
dir('dist') {
sh 'make check'
}
}
}
}
stage('Archive unit tests logs') {
steps {
archiveArtifacts artifacts: 'dist/src/test-suite.log',
allowEmptyArchive: true
}
}
stage('RPC Tests') {
steps {
dir('dist') {
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 14)
define(_CLIENT_VERSION_REVISION, 12)
define(_CLIENT_VERSION_BUILD, 6)
define(_CLIENT_VERSION_REVISION, 13)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2023)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
1 change: 1 addition & 0 deletions qa/rpc-tests/test_framework/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def __new__(cls, n):
OP_SMALLINTEGER = CScriptOp(0xfa)
OP_PUBKEYS = CScriptOp(0xfb)
OP_PUBKEYHASH = CScriptOp(0xfd)
OP_SUPERSTRANSPARENTPUBKEYHASH = CScriptOp(0xe0)
OP_PUBKEY = CScriptOp(0xfe)

OP_INVALIDOPCODE = CScriptOp(0xff)
Expand Down
18 changes: 17 additions & 1 deletion src/base58.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
CBitcoinAddressVisitor(CBitcoinAddress* addrIn) : addr(addrIn) {}

bool operator()(const CKeyID& id) const { return addr->Set(id); }
bool operator()(const CExchangeKeyID& id) const { return addr->Set(id); }
bool operator()(const CScriptID& id) const { return addr->Set(id); }
bool operator()(const CNoDestination& no) const { return false; }
};
Expand All @@ -234,6 +235,18 @@ bool CBitcoinAddress::Set(const CKeyID& id)
return true;
}

bool CBitcoinAddress::Set(const CExchangeKeyID& id)
{
SetData(Params().Base58Prefix(CChainParams::EXCHANGE_PUBKEY_ADDRESS), &id, 20);
return true;
}

bool CBitcoinAddress::SetExchange(const CKeyID& id)
{
SetData(Params().Base58Prefix(CChainParams::EXCHANGE_PUBKEY_ADDRESS), &id, 20);
return true;
}

bool CBitcoinAddress::Set(const CScriptID& id)
{
SetData(Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS), &id, 20);
Expand All @@ -254,7 +267,8 @@ bool CBitcoinAddress::IsValid(const CChainParams& params) const
{
bool fCorrectSize = vchData.size() == 20;
bool fKnownVersion = vchVersion == params.Base58Prefix(CChainParams::PUBKEY_ADDRESS) ||
vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS) ||
vchVersion == params.Base58Prefix(CChainParams::EXCHANGE_PUBKEY_ADDRESS);
return fCorrectSize && fKnownVersion;
}

Expand All @@ -268,6 +282,8 @@ CTxDestination CBitcoinAddress::Get() const
return CKeyID(id);
else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
return CScriptID(id);
else if (vchVersion == Params().Base58Prefix(CChainParams::EXCHANGE_PUBKEY_ADDRESS))
return CExchangeKeyID(id);
else
return CNoDestination();
}
Expand Down
10 changes: 9 additions & 1 deletion src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,22 @@ class CBase58Data
class CBitcoinAddress : public CBase58Data {
public:
bool Set(const CKeyID &id);
bool Set(const CExchangeKeyID &id);
bool Set(const CScriptID &id);
bool Set(const CTxDestination &dest);
bool SetExchange(const CKeyID &id);
bool IsValid() const;
bool IsValid(const CChainParams &params) const;

CBitcoinAddress() {}
CBitcoinAddress(const CTxDestination &dest) { Set(dest); }
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
CBitcoinAddress(const std::string& strAddress) {
SetString(strAddress);
if (vchData.size() != 20) {
// give the address second chance and try exchange address format with 3 byte prefix
SetString(strAddress.c_str(), 3);
}
}
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }

CTxDestination Get() const;
Expand Down
14 changes: 14 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ class CMainParams : public CChainParams {
// Note that of those with the service bits flag, most only support a subset of possible options
base58Prefixes[PUBKEY_ADDRESS] = std::vector < unsigned char > (1, 82);
base58Prefixes[SCRIPT_ADDRESS] = std::vector < unsigned char > (1, 7);
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0xbb}; // EXX prefix for the address
base58Prefixes[SECRET_KEY] = std::vector < unsigned char > (1, 210);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container < std::vector < unsigned char > > ();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container < std::vector < unsigned char > > ();
Expand Down Expand Up @@ -472,6 +473,9 @@ class CMainParams : public CChainParams {
consensus.nPPSwitchTime = 1635228000; // Tue Oct 26 2021 06:00:00 GMT+0000
consensus.nPPBlockNumber = 419264;
consensus.nInitialPPDifficulty = 0x1b1774cd; // 40GH/s

// exchange address
consensus.nExchangeAddressStartBlock = consensus.nSparkStartBlock;
}
virtual bool SkipUndoForBlock(int nHeight) const
{
Expand Down Expand Up @@ -660,6 +664,7 @@ class CTestNetParams : public CChainParams {

base58Prefixes[PUBKEY_ADDRESS] = std::vector < unsigned char > (1, 65);
base58Prefixes[SCRIPT_ADDRESS] = std::vector < unsigned char > (1, 178);
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0xbb}; // EXT prefix for the address
base58Prefixes[SECRET_KEY] = std::vector < unsigned char > (1, 185);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container < std::vector < unsigned char > > ();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container < std::vector < unsigned char > > ();
Expand Down Expand Up @@ -763,6 +768,9 @@ class CTestNetParams : public CChainParams {
consensus.nPPSwitchTime = 1630069200; // August 27 2021, 13:00 UTC
consensus.nPPBlockNumber = 37305;
consensus.nInitialPPDifficulty = 0x1d016e81; // 10MH/s

// exchange address
consensus.nExchangeAddressStartBlock = 147000;
}
};

Expand Down Expand Up @@ -918,6 +926,7 @@ class CDevNetParams : public CChainParams {

base58Prefixes[PUBKEY_ADDRESS] = std::vector < unsigned char > (1, 66);
base58Prefixes[SCRIPT_ADDRESS] = std::vector < unsigned char > (1, 179);
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0x8e}; // EXD prefix for the address
base58Prefixes[SECRET_KEY] = std::vector < unsigned char > (1, 186);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xD0).convert_to_container < std::vector < unsigned char > > ();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x95).convert_to_container < std::vector < unsigned char > > ();
Expand Down Expand Up @@ -996,6 +1005,9 @@ class CDevNetParams : public CChainParams {
consensus.nPPSwitchTime = 1631261566; // immediately after network start
consensus.nPPBlockNumber = 1;
consensus.nInitialPPDifficulty = 0x2000ffff;

// exchange address
consensus.nExchangeAddressStartBlock = 2500;
}
};

Expand Down Expand Up @@ -1158,6 +1170,7 @@ class CRegTestParams : public CChainParams {
};
base58Prefixes[PUBKEY_ADDRESS] = std::vector < unsigned char > (1, 65);
base58Prefixes[SCRIPT_ADDRESS] = std::vector < unsigned char > (1, 178);
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0xac}; // EXR prefix for the address
base58Prefixes[SECRET_KEY] = std::vector < unsigned char > (1, 239);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container < std::vector < unsigned char > > ();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container < std::vector < unsigned char > > ();
Expand All @@ -1182,6 +1195,7 @@ class CRegTestParams : public CChainParams {
consensus.nLelantusStartBlock = 400;
consensus.nLelantusFixesStartBlock = 400;
consensus.nSparkStartBlock = 1000;
consensus.nExchangeAddressStartBlock = 1000;
consensus.nLelantusGracefulPeriod = 1500;
consensus.nZerocoinV2MintMempoolGracefulPeriod = 1;
consensus.nZerocoinV2MintGracefulPeriod = 1;
Expand Down
1 change: 1 addition & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class CChainParams
SECRET_KEY,
EXT_PUBLIC_KEY,
EXT_SECRET_KEY,
EXCHANGE_PUBKEY_ADDRESS,

MAX_BASE58_TYPES
};
Expand Down
Loading

0 comments on commit 8aaaf3d

Please sign in to comment.