Skip to content

Commit

Permalink
Merge pull request #4842 from PastaPastaPasta/v18-backports-rc4
Browse files Browse the repository at this point in the history
[v18] chore: backports to v18 branch and bump version to rc4
  • Loading branch information
UdjinM6 authored May 18, 2022
2 parents dfa09a0 + 905b32f commit e66d539
Show file tree
Hide file tree
Showing 25 changed files with 198 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_docker_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
context: ${{ github.workspace }}
context: ./contrib/containers/deploy
file: ./contrib/containers/deploy/Dockerfile.GitHubActions.Release
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
Expand Down
7 changes: 2 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 18)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 3)
define(_CLIENT_VERSION_RC, 4)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2021)
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Dash Core]])
AC_INIT([Dash Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_REVISION, m4_if(_CLIENT_VERSION_BUILD, [0], [], _CLIENT_VERSION_BUILD))m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/dashpay/dash/issues],[dashcore],[https://dash.org/])
AC_INIT([Dash Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_BUILD)m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/dashpay/dash/issues],[dashcore],[https://dash.org/])
AC_CONFIG_SRCDIR([src/validation.cpp])
AC_CONFIG_HEADERS([src/config/dash-config.h])
AC_CONFIG_AUX_DIR([build-aux])
Expand Down Expand Up @@ -1827,7 +1826,6 @@ AM_CONDITIONAL([WORDS_BIGENDIAN],[test x$ac_cv_c_bigendian = xyes])

AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision])
AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build])
AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release])
AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Copyright year])
Expand All @@ -1837,7 +1835,6 @@ define(_COPYRIGHT_HOLDERS_FINAL, [patsubst(_COPYRIGHT_HOLDERS, [%s], [_COPYRIGHT
AC_DEFINE(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL", [Copyright holder(s)])
AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR)
AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR)
AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION)
AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD)
AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE)
AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
Expand Down
2 changes: 1 addition & 1 deletion contrib/containers/deploy/Dockerfile.GitHubActions.Release
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ USER dash

VOLUME ["/dash"]

COPY dash/contrib/containers/deploy/docker-entrypoint.sh /docker-entrypoint.sh
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 9998 9999 19998 19999
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dash-linux-18.0"
name: "dash-linux-18"
enable_cache: true
distro: "ubuntu"
suites:
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-osx.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dash-osx-18.0"
name: "dash-osx-18"
enable_cache: true
distro: "ubuntu"
suites:
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-win.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dash-win-18.0"
name: "dash-win-18"
enable_cache: true
distro: "ubuntu"
suites:
Expand Down
4 changes: 2 additions & 2 deletions share/qt/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<string>APPL</string>

<key>CFBundleShortVersionString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@</string>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@</string>

<key>CFBundleVersion</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@</string>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@</string>

<key>CFBundleSignature</key>
<string>????</string>
Expand Down
2 changes: 1 addition & 1 deletion share/setup.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CRCCheck on
XPStyle on
BrandingText " "
ShowInstDetails show
VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@
VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@.0
VIAddVersionKey ProductName "@PACKAGE_NAME@"
VIAddVersionKey ProductVersion "@PACKAGE_VERSION@"
VIAddVersionKey CompanyName "${COMPANY}"
Expand Down
5 changes: 2 additions & 3 deletions src/clientversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const std::string CLIENT_NAME("Dash Core");
#define BUILD_DESC BUILD_GIT_TAG
#define BUILD_SUFFIX ""
#else
#define BUILD_DESC "v" STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) \
"." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define BUILD_DESC "v" STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD)
#ifdef BUILD_GIT_COMMIT
#define BUILD_SUFFIX "-" BUILD_GIT_COMMIT
#elif defined(GIT_COMMIT_ID)
Expand All @@ -45,7 +44,7 @@ const std::string CLIENT_BUILD(BUILD_DESC BUILD_SUFFIX);

std::string FormatVersion(int nVersion)
{
return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
return strprintf("%d.%d.%d", nVersion / 10000, (nVersion / 100) % 100, nVersion % 100);
}

std::string FormatFullVersion()
Expand Down
7 changes: 3 additions & 4 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#endif //HAVE_CONFIG_H

// Check that required client information is defined
#if !defined(CLIENT_VERSION_MAJOR) || !defined(CLIENT_VERSION_MINOR) || !defined(CLIENT_VERSION_REVISION) || !defined(CLIENT_VERSION_BUILD) || !defined(CLIENT_VERSION_IS_RELEASE) || !defined(COPYRIGHT_YEAR)
#if !defined(CLIENT_VERSION_MAJOR) || !defined(CLIENT_VERSION_MINOR) || !defined(CLIENT_VERSION_BUILD) || !defined(CLIENT_VERSION_IS_RELEASE) || !defined(COPYRIGHT_YEAR)
#error Client version information missing: version is not defined by dash-config.h or in any other way
#endif

Expand All @@ -36,9 +36,8 @@
#include <vector>

