Skip to content

Commit 0706a79

Browse files
committed
Merge #2678: [Backport] 5.4.0 backports
c9b1909 [net] Remove assert(nMaxInbound > 0) (MarcoFalke) d629df0 [Refactor] Add ReloadMapSeen function to reload "seen" votes (random-zebra) 7427d44 test: add coverage for the incremental budget sync flow. (furszy) 241627c Budget incremental sync: do not clear seen maps when relay status is reset. (furszy) 61477a5 [Refactor] Budget: check mn-enabled/vote-time before adding to mapSeen (random-zebra) 318fc7c Budget: limit orphan votes maps to 10k entries max. (furszy) 55f3ef9 [Refactor] Simplify CBudgetManager::CheckOrphanVotes() Github-Pull: #2659 Rebased-From: d04f5be (random-zebra) e5ad197 Budget: Decouple the all-in-one `Budget::Sync()` into two functions: (1) single items sync requests and (2) full budget sync requests. (furszy) 5fd74e4 tiertwo sync: fix orphans votes maps linking single prop/bud hash to a single vote, discarding the previous stored item every time that a new orphan arrives. Blocking any follow-up reception of the orphan votes that were discarded, prohibiting its connection forever. (furszy) 4cdb587 test: add coverage for single proposal sync based on an orphan proposal vote reception and single finalization sync based on an orphan finalization vote. (furszy) 979bb2c budget: generalize budget full sync items relay. (furszy) 736363d Budget sync: Remove useless extra item sync p2p msgs roundtrip (no need to broadcast an inv if the peer is asking for the item directly..) and stop walking through the two maps (budgets and proposals), locking their mutexes, when the peer is requesting a single proposal/budfin. (furszy) fe6fe56 Tiertwo: do not block peers if they requested a single proposal or single budget finalization. (furszy) ebbef96 masternodesync: connect the not-connected ProcessSyncStatusMsg. (furszy) 281c061 masternodesync: fix extra `RequestedMNAttempt` increment in the sporks flow. (furszy) d95fb9b masternodesync: decrease mnw sync threshold to 4 peers. (furszy) cfc15b6 masternodesync: reset last budget item time before start syncing it. (furszy) 94f1c52 masternodesync: re-format peer version check. (furszy) 946444e Fix ignoring tx data requests when fPauseSend is set on a peer (Matt Corallo) 10cedd0 GUI governance: add missing strings to the translations process. (furszy) dc10e17 GUI governance: fix proposal name and URL size limit validation. (furszy) 594acc6 [GUI] Fix governance nav button hover css (Fuzzbawls) fd8d844 GUI: governance, IBD check before opening the proposal creation wizard. (furszy) 33f5dd8 [GUI] Fix proposal tooltip menu location skewing (Fuzzbawls) 55619cc GUI: Differentiate Budget payment transaction records from MNs block reward records. (furszy) 139596e Refactor: Move MN block reward to chainparams. (furszy) 1a55752 GUI: Fix remaining item naming conflicts (Fuzzbawls) 5925150 GUI: Use sorted layout/spacer names in governance UIs (Fuzzbawls) dfeb3c7 [GUI] Don't show UTXO locking options for shield notes (Fuzzbawls) 6dd96b9 [BUG] GUI: invalid locking of shield notes in coin control Github-Pull: #2661 Rebased-From: d281cde (random-zebra) 1d7f86e Refactor: remove circ depend. primitives/transaction <-> script/standard (random-zebra) cb3a5b4 Refactor: remove circ dependency checkpoints <-> chainparams (random-zebra) e02e70e Refactor: remove circ dependency checkpoints <-> validation (random-zebra) e1a5d0a Break circular dependency: init -> * -> init by extracting shutdown.h (random-zebra) 2d29c42 Cleanup: remove unused init.h includes Github-Pull: #2646 Rebased-From: b09422f (random-zebra) 95c7f2e cleanup: fix header includes sorting and copy Github-Pull: #2642 Rebased-From: 525c2e7 (random-zebra) fdd4045 scripted-diff: replace boost::optional with Optional<> wrapper (random-zebra) Pull request description: List of PRs included: * #2642 * #2646 * #2643 * #2644 * #2661 * #2662 * #2663 * #2671 * #2664 * #2670 * #2665 * #2672 * #2659 * #2677 * #2682 ACKs for top commit: random-zebra: ACK c9b1909 Fuzzbawls: ACK c9b1909 Tree-SHA512: 34871cd7d527302ec6bd3924f4ca4322116952c8b69317831b2652165fbf1c566f893dace9a2998823c6781c4e578c2eeb9bc367fa39f632235aee7f45a68306
2 parents 08c6da7 + c9b1909 commit 0706a79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+825
-548
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ set(SERVER_SOURCES
230230
./src/rpc/server.cpp
231231
./src/script/sigcache.cpp
232232
./src/script/ismine.cpp
233+
./src/shutdown.cpp
233234
./src/sporkdb.cpp
234235
./src/timedata.cpp
235236
./src/torcontrol.cpp

src/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ BITCOIN_CORE_H = \
261261
script/standard.h \
262262
script/script_error.h \
263263
serialize.h \
264+
shutdown.h \
264265
span.h \
265266
spork.h \
266267
sporkdb.h \
@@ -374,6 +375,7 @@ libbitcoin_server_a_SOURCES = \
374375
rpc/server.cpp \
375376
script/sigcache.cpp \
376377
script/ismine.cpp \
378+
shutdown.cpp \
377379
sporkdb.cpp \
378380
timedata.cpp \
379381
torcontrol.cpp \

src/blocksignature.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2020 The PIVX developers
1+
// Copyright (c) 2017-2021 The PIVX developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -7,6 +7,23 @@
77
#include "script/standard.h"
88
#include "zpivchain.h"
99

10+
static bool GetKeyIDFromUTXO(const CTxOut& utxo, CKeyID& keyIDRet)
11+
{
12+
std::vector<valtype> vSolutions;
13+
txnouttype whichType;
14+
if (utxo.scriptPubKey.empty() || !Solver(utxo.scriptPubKey, whichType, vSolutions))
15+
return false;
16+
if (whichType == TX_PUBKEY) {
17+
keyIDRet = CPubKey(vSolutions[0]).GetID();
18+
return true;
19+
}
20+
if (whichType == TX_PUBKEYHASH || whichType == TX_COLDSTAKE) {
21+
keyIDRet = CKeyID(uint160(vSolutions[0]));
22+
return true;
23+
}
24+
return false;
25+
}
26+
1027
bool SignBlockWithKey(CBlock& block, const CKey& key)
1128
{
1229
if (!key.Sign(block.GetHash(), block.vchBlockSig))
@@ -21,15 +38,15 @@ bool SignBlock(CBlock& block, const CKeyStore& keystore)
2138
if (block.IsProofOfWork()) {
2239
bool fFoundID = false;
2340
for (const CTxOut& txout : block.vtx[0]->vout) {
24-
if (!txout.GetKeyIDFromUTXO(keyID))
41+
if (!GetKeyIDFromUTXO(txout, keyID))
2542
continue;
2643
fFoundID = true;
2744
break;
2845
}
2946
if (!fFoundID)
3047
return error("%s: failed to find key for PoW", __func__);
3148
} else {
32-
if (!block.vtx[1]->vout[1].GetKeyIDFromUTXO(keyID))
49+
if (!GetKeyIDFromUTXO(block.vtx[1]->vout[1], keyID))
3350
return error("%s: failed to find key for PoS", __func__);
3451
}
3552

0 commit comments

Comments
 (0)