Skip to content

Commit

Permalink
Merge pull request #4856 from PastaPastaPasta/rc5-backports
Browse files Browse the repository at this point in the history
[18.x] backport: backports for rc5 and bump
  • Loading branch information
UdjinM6 authored May 30, 2022
2 parents e66d539 + 07249a8 commit 5d32741
Show file tree
Hide file tree
Showing 13 changed files with 367 additions and 265 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 18)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 4)
define(_CLIENT_VERSION_RC, 5)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2021)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
13 changes: 13 additions & 0 deletions depends/patches/qt/fix_limits_header.patch
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ Upstream commits:
+#include <limits>
+
QT_BEGIN_NAMESPACE


--- old/qtbase/src/tools/moc/generator.cpp
+++ new/qtbase/src/tools/moc/generator.cpp
@@ -42,6 +42,7 @@

#include <math.h>
#include <stdio.h>
+#include <limits>

#include <private/qmetaobject_p.h> //for the flags.
#include <private/qplugin_p.h> //for the flags.

4 changes: 2 additions & 2 deletions doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Run the following commands to install required packages:

##### Debian/Ubuntu:
```bash
$ sudo apt-get install curl build-essential libtool autotools-dev automake pkg-config python3 bsdmainutils
$ sudo apt-get install curl build-essential libtool autotools-dev automake pkg-config python3 bsdmainutils bison
```

##### Fedora:
Expand Down Expand Up @@ -158,4 +158,4 @@ If your user is in the `staff` group the limit can be raised with:

The change will only affect the current shell and processes spawned by it. To
make the change system-wide, change `datasize-cur` and `datasize-max` in
`/etc/login.conf`, and reboot.
`/etc/login.conf`, and reboot.
2 changes: 1 addition & 1 deletion src/llmq/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static constexpr std::array<LLMQParams, 10> available_llmqs = {

.signingActiveQuorumCount = 4, // just a few ones to allow easier testing

.keepOldConnections = 4,
.keepOldConnections = 5,
.recoveryMembers = 6,
},

Expand Down
18 changes: 12 additions & 6 deletions src/llmq/snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ void CQuorumRotationInfo::ToJson(UniValue& obj) const
mnListDiffAtHMinus4C.value().ToJson(objdiff4c);
obj.pushKV("mnListDiffAtHMinus4C", objdiff4c);
}