static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION
10000 * CLIENT_VERSION_MAJOR
+ 100 * CLIENT_VERSION_MINOR
+ 1 * CLIENT_VERSION_BUILD;

extern const std::string CLIENT_NAME;
Expand Down
4 changes: 2 additions & 2 deletions src/dash-cli-res.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <windows.h> // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information

#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR

Expand Down
4 changes: 2 additions & 2 deletions src/dash-tx-res.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <windows.h> // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information

#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR

Expand Down
4 changes: 2 additions & 2 deletions src/dash-wallet-res.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <windows.h> // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information

#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR

Expand Down
4 changes: 2 additions & 2 deletions src/dashd-res.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <windows.h> // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information

#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR

Expand Down
47 changes: 30 additions & 17 deletions src/evo/cbtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,35 +167,33 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre

int64_t nTime1 = GetTimeMicros();

static std::map<Consensus::LLMQType, std::vector<const CBlockIndex*>> quorumsCached;
static std::map<Consensus::LLMQType, std::vector<uint256>> qcHashesCached;

// The returned quorums are in reversed order, so the most recent one is at index 0
auto quorums = llmq::quorumBlockProcessor->GetMinedAndActiveCommitmentsUntilBlock(pindexPrev);
std::map<Consensus::LLMQType, std::vector<uint256>> qcHashes;
std::map<Consensus::LLMQType, std::map<int16_t, uint256>> qcIndexedHashes;
size_t hashCount = 0;

int64_t nTime2 = GetTimeMicros(); nTimeMinedAndActive += nTime2 - nTime1;
LogPrint(BCLog::BENCHMARK, " - GetMinedAndActiveCommitmentsUntilBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeMinedAndActive * 0.000001);

if (quorums == quorumsCached) {
qcHashes = qcHashesCached;
} else {
for (const auto& p : quorums) {
auto& v = qcHashes[p.first];
v.reserve(p.second.size());
for (const auto& p2 : p.second) {
uint256 minedBlockHash;
llmq::CFinalCommitmentPtr qc = llmq::quorumBlockProcessor->GetMinedCommitment(p.first, p2->GetBlockHash(), minedBlockHash);
if (qc == nullptr) return state.DoS(100, false, REJECT_INVALID, "commitment-not-found");
v.emplace_back(::SerializeHash(*qc));
hashCount++;
for (const auto& p : quorums) {
auto& v = qcHashes[p.first];
v.reserve(p.second.size());
for (const auto& p2 : p.second) {
uint256 minedBlockHash;
llmq::CFinalCommitmentPtr qc = llmq::quorumBlockProcessor->GetMinedCommitment(p.first, p2->GetBlockHash(), minedBlockHash);
if (qc == nullptr) return state.DoS(100, false, REJECT_INVALID, "commitment-not-found");
if (llmq::CLLMQUtils::IsQuorumRotationEnabled(qc->llmqType, pindexPrev)) {
auto& qi = qcIndexedHashes[p.first];
qi.insert(std::make_pair(qc->quorumIndex, ::SerializeHash(*qc)));
continue;
}
v.emplace_back(::SerializeHash(*qc));
hashCount++;
}
quorumsCached = quorums;
qcHashesCached = qcHashes;
}


int64_t nTime3 = GetTimeMicros(); nTimeMined += nTime3 - nTime2;
LogPrint(BCLog::BENCHMARK, " - GetMinedCommitment: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMined * 0.000001);

Expand All @@ -215,6 +213,11 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre
auto qcHash = ::SerializeHash(qc.commitment);
const auto& llmq_params = llmq::GetLLMQParams(qc.commitment.llmqType);
auto& v = qcHashes[llmq_params.type];
if (llmq::CLLMQUtils::IsQuorumRotationEnabled(qc.commitment.llmqType, pindexPrev)) {
auto& qi = qcIndexedHashes[qc.commitment.llmqType];
qi[qc.commitment.quorumIndex] = qcHash;
continue;
}
if (v.size() == size_t(llmq_params.signingActiveQuorumCount)) {
// we pop the last entry, which is actually the oldest quorum as GetMinedAndActiveCommitmentsUntilBlock
// returned quorums in reversed order. This pop and later push can only work ONCE, but we rely on the
Expand All @@ -229,6 +232,16 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre
}
}

if (!qcIndexedHashes.empty()) {
for (const auto& q : qcIndexedHashes) {
auto& v = qcHashes[q.first];
for (const auto& qq : q.second) {
v.emplace_back(qq.second);
hashCount++;
}
}
}

std::vector<uint256> qcHashesVec;
qcHashesVec.reserve(hashCount);

Expand Down
3 changes: 3 additions & 0 deletions src/hdchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ void CHDChain::DeriveChildExtKey(uint32_t nAccountIndex, bool fInternal, uint32_
changeKey.Derive(extKeyRet, nChildIndex);

#ifdef ENABLE_WALLET
// We should never ever update an already existing key_origin here
assert(!metadata.has_key_origin);
assert(metadata.key_origin.path.empty());
metadata.key_origin.path.push_back(44 | 0x80000000);
metadata.key_origin.path.push_back(Params().ExtCoinType() | 0x80000000);
metadata.key_origin.path.push_back(nAccountIndex | 0x80000000);
Expand Down
15 changes: 0 additions & 15 deletions src/masternode/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,6 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
// initiated from another node, so skip it too.
if (!pnode->CanRelay() || (fMasternodeMode && pnode->fInbound)) continue;

// QUICK MODE (REGTEST ONLY!)
if(Params().NetworkIDString() == CBaseChainParams::REGTEST)
{
if (nCurrentAsset == MASTERNODE_SYNC_BLOCKCHAIN) {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::GETSPORKS)); //get current network sporks
SwitchToNextAsset(connman);
} else if (nCurrentAsset == MASTERNODE_SYNC_GOVERNANCE) {
SendGovernanceSyncRequest(pnode, connman);
SwitchToNextAsset(connman);
}
connman.ReleaseNodeVector(vNodesCopy);
return;
}

// NORMAL NETWORK MODE - TESTNET/MAINNET
{
if ((pnode->HasPermission(PF_NOBAN) || pnode->m_manual_connection) && !netfulfilledman.HasFulfilledRequest(pnode->addr, strAllow)) {
netfulfilledman.RemoveAllFulfilledRequests(pnode->addr);
Expand Down
4 changes: 2 additions & 2 deletions src/qt/res/dash-qt-res.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ IDI_ICON2 ICON DISCARDABLE "icons/dash_testnet.ico"
#include <windows.h> // needed for VERSIONINFO
#include "../../clientversion.h" // holds the needed client version information

#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR

Expand Down
1 change: 1 addition & 0 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const QStringList historyFilter = QStringList()
<< "importmulti"
<< "signmessagewithprivkey"
<< "signrawtransactionwithkey"
<< "upgradetohd"
<< "walletpassphrase"
<< "walletpassphrasechange"
<< "encryptwallet";
Expand Down
6 changes: 3 additions & 3 deletions src/test/util_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,9 @@ BOOST_AUTO_TEST_CASE(test_FormatSubVersion)
std::vector<std::string> comments2;
comments2.push_back(std::string("comment1"));
comments2.push_back(SanitizeString(std::string("Comment2; .,_?@-; !\"#$%&'()*+/<=>[]\\^`{|}~"), SAFE_CHARS_UA_COMMENT)); // Semicolon is discouraged but not forbidden by BIP-0014
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()),std::string("/Test:0.9.99.0/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments),std::string("/Test:0.9.99.0(comment1)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2),std::string("/Test:0.9.99.0(comment1; Comment2; .,_?@-; )/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()),std::string("/Test:9.99.0/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments),std::string("/Test:9.99.0(comment1)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2),std::string("/Test:9.99.0(comment1; Comment2; .,_?@-; )/"));
}

BOOST_AUTO_TEST_CASE(test_ParseFixedPoint)
Expand Down
13 changes: 11 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,17 @@ void CWallet::DeriveNewChildKey(WalletBatch &batch, CKeyMetadata& metadata, CKey

// derive child key at next index, skip keys already known to the wallet
CExtKey childKey;
CKeyMetadata metadataTmp;
uint32_t nChildIndex = fInternal ? acc.nInternalChainCounter : acc.nExternalChainCounter;
do {
hdChainTmp.DeriveChildExtKey(nAccountIndex, fInternal, nChildIndex, childKey, metadata);
// NOTE: DeriveChildExtKey updates metadata, use temporary structure to make sure
// we start with the original (non-updated) data each time.
metadataTmp = metadata;
hdChainTmp.DeriveChildExtKey(nAccountIndex, fInternal, nChildIndex, childKey, metadataTmp);
// increment childkey index
nChildIndex++;
} while (HaveKey(childKey.key.GetPubKey().GetID()));
metadata = metadataTmp;
secretRet = childKey.key;

CPubKey pubkey = secretRet.GetPubKey();
Expand Down Expand Up @@ -5037,7 +5042,9 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b
std::unique_ptr<WalletDatabase> database = CreateWalletDatabase(wallet_path);

try {
return database->Verify(error_string);
if (!database->Verify(error_string)) {
return false;
}
} catch (const fs::filesystem_error& e) {
error_string = Untranslated(strprintf("Error loading wallet %s. %s", location.GetName(), fsbridge::get_filesystem_error_message(e)));
return false;
Expand All @@ -5048,6 +5055,8 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b
if (!tempWallet->AutoBackupWallet(wallet_path, error_string, warnings) && !error_string.original.empty()) {
return false;
}

return true;
}

std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain, const WalletLocation& location, bilingual_str& error, std::vector<bilingual_str>& warnings, uint64_t wallet_creation_flags)
Expand Down
Loading

0 comments on commit e66d539

Please sign in to comment.