UniValue hlists(UniValue::VARR);
for (const auto& h : lastQuorumHashPerIndex) {
hlists.push_back(h.ToString());
UniValue hqclists(UniValue::VARR);
for (const auto& qc : lastCommitmentPerIndex) {
UniValue objqc;
qc.ToJson(objqc);
hqclists.push_back(objqc);
}
obj.pushKV("lastQuorumHashPerIndex", hlists);
obj.pushKV("lastCommitmentPerIndex", hqclists);

UniValue snapshotlist(UniValue::VARR);
for (const auto& snap : quorumSnapshotList) {
Expand Down Expand Up @@ -296,7 +297,12 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat
std::vector<std::pair<int, const CBlockIndex*>> qdata = quorumBlockProcessor->GetLastMinedCommitmentsPerQuorumIndexUntilBlock(llmqType, blockIndex, 0);

for (const auto& obj : qdata) {
response.lastQuorumHashPerIndex.push_back(obj.second->GetBlockHash());
uint256 minedBlockHash;
llmq::CFinalCommitmentPtr qc = llmq::quorumBlockProcessor->GetMinedCommitment(llmqType, obj.second->GetBlockHash(), minedBlockHash);
if (qc == nullptr) {
return false;
}
response.lastCommitmentPerIndex.push_back(*qc);

int quorumCycleStartHeight = obj.second->nHeight - (obj.second->nHeight % llmqParams.dkgInterval);
snapshotHeightsNeeded.insert(quorumCycleStartHeight - cycleLength);
Expand Down
12 changes: 7 additions & 5 deletions src/llmq/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <evo/evodb.h>
#include <evo/simplifiedmns.h>
#include <llmq/commitment.h>
#include <llmq/params.h>
#include <saltedhasher.h>
#include <serialize.h>
Expand Down Expand Up @@ -114,7 +115,7 @@ class CQuorumRotationInfo
std::optional<CQuorumSnapshot> quorumSnapshotAtHMinus4C;
std::optional<CSimplifiedMNListDiff> mnListDiffAtHMinus4C;

std::vector<uint256> lastQuorumHashPerIndex;
std::vector<llmq::CFinalCommitment> lastCommitmentPerIndex;
std::vector<CQuorumSnapshot> quorumSnapshotList;
std::vector<CSimplifiedMNListDiff> mnListDiffList;

Expand Down Expand Up @@ -145,8 +146,8 @@ class CQuorumRotationInfo
::Serialize(s, mnListDiffAtHMinus4C.value());
}

WriteCompactSize(s, lastQuorumHashPerIndex.size());
for (const auto& obj : lastQuorumHashPerIndex) {
WriteCompactSize(s, lastCommitmentPerIndex.size());
for (const auto& obj : lastCommitmentPerIndex) {
::Serialize(s, obj);
}

Expand Down Expand Up @@ -177,8 +178,9 @@ class CQuorumRotationInfo
size_t cnt = ReadCompactSize(s);
for (size_t i = 0; i < cnt; i++) {
uint256 hash;
::Unserialize(s, hash);
lastQuorumHashPerIndex.push_back(std::move(hash));
CFinalCommitment qc;
::Unserialize(s, qc);
lastCommitmentPerIndex.push_back(std::move(qc));
}

cnt = ReadCompactSize(s);
Expand Down
14 changes: 14 additions & 0 deletions src/llmq/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,17 @@ bool CLLMQUtils::IsDIP0024Active(const CBlockIndex* pindex)
return VersionBitsState(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024, llmq_versionbitscache) == ThresholdState::ACTIVE;
}

bool CLLMQUtils::IsInstantSendLLMQTypeShared()
{
if (Params().GetConsensus().llmqTypeInstantSend == Params().GetConsensus().llmqTypeChainLocks ||
Params().GetConsensus().llmqTypeInstantSend == Params().GetConsensus().llmqTypePlatform ||
Params().GetConsensus().llmqTypeInstantSend == Params().GetConsensus().llmqTypeMnhf) {
return true;
}

return false;
}

uint256 CLLMQUtils::DeterministicOutboundConnection(const uint256& proTxHash1, const uint256& proTxHash2)
{
// We need to deterministically select who is going to initiate the connection. The naive way would be to simply
Expand Down Expand Up @@ -754,6 +765,9 @@ bool CLLMQUtils::IsQuorumTypeEnabledInternal(Consensus::LLMQType llmqType, const
{
case Consensus::LLMQType::LLMQ_TEST_INSTANTSEND:
case Consensus::LLMQType::LLMQ_50_60: {
if (IsInstantSendLLMQTypeShared()) {
break;
}
bool fDIP0024IsActive = optDIP0024IsActive.has_value() ? *optDIP0024IsActive : CLLMQUtils::IsDIP0024Active(pindex);
if (fDIP0024IsActive) {
bool fHaveDIP0024Quorums = optHaveDIP0024Quorums.has_value() ? *optHaveDIP0024Quorums
Expand Down
1 change: 1 addition & 0 deletions src/llmq/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class CLLMQUtils
static Consensus::LLMQType GetInstantSendLLMQType(const CBlockIndex* pindex);
static Consensus::LLMQType GetInstantSendLLMQType(bool deterministic);
static bool IsDIP0024Active(const CBlockIndex* pindex);
static bool IsInstantSendLLMQTypeShared();

/// Returns the state of `-llmq-data-recovery`
static bool QuorumDataRecoveryEnabled();
Expand Down
10 changes: 10 additions & 0 deletions src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) :
ui->setupUi(this);

ui->showAddressQRCode->setIcon(QIcon());
#ifndef USE_QRCODE
ui->showAddressQRCode->setEnabled(false);
#endif

switch(mode)
{
Expand Down Expand Up @@ -110,6 +113,9 @@ AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) :
QAction *editAction = new QAction(tr("&Edit"), this);
QAction *showAddressQRCodeAction = new QAction(tr("&Show address QR code"), this);
deleteAction = new QAction(ui->deleteAddress->text(), this);
#ifndef USE_QRCODE
showAddressQRCodeAction->setEnabled(false);
#endif

// Build context menu
contextMenu = new QMenu(this);
Expand Down Expand Up @@ -269,13 +275,17 @@ void AddressBookPage::selectionChanged()
break;
}
ui->copyAddress->setEnabled(true);
#ifdef USE_QRCODE
ui->showAddressQRCode->setEnabled(true);
#endif
}
else
{
ui->deleteAddress->setEnabled(false);
ui->copyAddress->setEnabled(false);
#ifdef USE_QRCODE
ui->showAddressQRCode->setEnabled(false);
#endif
}
}

Expand Down
Loading

0 comments on commit 5d32741

Please sign in to comment.