Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify GetNextWorkRequired to set Target Limit correctly #915

Merged
merged 2 commits into from
Aug 9, 2019

Conversation

CaveSpectre11
Copy link

GetNextWorkRequired() was not setting the work required properly on the first Proof of Stake block. The code section to cap the work at the bnTargetLimit wasn't called on that first block, but rather on the second Proof of Stake block.

The end result is that the first PoS block uses the difficulty from the PoW, rather than capping it at the target limit; with the second PoS block capping it at the target limit:

uint256 bnTargetLimit = (~uint256(0) >> 24);

Creating a difficulty problem should the final PoW difficulty be greater than bnTargetLimit.


This code has been tested on an altcoin; and I can provide debug output demonstrating the shift of the TargetLimit to 00000FFFF the block after the first PoS block should it be desired.

@Mrs-X
Copy link

Mrs-X commented Jun 20, 2019

Hmh, I have to check this more closely, but on a quick look LoadExternalBlockFile() would fail because ProcessNewBlock() would fail because CheckWork()would fail because GetNextWorkRequired() would return a different nBitsRequired, thus if (block.nBits != nBitsRequired) would apply for the first PoW block.

@CaveSpectre11
Copy link
Author

Ok, my priority of getting a dev environment to test PIVX directly has increased.

Yes, that does appear to be the case on inspection (my initial issue was on the shift from PoW to PoS; but since this seems to be a potential reindex failure, it may not be innocuous to PIVX).

@CaveSpectre11
Copy link
Author

Running the test overnight. Have a fix coded up that I will also validate before pushing.

@CaveSpectre11
Copy link
Author

CaveSpectre11 commented Jun 21, 2019

@Mrs-X you are correct. Please see with the change in main.cpp. By placing the check inside the failure condition; the extra check doesn't add any processing speed to the general block processing (since they won't enter that line of code. Nor will existing forks that port this code over. For existing forks that port this code over and end up with the same issue (on their historical first PoS block), the conditional inside the failure code will serve as a hook for their own custom modification to get past their block.

And, forks that have not hit their PoS stage, or new coins being developed from the Pivx reference code, will not have to worry about getting stuck on their first PoS block.

From my debugging build:

2019-06-21 13:00:56 GetNextWorkRequired - pure:
        bnNew:          000000000532ea8748d8748d8748d8748d8748d8748d8748d8748d8748d8748d
2019-06-21 13:00:56 GetNextWorkRequired:
        bnNew:          000000000532ea8748d8748d8748d8748d8748d8748d8748d8748d8748d8748d
        bnTargetLimit:  000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
2019-06-21 13:00:56 CheckWork(): nbits=470117804, required=470102762
2019-06-21 13:00:56 CheckWork(): Accepting special block
2019-06-21 13:00:56 UpdateTip: new best=1c9121bf9329a6234bfd1ea2d91515f19cd96990725265253f4b164283ade5dd  height=259201 version=3  log2_work=55.779856  tx=367159  date=2016-08-17 02:40:14 progress=0.077175  cache=6335
2019-06-21 13:00:56 ProcessNewBlock : ACCEPTED Block 259201 in 72 milliseconds with size=959

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.
Might make sense to define variables somewhere to store those values for nTime and nBits, instead of using magic numbers.

@CaveSpectre11
Copy link
Author

Concept ACK.
Might make sense to define variables somewhere to store those values for nTime and nBits, instead of using magic numbers.

I considered that; but I opted against it specifically because of how unique that check is. Originally I was just checking for the block; but by checking nTime and nBits; that code should not pass if it's ported somewhere other than PIVX. This way it's obscure, and requires whomever ports the fix into their code base to understand exactly what they're doing, and exactly where they need to do it. If they have more than one block; it won't be obscured. If I was to define a variable, I would be compelled to define a vector and have it loop through the vector so it's a more portable).

But that's MHO; and I don't feel strongly about the opinion. I will pull it out into chainparams and define them if you wish.

@random-zebra
Copy link

I think those are valid arguments so, as far as I am concerned, this can remain as is.
Let's wait for other reviewers.

@Warrows
Copy link

Warrows commented Aug 1, 2019

I don't understand why you'd need a vector 🤔 In chainparams you could define two constants like NEXTWORK_BUG_BLOCKTIME = 1471401614 and NEXTWORK_BUG_NBITS = 0x1c056dac and use them in the test. This way you explicit what those numbers are without making the code much more complicated.
I think that's the best way to go about it.

@CaveSpectre11
Copy link
Author

CaveSpectre11 commented Aug 1, 2019

I don't understand why you'd need a vector 🤔

I'm going to try my best to lay out my position without too many tangents; but I can't make any promises :)

One thread that always runs in my coding style is reuse. It's everywhere in my current day job (basically 7 different forks of the code base I'm working on). This applies greatly to the whole crypto industry, as well. When I have something localized in a module, or a function, I'm more likely to opt for the quick route. When it extrapolates into more of a general or removed use, is where the reuse becomes more relevant. For example; 950 started with ValidateURL being local to the budget.cpp module. When it was suggested it be moved to utilities; the URL length became a relevant magic number; and thus I added it as a parameter to the function. So other callers from other uses may have different requirements for the URL length. Arguably, the hard coded "64" default in the header declaration could be made into a constant that's defined yet elsewhere; but going so far as to add the vectors to passable parameters in order for the URL content checks to be changed by the caller was a bit overkill. I did have that in mind while writing that code; choosing it such a way (the vector itself for example), so it would be an easy mod to pass in different search vectors into that routine ...should it be determined necessary for another use case.

So how this all applies to the subject at hand? I chose to use nbits and time, instead of block number; so that anyone forking pivx doesn't have a hole on that block; when they hit the block. It now has to hit the exact nbits at the exact time; which is already past. So the likelihood of another coins block being accepted is slim to none; and it's in the past as well so it shouldn't matter anyway since it's already deep in the accepted chain.

For Pivx; it was only one block affected. For others, it could be none, or many. That's when the "right" way to code that would be a vector that can cover 1 to many problem blocks. Yes, once again, a little overkill here. But I also argue that putting an exception to skip over a consensus problem into chainparams is too far disconnected from the problem to make it readable. If there was any reason that it would ever be relevant anywhere else in the code... then absolutely, a constant would be warranted.

Now, here's the parallel for Pivx specifically. For #814 to be handled properly, it needs to ignore the overmint in over a dozen blocks. Since it doesn't need to be anywhere else except ConnectBlock I would debate that it still belongs locally defined in main.cpp rather than chainparams. In the fork that I addressed the same issue as 814; it was only one effected block (and thus... coded with a magic number like this PR). For Pivx, however; and many forks, there is going to be a various number of blocks that need to be accounted for; and thus setting the framework of a vector that is populated for whatever a coin's specific instances are... becomes my recommended approach.

So with all that said... it's why I made the choices I did. I feel it's actually an appropriate use of magic numbers, and well contained in the location where it applies.

But, like most code style debates; I only casually date my code... I don't marry it, so if you guys agree "change it", your wish is my command.

@random-zebra
Copy link

For what is worth, I'm in line with these points:

But I also argue that putting an exception to skip over a consensus problem into chainparams is too far disconnected from the problem to make it readable.

I feel it's actually an appropriate use of magic numbers, and well contained in the location where it applies.

@Warrows
Copy link

Warrows commented Aug 2, 2019

Alright, I get your point and mostly agree. However, I still think magic numbers should be explicitly defined every time it's possible. So even if it's two lines above in main.cpp I'd like to see two constants defined for these numbers.

@CaveSpectre11
Copy link
Author

I still think magic numbers should be explicitly defined every time it's possible. So even if it's two lines above in main.cpp I'd like to see two constants defined for these numbers.

Compromise accepted. All set.

src/main.cpp Outdated Show resolved Hide resolved
Mrs-X
Mrs-X previously approved these changes Aug 5, 2019
Copy link

@Mrs-X Mrs-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan special processing for single blocks/transactions/whatever, but this seems to be the most reasonable way to do it.
utACK 59bff6f from my side.

@CaveSpectre11
Copy link
Author

Not a big fan special processing for single blocks/transactions/whatever,

Agreed. If the error case wasn't there already, I would have considered letting it be; But this way there's only extra processing when the block is headed down the failure path.

@random-zebra random-zebra added this to the 4.0.0 milestone Aug 6, 2019
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving it some more thought... it's much better to have these constants in chainparams.

Because, right now, this only works for MainNet.
TestNet sync will obviously halt at block 201.

@CaveSpectre11
Copy link
Author

TestNet sync will obviously halt at block 201.

Excellent point. Is there an explorer for regtest so I can get the info on block 251?

@Fuzzbawls
Copy link
Collaborator

Regtest is a non-persistent chain that is initialized from genesis on demand. Testnet has a BE though: https://testnet.pivx.link

@CaveSpectre11
Copy link
Author

Regtest is a non-persistent chain that is initialized from genesis on demand. Testnet has a BE though: https://testnet.pivx.link

Ok; regtest won't apply. testnet I had already pulled.

@CaveSpectre11
Copy link
Author

Set up for both testnet and mainnet to be covered; put stubs for regtest so regtest won't falter over the code if it ever ends up in it. I'll check travis and rebase in the morning.

src/chainparams.cpp Outdated Show resolved Hide resolved
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2bef330

@furszy furszy self-requested a review August 9, 2019 13:31
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2bef330

@random-zebra
Copy link

Merging...

@random-zebra random-zebra merged commit 2bef330 into PIVX-Project:master Aug 9, 2019
random-zebra added a commit that referenced this pull request Aug 9, 2019
2bef330 [Review] Move block identification to chainparams to support testnet also (Cave Spectre)
9294bbf Modify GetNextWorkRequired to set Target Limit correctly on first PoS block (CaveSpectre11)

Pull request description:

  GetNextWorkRequired() was not setting the work required properly on the first Proof of Stake block.  The code section to cap the work at the bnTargetLimit wasn't called on that first block, but rather on the second Proof of Stake block.

  The end result is that the first PoS block uses the difficulty from the PoW, rather than capping it at the target limit; with the second PoS block capping it at the target limit:

  `uint256 bnTargetLimit = (~uint256(0) >> 24);`

  Creating a difficulty problem should the final PoW difficulty be greater than bnTargetLimit.

  ---
  This code has been tested on an altcoin; and I can provide debug output demonstrating the shift of the TargetLimit to 00000FFFF the block after the first PoS block should it be desired.

ACKs for top commit:
  random-zebra:
    ACK 2bef330
  furszy:
    ACK [2bef330](2bef330)

Tree-SHA512: bd2702b645369dabe79a443f7776c61877f91d010ba6baa05767038c03d238b6e4a94f8e85121705776a7bab437e71a52ed762287d33f52fd441d8782e742c94
@CaveSpectre11 CaveSpectre11 deleted the patch-2 branch August 9, 2019 19:28
@random-zebra random-zebra modified the milestones: 4.0.0, 3.4.0 Aug 25, 2019
2a5A1Ghu1 referenced this pull request in VitaeTeam/Vitae Apr 21, 2020
* Merge #812: [Regtest][Tests][RPC] Regtest mode + Test suite.

fced4e26fe [Tests] fake_stake: reverse stake hash byte order (random-zebra)
a85cdad03c [Tests] fake_stake: use hashStake for kernel computation (random-zebra)
6aa5ddbff8 [Tests] fake_stake: remove random prevout from spending (random-zebra)
8e370da804 [RPC] add mint hashStake to listmintedzerocoins output (random-zebra)
0d865a8978 [Tests] fake_stake: use a copy for spendingPrevouts (random-zebra)
0f209b3da8 [Tests] fake_stake: docstrings and comments (random-zebra)
322ce79a67 [Tests] fake_stake: fix checksum computation (random-zebra)
7aae5b1e8b [Tests] fake_stake: fix empty spending_prevouts (random-zebra)
c7555e1b84 [Tests] fake_stake: collect prevouts from create_spam_block (random-zebra)
1d699432f2 [RPC] Add call 'getchecksumblock' (random-zebra)
2e7eacc4c4 [Tests] fix line separators in Test03 (random-zebra)
c6c81a7cd2 [Tests] fake_stake: test03 updated (random-zebra)
0d8cf5500d [Tests] remove trailing whitespace from README.md (random-zebra)
9302f5a046 [Tests] fake_stake: test01 & test02 updated (random-zebra)
e0efe4d530 [Tests] unique 'get_prevout' method for both pos and zpos stakes (random-zebra)
9318335525 [Tests] remove trailing whitespaces (random-zebra)
67284ce22a [RPC] add mint block height to 'listmintedzerocoins' (random-zebra)
d783229568 [Tests] get correct nStakeModifier (random-zebra)
78e838ee32 [Tests] fix solve_stake nTime / nStakeModifier (random-zebra)
a428c83609 PoS block creation uniqueness. (furszy)
dd07bd1a50 [Tests] fix proof of stake target in block class (random-zebra)
030e557b93 [Tests] fake_stake: fix test 01 block numbers (random-zebra)
fe54e9b92a [RPC] fix signrawtransaction hack to allow signing of spent inputs (random-zebra)
79e364354f regtest lastPoWBlock and zerocoin block start decreased to not waste lifetime waiting for the tests. (furszy)
42e9c01a85 More logging in block generation. (furszy)
0aa9bafbf4 fake stake test4 (furszy)
8315a42a7b pivx_fake_stake: test03 almost complete (random-zebra)
1ad11ad9f7 RPC createrawzerocoinstake: fix vout[0], add priv-key (random-zebra)
ad65ac4e0a REGTEST: Fix bug on GetModifier (random-zebra)
47f0503b19 RPC: hack MintToTxIn to allow spending an already spent zpiv on regtest (random-zebra)
3092cfc0c2 add empty output to createrawzerocoinstake (random-zebra)
c5a6a67349 log CWallet::MintToTxIn errors (random-zebra)
252f4ab43e pivx_fake_stake: zerocoin prevouts (random-zebra)
22769817ae GetModifier for regtest zPoS hardcoded to prev block stake modifier (furszy)
63bd40e064 pivx_fake_stake: test_spam method refactoring (random-zebra)
1df9240727 pivx_fake_stake: add test descriptions (random-zebra)
79e746eb3d zerocoin mint + spent (furszy)
9eea8837aa half test3 completed (furszy)
23236e7499 pivx_fake_stake: select test from command line (random-zebra)
44d2e9a1c2 pivx_fake_stake: get_prevouts (random-zebra)
1b27b90e8b pivx_fake_stake Test05 - update blockcount in forks (random-zebra)
88e0dc6442 pivx_fake_stake Test05 - more blocks fix (random-zebra)
bf3b732dc5 pivx_fake_stake Test05 - more blocks (random-zebra)
a25f2e84a2 pivx_fake_stake Test05 (random-zebra)
427f2f168b test05 completed, rejection of double spend coin stake input on the same block on main/forked chain (furszy)
3cbf43e7db test05 (furszy)
f7a48260c6 Add 'createrawzerocoinstake' method (random-zebra)
70d859e055 test_02 working good. (furszy)
ed63600142 PIVX_fake_stake: zerocoin tests (random-zebra)
07b981af88 no time validation for regtest (furszy)
47c2c65721 import bytes_to_hex on test_02 fix (furszy)
c02002bdd4 PIVX_fake_stake: fix coinstake out value (random-zebra)
35f09e5d21 submitblock assertion on test_02 (furszy)
d0c0dccff5 PIVX_fake_stake: fix coinbase nHeight merge (random-zebra)
2cf7ae1939 PIVX_fake_stake: fix txes in create_spam_block (random-zebra)
ef01bd8141 zPoS running on regtest :) (furszy)
5405d1ce2d Zerocoin fixed on regtest & PoS blocks generation fixes. (furszy)
158bd2b215 regtest PoS generate valid blocks (furszy)
71a3743108 Tests: fixup a conditional check for python block creation (Fuzzbawls)
b3950ff436 Tests: update nothingatstake test file (Fuzzbawls)
f40f576eb3 stakemodifier fixed for regtest (furszy)
80a2aec5df Tests: serialize block signature when present (Fuzzbawls)
9cec3bd2f5 RPC: hack signrawtransaction to allow signing an already spent input (Fuzzbawls)
5c0f0b99ed WIP: port the test for "fake stake" issue test (Fuzzbawls)
b074cd0e42 RPC: return the used stake modifier in getblock (Fuzzbawls)
1ffc443ba6 Regtest: mine the correct version blocks (Fuzzbawls)
3d588ead42 Tests: Remove whitespace in default conf file (Fuzzbawls)
ebdc552408 Fixup the walletdump command and python test (Fuzzbawls)
37b29c7e61 [Tests] Add Basic BIP38 RPC functionality test (Fuzzbawls)
c2cfff0a23 Tests: add size field to test json (Fuzzbawls)
2155506247 Add rpm contrib files (Fuzzbawls)
4e62dd9ee8 Main: reject non-final transactions using nLocktime from entering the mempool. (Fuzzbawls)
4c71b5694a [RPC] Ensure Tx/Budget input hashes are of the proper length (Fuzzbawls)
7d37c1c207 [RPC] Update and harden many raw transaction RPC commands (Fuzzbawls)
262f76a9d0 [RPC] Error early when block doesn't start with a coinbase transaction (Fuzzbawls)
7e0476b25a RPC: Add waitforblock/waitfornewblock/waitforblockheight (Fuzzbawls)
22bfe7ea2c [Tests] Initial update for regression test suite tests (Fuzzbawls)
93fd9f0501 Update block generation code to enable regtest mode (Fuzzbawls)
25fc43698b Build: add test runner packaging to configure (Fuzzbawls)

Tree-SHA512: 09bcd3c727eb85103451cf971e0bc3a27eca205318ebb6c600a26ddc97f58ef456aa6768c9e94fd5c484da5071887e5b50c2bcf90318cfe2c9178c0c746a408b

# Conflicts:
#	Makefile.am
#	configure.ac
#	qa/pull-tester/run-bitcoind-for-test.sh.in
#	qa/pull-tester/tests-config.sh.in
#	qa/rpc-tests/README.md
#	qa/rpc-tests/proxy_test.py
#	qa/rpc-tests/python-bitcoinrpc/bitcoinrpc/__init__.py
#	qa/rpc-tests/python-bitcoinrpc/bitcoinrpc/authproxy.py
#	qa/rpc-tests/python-bitcoinrpc/setup.py
#	qa/rpc-tests/util.py
#	qa/rpc-tests/util.sh
#	qa/rpc-tests/wallet.py
#	src/Makefile.qt.include
#	src/main.cpp
#	src/miner.cpp
#	src/pow.cpp
#	src/rpcmining.cpp
#	src/rpcrawtransaction.cpp
#	src/rpcwallet.cpp
#	src/stakeinput.cpp
#	src/wallet.cpp
#	test/util/bitcoin-util-test.py
#	test/util/data/blanktxv1.json
#	test/util/data/tt-delin1-out.json
#	test/util/data/tt-delout1-out.json
#	test/util/data/tt-locktime317000-out.json
#	test/util/data/txcreate1.json
#	test/util/data/txcreate2.json
#	test/util/data/txcreatescript1.json

* Fixed compile error

* Merge #803: [NET] Invalid blocks from forks stored on disk fix + blocks DoS spam filter.

61a6ea7558 AcceptBlock() for-each loops variables moved to const (furszy)
e1974d23f3 AcceptBlock() check for double spent serials only on main chain flag. (furszy)
babdfb0f26 remove extra debug lines in AcceptBlock (random-zebra)
a9178bc6e0 AcceptBlock: contextual zcspend check on main chain (random-zebra)
0d49570f20 AcceptBlock() block stored log removed (furszy)
b74921756a Fix bug on AcceptBlock when pindex is null (random-zebra)
45883b9fb6 AcceptBlock() invalid isBlockFromFork flag (furszy)
6a16049dfa AcceptBlock() reject blocks double spending the coin stake input inside the same block (furszy)
da1b6836a5 block spam filter, validate non null nodestate (furszy)
84de55a11c AcceptBlock() isBlockFromFork flag not contemplating prev blocks from forks fixed (furszy)
4219339521 AcceptBlock() - not accept blocks from a forked chain that exceed the max reorg limit (furszy)
47759e113c AcceptBlock(), reject invalid PoS stake (furszy)
e237823000 validate non null pfrom on blockspamfilter check (furszy)
c2e5459dff AcceptBlock(), serial double spend on the same block validation (furszy)
3f5091986c zPoS validations of forked chains before store them + inputs check on prev split main chain (furszy)
64804b4bee Invalid blocks from forks stored on disk fix + blocks DoS spam filter. (furszy)

Tree-SHA512: 6c5a7fda3eb81dc8b030c9ba624e5101f552ef9cecc839a79237b705c314171c0e9c66ecd8bfd207081c6759272140cf3bdf0da7af6ac4695f0c09b74fb1ba45

# Conflicts:
#	src/main.cpp

* Merge #817: [Wallet] Fix segfault with runtime -disablewallet

bae276a Don't bother checking obfuscation messages (Fuzzbawls)
837f25f [Wallet] Fix segfault with runtime -disablewallet (Fuzzbawls)

Tree-SHA512: a8dd502897cdc82f206a1805f7b1ae51960344c3fa32640c9dc6c271768e7db718bc2f57034e8fabfd1b402e589e531419d1e8af8a25eee71d89a6b79ce3a679

# Conflicts:
#	src/main.cpp

* Merge #821: [RPC] Fixup signrawtransaction on regtest

e87231b62b [RPC] Fixup signrawtransaction on regtest (Fuzzbawls)

Tree-SHA512: 1e1b9c25abf9b2406b5065b0b348100fe60e13a258d874d681c6df4094a86ecf3e226e39e6c3e1d8b07fa853634c35249f65652641d13741c426c4c9053e7b36

* Merge #822: [Tests] Integrate fake stake tests into parent test suite

52b509468f Remove stale qtum python scripts (Fuzzbawls)
c0d8dcb8c9 [Tests] Integrate fake stake tests into parent test suite (Fuzzbawls)

Tree-SHA512: b0f9d559b3a8a4d0da3d400dfbe57fa15933a3c569732c4d7d10e147e7d5cd5f70a6f5231c862e4ca5f7f3efdb2de5890fe4755cbee5c41b00a4ab34a015c2e4

* Merge #826: [Qt] Fix a windows only crash when r-clicking a proposal

0015d08c75 [Qt] Fix a windows only crash when r-clicking a proposal (warrows)

Tree-SHA512: 7e9507e4ffbbca6b41d9c9b18d31f7ebfddf01d5abbfd083b2fcbf6d7d398c20391bdc4fc4903c8d1b338d0c78929920264eb6352bbcaa9b2baf1c11df965cc5

* Merge #838: [RPC][Test] spendrawzerocoin + wrapped serials functional test

c3352f0dbd [Test] add 'zerocoin' to the list of good prefixes in test_runner (random-zebra)
78f1a241ae [Test] wrapped serials: use multiple random values for K (random-zebra)
bf0cf52d37 [RPC] fix spendrawzerocoin string parsing (random-zebra)
025d2855f9 [Tests] Add Wrapping Serials Test (random-zebra)
7373704842 [RPC] Add spendrawzerocoin (random-zebra)

Tree-SHA512: 707c015b2b40bf6f34999aa7b1a62b1e1be4b8c4d9b0e830ed78ebf2f74a362883708d6204cfadd95f5d6520feb19fc1ba4b8a12549c6cc40c40dc2ab56fb2e9

* Merge #837: [Zerocoin][UNIT TEST][RPC] Wrapped serials.

6eff5fa970 fix zPIV supply recalculation (random-zebra)
2676ca3626 newline character added to recalculate wrapped serials supply logging (furszy)
da43659dd2 Initialize nSupplyBeforeFakeSerial to 0 in TestNet and RegTest (random-zebra)
c46de31dc4 Fix Wrapped Serials inflated zPIV supply recalculation (random-zebra)
13691861f8 zerocoin contextual spend check log invalid serials (furszy)
0240f27e5f log rejection serial block height (furszy)
ab6a134f2b invalid fake serial rejection (furszy)
010d03591c zpiv recalculation moved in init and added in connectblock (furszy)
bd6b26b466 fix tabs in SoK (random-zebra)
41a2bcca29 fix bitSize typo in bignum for openssl (random-zebra)
29c1791815 inflation methods moved to cpp (furszy)
027c9ffcb6 wrapped serial inflation trigger recalculation (furszy)
a3d725a42a Zerocoin supply, wrapped serials inflation + some minor modifications (furszy)
b3660cbb2e SoK invalid range check. (furszy)
ad3a3c717b remove tab spaces (furszy)
ed15e21eb8 Fix isBlockBetweenFakeSerialAttackRange check (random-zebra)
8e7cf5ab4e Fix IsValidCommitmentToCoinRange check (random-zebra)
a936e03c22 getserials ambiguous Pair constructor in bitsize blocking clang compilation fix (furszy)
bd529a0f6e [UNIT TEST] wrapped serial coinSpend check (furszy)
1217868777 [RPC] Add getserials method (random-zebra)
9fe8dabc4f fix isValidSerial always true check (random-zebra)
913e48cda8 wrapped range fix (furszy)
46a5231574 wrapped serials check in acceptToMemPool method (furszy)
edfdb4c30b prints in console commented (furszy)
18e55ed179 fake serials attack enforcement (furszy)

Tree-SHA512: fe6eaf26257c25377982d44ff1cdd839edf6f71daa5607fc98397b4a3fcd26ae78db54c781038e4f9ff8a7ad1d460ce109909184852bb620435e10dcba6a638c

# Conflicts:
#	src/init.cpp
#	src/libzerocoin/bignum.h
#	src/main.cpp
#	src/main.h
#	src/primitives/zerocoin.h

* Fixed compile error

* Merge #840: [QT] cleanup, remove old trading dialog form

56dd114 cleanup, remove trading dialog form (furszy)

Tree-SHA512: 824547803f5b854c51c22ca87149608725036c5ddee1922ceef7bdc71fcaeac440e77da3c51f7fe44b29269a57990d5ddfd674ca52b4de6ebd6fd36f847f55e8

# Conflicts:
#	src/qt/forms/tradingdialog.ui

* Merge #847: Fix to display missing clock5.png tx image

dc168d1 fix to display missing clock5.png tx image (joeuhren)

Tree-SHA512: d10828e76ad1b2e034b013a1c3cac9cf79dfdc642a11d1a6493d615a19982d50fc09343b3b39171ba7c25202f29ed0532f1bc539c42fbdad37a19e58adcc48b1

* Merge #815: [Doc] Update release notes with forthcoming 3.2.0 changes

f86890b256 more notes for RPC commands and gitian build script (Fuzzbawls)
c39053bb73 Add more release notes (Fuzzbawls)
68e3e925b5 Initial release notes for v3.2.0 (Fuzzbawls)

Tree-SHA512: de06f5d6d913d21cd0ac329ff5a69e915f3ab5afae82ed471e496e2d718562a3a2cf010d20279f76f8ba6397394cfb21ba6cbe9da1385eed36d4f07c00f29161

# Conflicts:
#	doc/release-notes.md

* Fixed coin name

* In progress multi-input witness generation.

# Conflicts:
#	src/accumulators.cpp
#	src/accumulators.h
#	src/chainparams.cpp
#	src/kernel.cpp
#	src/miner.cpp
#	src/wallet.cpp

* more progress

* More progress on caching spend data.

# Conflicts:
#	src/Makefile.am
#	src/init.cpp
#	src/miner.cpp
#	src/rpcblockchain.cpp
#	src/test/zerocoin_implementation_tests.cpp
#	src/wallet.cpp
#	src/wallet.h
#	src/walletdb.h
#	src/zpiv/zpivtracker.cpp
#	src/zpiv/zpivtracker.h
#	src/zpiv/zpivwallet.cpp
#	src/zpiv/zpivwallet.h
#	src/zpivtracker.cpp
#	src/zpivtracker.h
#	src/zpivwallet.cpp
#	src/zpivwallet.h
#	src/zvittracker.cpp
#	src/zvittracker.h
#	src/zvitwallet.cpp
#	src/zvitwallet.h

* Fixed compile error

* Fixed compile error

* Remove security level from zerocoin spending.

# Conflicts:
#	src/qt/privacydialog.cpp
#	src/rpcwallet.cpp
#	src/wallet.cpp

* prevent infinate loop in miner

* ensure override is set for GetSerialHash()

* Include dependent headers in stakeinput.h

* set the accumulator start height when initializing the witness

* remove spam log output in stakeTargetHit()

* add benchmarking to zPIV spend inner functions

* fully initialize member variables when setting the witness data

* don't duplicate function call

* benchmark fixup

* don't hold cd_spendcache for the entire loop

* Remove security level from UI

* Add clearspendcache RPC command

# Conflicts:
#	src/rpcserver.cpp
#	src/rpcserver.h

* re-add zpivchain.h (fixes merge conflict error)

# Conflicts:
#	src/Makefile.am
#	src/init.cpp
#	src/test/zerocoin_implementation_tests.cpp
#	src/zvit/zvitwallet.cpp

* more work on pre-computing

# Conflicts:
#	src/wallet.cpp
#	src/zvit/zvittracker.cpp

* Make GetSerialHash return const again

* Fix RPC spendzerocoin

* Precompute zPIV spends in a dedicated thread

Moves the spend precomputation process into it's own thread, instead of
being tied to the staking thread.

Loop currently has a 5000ms sleep at the end so as to not overconsume
locks.

# Conflicts:
#	src/wallet.cpp
#	src/wallet.h

* Qt: Add precomputed percentage indicator column to zPIV control UI

Adds a new column to the zPIV control UI showing the mint's completed
precompute percentage.

* Allow zPIV precomputing to be disabled

Adds a new command line (conf) option `-precompute` to disable
precomputing. Default is to enable.

# Conflicts:
#	src/init.cpp

* Add Databasing of zpiv precomputes, they are not encrypted yet

* Update precompute cache

# Conflicts:
#	src/init.cpp

* Fix rebase conflicts from precomputing

# Conflicts:
#	src/rpcserver.h

* Clear database cache with rpc call

* Convert precompute cache into LRU cache

* Add global boolean, that stop precompute cache lock

* reorg + refactoring + conflicts

# Conflicts:
#	src/lightzvitthread.h
#	src/rpcblockchain.cpp
#	src/wallet.h
#	src/zvit/accumulators.h

* precomputation-upstream conflicts solved

# Conflicts:
#	src/rpcblockchain.cpp
#	src/rpcrawtransaction.cpp

* getaccumulatorwitness method fix

# Conflicts:
#	src/rpcblockchain.cpp

* re added LNZP removed files

# Conflicts:
#	src/Makefile.am

* Remove duplicate functions from rebase

* Fix assertion failure in mining/staking

Need to explicitely set pindexPrev and nHeight within the locked scope.

* Fixup coinspend unit test header includes

* Fix wrapped serial functional test

The error message had changed

* Remove security level in `DoZpivSpend()` call

* Disable precompute for functional tests

The locking can interfere with block generation

* Fixup the interface_rest functional test

* Better logging for CheckCoinSpend

Also re-introduce the regtest specific conditional

* Prevent lock spamming when no stakable inputs are present

* Cleanup arbitrary sleep times in CreateCoinStake

* Fixup bad logprintf

* fixup makefile.am

* Don't error out when a range has already been computed

When a range of blocks has already been computed, use that existing data
 instead of erroring out. This is used in the zPoS pipeline where, after
  precomputation, the passed `pindexCheckpoint` is likely to be at a
  block height below the accumulator's tip/end.

* Fix irrelevant receipt status message

Since security level has been removed, this status message needed to be
changed.

Also removed some stale unused code that was left over from when
security level was used.

* Reduce log spam

New debug category "staking" added with some previous `LogPrintf`
messages recategorized to reduce log spam.

Also noted both "staking" and "precompute" in the init help message and
added them to the "pivx" umbrella category.

# Conflicts:
#	src/init.cpp
#	src/util.cpp

* Fixed compile error

* Merge #843: [Net] Increment Protocol Version

7241582ba3 [Net] Increment Protocol Version (Fuzzbawls)

Tree-SHA512: 12f2b784837de572ca0d96167dc51f355d5d0b042c53fb006186112639388ef5bddfe601fc99af64d3c0ab58013aa7add451616d29073f3b8fc6dfb4d29dce7d

# Conflicts:
#	src/version.h

* v3.2.0 Release

# Conflicts:
#	configure.ac
#	doc/release-notes.md

* [macOS] Remove DS_Store WindowBounds bytes object

Github-Pull: #858
Rebased-From: 21f50784c39d2c87776edb7b959d92d63b95b339

* Don't return an invalid state when shutting down the wallet

When the shutdown process is started, it is possible that the call to
`ValidateAccumulatorCheckpoint()` in `ConnectBlock()` will fail. Instead
 of returning an invalid state, which causes the block to pass through
 `InvalidChainFound()`, just return a stateless error if a shutdown has
 been requested.

Github-Pull: #865
Rebased-From: 8126729c7800d801f0f067d9a2257b8ad74c1a9f

* [Qt] Stop using a solid white image as a border image

This seems to be causing an issue on macOS, resulting in odd magenta
pinstripes. Instead, just set the WalletFrame's background to solid
white via hexcode.

Github-Pull: #863
Rebased-From: 9a855a8b50a3be548f3d8df7a7fc4f00baef0f73

* Remove now-unused image files

Github-Pull: #863
Rebased-From: 38e92f3a2678571cae2908d2140bb2f41e339143

# Conflicts:
#	src/qt/res/images/walletFrame.png
#	src/qt/res/images/walletFrame_bg.png

* [QT] Fix a display bug about zPIV mints

When opening the zPIV coin selection in privacy tab, if the wallet is
locked the message for all mints is that the seed is wrong. This commit
fixes it by replacing the message and stating that the locked wallet
prevents precomputation and spending.

Github-Pull: #852
Rebased-From: 94bea35e5569c323a667d8204bc2d23b15d4dc29

* [Net] Add new checkpoints for mainnet/testnet

This adds two new checkpoints for mainnet:
 * Block 1679090 - first block with a wrapped serial
 * Block 1686229 - last block that zPIV was active

Also for testnet:
 * Block 1016800 - Arbitrary recent block

Github-Pull: #861
Rebased-From: 9ce73e55db0f0c3013c08bee06648c40b705b86a

# Conflicts:
#	src/chainparams.cpp

* [Qt] Prevent double deletion of progress dialog

When `showProgress()` is passed a `100` int value, the dialog is deleted
. If the function is passed a `100` int value a second time in the same
scope, like what happens at the end of `RecalculateZPIVSpent()` and
`RecalculateZPIVSupply()`, it results in a segfault.

This change standardizes the process by first initializing the progress
dialog with a `0` value, updating to a maximum of a `99` value inside
the loop, and finally closing with a `100` value after the loop has
completed.

Github-Pull: #860
Rebased-From: fa0e1f301cb4c668706a14df8ae6e149c714ef6f

* [Build] Update debian contrib files

Github-Pull: #866
Rebased-From: 51616cb0d71541326b5060f7f93a51889c61cfc6

# Conflicts:
#	Makefile.am
#	contrib/debian/README.md
#	contrib/debian/changelog
#	contrib/debian/manpages/pivx-qt.1
#	contrib/debian/manpages/pivx.conf.5
#	contrib/debian/manpages/pivxd.1
#	contrib/debian/pivx-qt.desktop
#	contrib/debian/pivx-qt.install
#	contrib/debian/pivxd.bash-completion
#	contrib/debian/pivxd.install
#	contrib/debian/pivxd.manpages
#	share/ui.rc

* [Performances] Decrease the number of wasted CPU cycles

Github-Pull: #868
Rebased-From: 97720be5b945d1d490f6f6fa940b4620f6bbdb12

* PIVX Core v3.2.1 Release

# Conflicts:
#	doc/release-notes.md

* [Net] Valid blocks from forks badly rejected due an invalid view of the available utxo set for forked chains + split height going one block further than what should be.

[Net] acceptBlock, back to chain split was going one block further if prev was the previous block of the incoming block.

[Net] coins cache view only has the tip view and not forks utxo chain view.

Github-Pull: #880
Rebased-From: 2c76194c757ddd6a9081ee555b191c6dbb326c50

* [Net] AcceptBlock, first prev block loaded from disk.

Github-Pull: #880
Rebased-From: 754764be02af58b0b2059f580b40bf5f6380fa4d

* [Net] Add additional checkpoints

This adds two additional checkpoints for known split points

Github-Pull: #884
Rebased-From: af28b90a4ab119102ed995a20614025a55256526

# Conflicts:
#	src/chainparams.cpp

* Fix incorrect last checkpoint timestamp

Github-Pull: #887
Rebased-From: a0af2a75257a86f585580152e73de24b331c9264

# Conflicts:
#	src/chainparams.cpp

* 3.2.2 Release

# Conflicts:
#	doc/release-notes.md

* Fixed compile error

* Fixed coin name

* Fixed coin name

* Fixed coin name

* Merged branch pr/49

* Merge #890: [Refactor] Remove unused setStakeSeen variable

b5a525767a [Refactor] Remove unused setStakeSeen variable (warrows)

Tree-SHA512: c5244b3cf269d3b6171a5b241265b98bffcfbf580cecbf9cc2741ea2b3374deb558459a8764f1931080331b11456a8d129dbcc3b6e59955f15bc184333e23ca8

# Conflicts:
#	src/main.cpp

* Fixed compile error

* Merge #896: [UI] Simplify Qt margins.

d7afebb [UI] Simplify Qt margins. No functional change. (warrows)

Tree-SHA512: c29c1d416d81ccda15d90c26fcadc9b67dcd27b8b7bdbd55c951e0ddd6c809b0cc7cc0dfc3590dc45fa2fb4f0e5218d9da2a424cb3a953d9b542de34ab7b693c

# Conflicts:
#	src/qt/forms/masternodelist.ui

* Merge #888: [Zerocoin] remove CTransaction::IsZerocoinSpend/IsZerocoinMint

f14569faa [Zerocoin] remove CTransaction::IsZerocoinSpend and CTransaction::IsZerocoinMint (random-zebra)

Tree-SHA512: 0e7ab5ee37215454af1b09d25454bedaf8f92baf0ca598d5c639bb1b6f642ca93d21a8d2707af3c4cece06d7b6cd98a019e8b4c16712d774f23b5b41ee059a57

# Conflicts:
#	src/blocksignature.cpp
#	src/main.cpp
#	src/miner.cpp
#	src/qt/privacydialog.cpp
#	src/qt/transactionrecord.cpp

* Fixed compile error

* Merge #830: [Refactor] Remove BOOST_FOREACH

4f6cd20b0d Cleanup clang's range loop analysis warnings (Fuzzbawls)
e1c549e8a7 [Refactor] Remove useless BOOST includes and readd where needed (warrows)
4d44c9781a [Refactoring] Replace BOOST FOREACH with for : (warrows)

Tree-SHA512: a61e8968a28c86f33f753b693559a58a632e01b6408b7f0653772206fa9f20fb2df83e432ed74e33d1bed29a302ff4b98c30bbe53111faf1f50ed3acf8888190

# Conflicts:
#	src/activemasternode.cpp
#	src/init.cpp
#	src/masternode-budget.cpp
#	src/masternodeman.cpp
#	src/net.cpp
#	src/obfuscation.cpp
#	src/qt/masternodelist.cpp
#	src/swifttx.cpp
#	src/wallet.cpp

* Removed more BOOST_FOREACH and fixed compile error

* Merge #810: [Depends] Fix archs (fixes s390x and ppc64el builds on snap)

2fdc74b280 update qt.mk with arch fix (see previous commit) (cevap)
b22610c6f1 add QT patch for s390x, mips, powerpc and sparc (cevap)
1a756e0066 Fix qt for m68k and alpha (cevap)
f52a72ef0f Fix openssl for m68k and alpha (cevap)
e12b4493fb Fix boost for m68k and alpha (cevap)
32f2684b9e Fix openssl for sparc64 (cevap)
5de083f1d6 Fix qt for sparc64 (cevap)
f1e537e05d Fix boost for sparc64 (cevap)
188d0ea7a4 Fix qt for powerpc/ppc64el (cevap)
c590d072ab Fix openssl for powerpc/ppc64el (cevap)
def4374308 Fix qt for s390x (cevap)
ed61951516 Fix openssl for s390x (cevap)
d1489c8985 Fix boost for s390x (cevap)

Tree-SHA512: 90add202dde7c3252bdc92974936fa50daf66a34e29cfbbee3222771ea89d061466e39300d3449b5e8b43fd1d8b8828b694ad83624c959c7cc331463a7aef7f8

# Conflicts:
#	depends/packages/openssl.mk
#	depends/packages/qt.mk

* Merge #806: [Test] Create new per-test fixtures

c5054e4 tests: add a BasicTestingSetup and apply to all tests (Wladimir J. van der Laan)
962a1bc Reinitialize state in between individual unit tests. (Pieter Wuille)

Tree-SHA512: 47bab117a394de5f7dc9079f940969df6e3369f96128c1009c55005d30adb1dbc048900f04649caae2976518cad1065419f1d91baebffe0c3f3c2d9897450c08

# Conflicts:
#	src/Makefile.test.include
#	src/test/test_vitae.cpp
#	src/test/zerocoin_denomination_tests.cpp
#	src/test/zerocoin_implementation_tests.cpp

* Fixed coin name

* Merge #875:  [Zerocoin] GMP BigNum: Fix limits for random number generators

253c63e [Zerocoin] include 0 in randBignum() range (random-zebra)
daeb752 [Test] Add tests for bignum random generators (random-zebra)
5627807 [Zerocoin] Fix limits for random number generators in GMP bignum implementation (random-zebra)

Tree-SHA512: c88ab99912683736a886065ecfbfd52aeb419357ee0e7eb6e3c1a09c22c3c316884bf8606f44d13e0f0fcb4de4137fb52339b556eb6e1a134b7aafff36c1d414

# Conflicts:
#	src/libzerocoin/bignum.h
#	src/libzerocoin/bignum_gmp.cpp
#	src/libzerocoin/bignum_openssl.cpp
#	src/test/zerocoin_implementation_tests.cpp

* Updated big number from upstream

* Merge #900: [UI] Fix improperly parented walletView and segmentation fault on QT 5.10

a4205f2 [UI] Fix improperly parented walletView. (Julian Meyer)

Tree-SHA512: ba523274a9e336a884f097dcff5a0e47e294517254350287dd0c2572c63010e63a33734707bcdca753f454f85c4bbe052817172b719e7ac66bcdbdef71d151a2

* Merge #898: [Qt] Fixup duplicate label names

4e8f46a376 [Qt] Fixup duplicate label names (Fuzzbawls)

Tree-SHA512: 6cee761fae0d6d387523d286ddbc8fa6f61ef702ec406aa9108dedaccb1b8a0f343b7c01778f9d86be7e76e437d390e468c2593f2514c47350415da696744609

* [Zeroocoin] public coin spend script creation, validation and un/serialization.

# Conflicts:
#	src/Makefile.am
#	src/zvit/zpivmodule.cpp
#	src/zvit/zpivmodule.h

* Fixed compile error

* [UNIT TEST] publicCoinSpend valid input creation and verification.

[UNIT TEST] publicCoinSpend creation + validation completed.

* [Wallet] public coin spend creation connected + first mem pool validation.

[Zerocoin] public coin spend improvements.

[Zerocoin] publicCoinSpend validations connected to the accept txes flow.

[Zerocoin] public spends not checked as regular inputs.

[Zerocoin] publicCoinSpend validation as regular spends.

non good solution for the coinSpend pointer inheritance issue but at least working

[Zerocoin] ParseZerocoinPublicSpend moved into zpivmodule file.

cleanup unused field.

# Conflicts:
#	src/main.cpp
#	src/main.h
#	src/qt/transactionrecord.cpp
#	src/wallet.h
#	src/zvit/zvitmodule.cpp
#	src/zvit/zvitmodule.h
#	src/zvitchain.cpp

* [zPIV] zPIV Maturity --> Minimum amount of coins accumulated no needed anymore.

# Conflicts:
#	src/wallet.cpp

* [zPIV] publicCoinSpend signature hash relevant data inclusion.

* [zPIV] rebase problems fixed. (Needs more testing)

* Fixed compile error

* [zPIV] new protocol enforcement height added. Height not final, just randomly selected and tested on regtest.

* [zPIV][Cleanup] PublicSpend rebase onto IsZerocoin

# Conflicts:
#	src/zvit/zvitmodule.cpp

* [zPIV] remove enforcement from 'CreateZerocoinSpendTransaction' fixing the unit tests

# Conflicts:
#	src/test/zerocoin_transactions_tests.cpp

* [zPIV][Consensus] reject V1 serials spends.

* [zPIV] prevent v1 zerocoins from being selected for PublicSpends

# Conflicts:
#	src/wallet.cpp
#	src/zvit/zvittracker.cpp

* [zPIV] use new limit Zerocoin_MaxPublicSpendsPerTransaction for max num of inputs

# Conflicts:
#	src/qt/privacydialog.cpp
#	src/wallet.cpp

* [zPIV] mints coin control dialog min accumulation mature text removed + re mint change checkbox not visible anymore.

# Conflicts:
#	src/qt/privacydialog.cpp

* [FUNCTIONAL TESTS] valid PublicCoinSpend transaction test.

* [zPIV[Unit Test] Possible redundant denomination validation.

* [FUNCTIONAL TEST][zPIV] double spent serial validation.

* [RPC] spendzerocoin command can now create old zc spends, only for regression tests

# Conflicts:
#	src/rpcserver.h
#	src/rpcwallet.cpp

* [RPC] Parse public spend on getserials rpc command.

[Cleanup] non used variable commented.

# Conflicts:
#	src/qt/privacydialog.cpp
#	src/rpcblockchain.cpp

* [zPIV] reject priv coin spends on tx mempool acceptance.

* [zPIV] publicCoinSpend version field included in the serialization for any future change.

* [RPC] add 'createrawzerocoinpublicspend' method

* [Tests] add test reorg for public spend

[Unit Test] zc public spend test up-to-date with master.

# Conflicts:
#	src/test/zerocoin_transactions_tests.cpp

* [zPIV] testnet publicSpend enforcement height set.

[zPIV] v1 serials validation was not checked against the publicSpend height.

* [Consensus] spork 15 activation + protocol version bump.

[Consensus] spork 15 + min prev protocol version. (squash this later)

# Conflicts:
#	src/main.cpp
#	src/version.h

* [zPIV] v1 serials modulus fix + isStandardTx fix for publicSpends.

cleanup, publicCoinSpend object leftover removed + minor log added to CheckProofOfStake.

* [Consensus] Testnet enforcement height.

* [GUI] Disable zerocoin minting

# Conflicts:
#	src/qt/forms/privacydialog.ui
#	src/qt/privacydialog.cpp
#	src/qt/privacydialog.h

* [RPC] Disable zerocoin minting

disabling also remint of change of a zc spend

# Conflicts:
#	src/rpcwallet.cpp

* [Consensus] Disable zerocoin minting in contextual check

* [Wallet] Disable automint

* [zPIV][Consensus] fix 'Zerocoin_Block_Public_Spend_Enabled()' enforcement

* [RPC] enable mint only for regtest

# Conflicts:
#	src/rpcwallet.cpp

* Merge #899: [zPIV] Disable zPIV staking

a789d21635 [zPIV] Disable zerocoins inclusion in 'SelectStakeCoins' (random-zebra)

Tree-SHA512: 92da55ee6efe3090ad1b279e3ad4d1f757ca70d0a4b1f820a36b4d5d6dcef126002fc6c2402b2b8d34618f212a192d8dc7505f98a0050691d152ba5a17fb1821

# Conflicts:
#	src/wallet.cpp

* Merge #909: [Consensus] Mainnet public spend enforcement height set.

39f37c5c52 mainnet public spend enforcement height set (furszy)

Tree-SHA512: 41adff5fa6ed7458ef3dcbb33979716996168bff7eccc4759931e8231184462a75020485430d91f88373b6cd3d298d3c0d61a9758aab4e0da3e6ea64d84e3594

* Merge #903: [Log] Handle errors during log message formatting

93bc03763b [Log] Handle errors during log message formatting (warrows)

Tree-SHA512: 55acc54247ad0980a4ed28ff167d35bae5d437e6484bd5ebb8c9cf948e47751d2e7dc4e9c338d7a6d22301f85448b4e6b8c4f6dbf97d68168939d13bdecb310b

* Merge #912: [Cleanup] compiler warnings in coinSpend object.

f912182d27 [Cleanup] clang compiler warnings in coinSpend and publicCoinSpend fixed. (furszy)

Tree-SHA512: 58dbe73519a8eece2a824a19f37b5219c1e189e395afc61f9fcfa54f195befd9f7a49500c4147684a9b58e96fa7ff7906fa956ae8ac249dc7094faaa6cd4a4b6

* Merge #901: [RPC] Fix typos and oversights in listunspent

f3308f404d Fix typos and oversights in listunspent (CaveSpectre11)

Tree-SHA512: b6a4651b5ee27cf757e9effa1d692020823d7c4bbd66a56c990252fc80f7f3333abb1313b37a01f5d444f333c0d4782d4607ca5e4179cf4bac6db5a86cc15f78

* Merge #902: [Tests] Add tests for CAddrMan

c84e0e83ba [Code Style] Remove std namespace in test file (warrows)
3355c86cce Increase test coverage for addrman and addrinfo (Ethan Heilman)
d4da01588b Creates unittests for addrman, makes addrman testable. (EthanHeilman)

Tree-SHA512: cd960109d8f3bdc46dfd58da2136a748aa8ecb1b3bacfa031af0a1544bd90514fe71b8fc63650e61c5872c7a42febc986616252550a71c510bdc7f9e1ab87e0f

* Merge #906: [Build] Add CMake Support

ca2fd101ba use non-Cellar OpenSSL path for macOS (Fuzzbawls)
69b0032749 fix config.h include file name (Fuzzbawls)
d413496b01 [Build] Initial CMake support (Fuzzbawls)

Tree-SHA512: 459d881a6128027c1b1fe6df13b0dce5fe484af377afece74ccc135a5e5ea320496165ffbdef70d806bd879be7cad39d4bfc3cdffbacfc2a61d0c8e53265b0ab

# Conflicts:
#	src/compat/byteswap.h
#	src/compat/endian.h

* Merge #910: [Build] Clean all coverage files during make clean

b75d8bc0bb [Build] Clean all coverage files during make clean (Fuzzbawls)

Tree-SHA512: 5f0e0a4795ea770cabf326c91aea24094de9193684a295f82aa38b42840b0ea38f1a119ba30c6c20eedd1862f22133b66e606912da0f93b420e9ca0549704f41

* Merge #895: [QT] Options UI cleanup

c424f0f244 Fix margins (Alko89)
2d052155ff Hide zpiv related options. (Alko89)

Tree-SHA512: 2944f28e4d2b4baa901a5c1a4bb991eb07bb81d33c285ec32971fa9485522320a6f583f5346c7fadceb2ab0e484f0cba521dc436cfa1586f75bfa05f13eeac9a

# Conflicts:
#	src/qt/forms/optionsdialog.ui

* Merge #919: [zPIV] Debug missing jump line.

addeb0ac06 Update accumulators.cpp (Matias Furszyfer)

Tree-SHA512: 56de08723ba12cb2b7f96b66ed5d6ee2c3912be6397ef1eb56b16d8c805425415b288d9b176981b8e720c6f195acdbfc1156bed5f7c31dcd9547a790cb585a52

* Merge #916: [Staking] Don't assert if we were beaten to the block

24d72d0f64 [code review] LogPrintf nit change (CaveSpectre11)
019d26ac4c Don't assert if we were beaten to the block (CaveSpectre11)

Tree-SHA512: 9818319df999ba21fb6f89dadf254f76ad02d14b4f35fcae5b8d9a6251a0be5212650f3834a61a90fad2a9e8ce242751a9c09f7325c9cccc60223a59a6b3f22c

* Merge #922: [Build] Fix app name casing in mac deploy related files

45ea523e1a [Build] Fix app name casing in mac deploy related files (Fuzzbawls)

Tree-SHA512: 79fd711f3db52e418f42b7cdcf26a4a68456e6727b1362837745eacfe1797eb8fb33a8a86812158c1e833862fca7fedc5e55ef0fa5d4a2d7eff654c646ea8214

# Conflicts:
#	contrib/macdeploy/detached-sig-create.sh
#	contrib/macdeploy/fancy.plist

* Merge #914: [Gitian] Bump gitian build versions

55127d1264 [Gitian] Bump gitian build versions (Fuzzbawls)

Tree-SHA512: 29c6681b76adfb69b2f741d9f50575da0f870df8b822cb2886e10f6d364713221db0a94b017de3e89943e6e52d3aa2d7856604f092b73af14caa0ab9dc0b21bc

# Conflicts:
#	contrib/gitian-descriptors/gitian-linux.yml
#	contrib/gitian-descriptors/gitian-osx-signer.yml
#	contrib/gitian-descriptors/gitian-osx.yml
#	contrib/gitian-descriptors/gitian-win-signer.yml
#	contrib/gitian-descriptors/gitian-win.yml

* Merge #924: [Backport] Max tip age to consider a node in IBD status customizable.

46ba7a2b96 [Backport] Max tip age to consider a node in IBD status customizable. Backport from bitcoin##7208. (furszy)

Tree-SHA512: 211479d05cc8226d0bdaa3432204467679b465dfdbcdcf58650ec2fcb415c60544f3ae354f8b460adc6cd7e2d56ce6b3a52dd77ac92017eb7f66d98a76051bb2

# Conflicts:
#	src/init.cpp
#	src/main.cpp

* Merge #913: [Depends] Update from upstream

d2136e30e0 depends: Update from upstream (Fuzzbawls)

Tree-SHA512: 9ce1b15170113cd207090f8986efd809cc6f4859132140e1c09f573e1015115ff82d961d7fc21375f8a5346de6bea656bb3bfb190ab95c60c080145d8ea67137

# Conflicts:
#	.travis.yml
#	configure.ac
#	depends/Makefile
#	depends/README.md
#	depends/config.site.in
#	depends/packages/expat.mk
#	depends/packages/miniupnpc.mk
#	depends/packages/native_biplist.mk
#	depends/packages/native_mac_alias.mk
#	depends/packages/packages.mk
#	src/Makefile.am

* Fixed compile error

* Merge #917: [Build] TravisCI Update

342f0341de Disable known failing regression tests (Fuzzbawls)
a5f887b00e [Travis] Update TravisCI from upstream (Fuzzbawls)

Tree-SHA512: 0cf866696ffb6cff539a1412c95f1f10a6e031629f153aa9a01b5326b77bc7de53912c36d254c859e437d7c3035f466d3b3db79aab26cec4767c75e45e16559a

# Conflicts:
#	.travis.yml
#	.travis/lint_04_install.sh
#	.travis/test_03_before_install.sh
#	.travis/test_04_install.sh
#	.travis/test_06_script_a.sh

* Merge #904: [zPIV] Free memory from ToString()

9c0329c72b [zerocoin] Free memory from ToString() (warrows)

Tree-SHA512: c04bfcf1af3b9fd95cf6aa653367043d4a973805c37e820b3127a3198efbdb0f83eb82d8084409f17e059e44e7c653666899a5733dd1f272d0829ae0ceee388d

* Merge #908: [NET] Non-running dns servers removed from chainParams.

8695fd5fb5 Non-running dns servers removed + warrows dns added. (furszy)

Tree-SHA512: ad98e116255c919d1f0765585578afdb64e0368393faa1954bf23162e705165aa11c8d810ac913bd0c7325a0da096fd99535de5cb66778ad5be15f6a5d81b8c8

# Conflicts:
#	src/chainparams.cpp

* Merge #920: [Docs] Overhaul documentation files

d24742cf37 Remove redundant docs (Fuzzbawls)
007cc8c289 Update src/test/README.md (Fuzzbawls)
d2af9593e4 Introduce translation_strings_policy.md (Fuzzbawls)
019b8f4e8c Update contrib/devtools/README.md (Fuzzbawls)
2bc9d1b0f1 Update developer-notes.md (Fuzzbawls)
d1a65fdcaf Update dnsseed-policy.md (Fuzzbawls)
0b5c0c262b Update release-process.md (Fuzzbawls)
9335a103d1 Update test/functional/README.md (Fuzzbawls)
20f251336a Update doc/README.md (Fuzzbawls)
5b4f73def6 Clean up whitespace in Doxyfile.in (Fuzzbawls)
3cea76be03 Update and reformat init.md (Fuzzbawls)
2f5efbd12c Reformat files.md (Fuzzbawls)
df0d2ba1fe Introduce dependencies.md (Fuzzbawls)
785b61cf56 Update zmq.md (Fuzzbawls)
231f28e696 Update translation_process.md (Fuzzbawls)
c5f6822af5 Update tor.md (Fuzzbawls)
b7d0ec7696 Fix markdown in REST-interface.md (Fuzzbawls)
4fa4cc4ff2 Update Contributing guidelines (Fuzzbawls)
a544132207 Update build notes (Fuzzbawls)

Tree-SHA512: ab422791c3e43d6e455d648c9b6b30943c176e03d2a0702135184108c8887bb39e4bb9c51bab9f9a04a130a297f8db879563e3b45f010c6b1f34482122b78681

# Conflicts:
#	CONTRIBUTING.md
#	contrib/devtools/README.md
#	doc/Doxyfile.in
#	doc/README.md
#	doc/README_osx.md
#	doc/REST-interface.md
#	doc/bootstrap.md
#	doc/build-osx.md
#	doc/build-unix.md
#	doc/build-windows.md
#	doc/developer-notes.md
#	doc/dnsseed-policy.md
#	doc/files.md
#	doc/guide-startmany.md
#	doc/init.md
#	doc/masternode-budget.md
#	doc/masternode_conf.md
#	doc/multiwallet-qt.md
#	doc/release-process.md
#	doc/swifttx.md
#	doc/tor.md
#	doc/translation_process.md
#	doc/unit-tests.md
#	doc/zmq.md
#	src/test/README.md
#	test/functional/README.md

* Merge #921: [Scripts] Overhaul supplemental python/shell scripts

0608b9ca95 Misc updates (Fuzzbawls)
616b1d531c Introduce clang-format-diff.py (Fuzzbawls)
0367807d49 Introduce commit-script-check.sh (Fuzzbawls)
28bd93359a Update gitian-build.py (Fuzzbawls)
b0d7d07512 Update github-merge.py (Fuzzbawls)
fe7bf507d4 Introduce gen-manpages.sh (Fuzzbawls)
035dda7458 Introduce circular-dependencies.py (Fuzzbawls)
70721b47ac Migrate update-translations.py to python3 (Fuzzbawls)
1558ff775e Update install_db4.sh (Fuzzbawls)
5c92f16656 Add multi-purpose copyright header script (Fuzzbawls)

Tree-SHA512: 3cc0637288fe059c340bbaee8e5eda794df985280b739d8a976e6eaa7938bb24eb2bf554c4d1552cc5f45adcd1f1380e4ea390029ed9024f97bf80071918b9f4

# Conflicts:
#	contrib/devtools/security-check.py
#	contrib/gitian-build.py
#	contrib/install_db4.sh

* Merge #911: [RPC] add 'getblockindexstats' function

eea9915361 [RPC] fix locking strategy (random-zebra)
49ef846774 [RPC] fix help texts (random-zebra)
26b1f0ca33 [RPC] 'getblockindexstats': count public spends separately (random-zebra)
7980f23c0c [RPC] fix fee calculation in 'getblockindexstats' and 'getfeeinfo' (random-zebra)
689ac23f62 [RPC] add 'getblockindexstats' function (random-zebra)

Pull request description:

  This introduces a new RPC method `getblockindexstats` to get aggregated BlockIndex data for a range of blocks:
  - transaction count
  - transaction count (including coinbase/coinstake txes)
  - zPIV per-denom mint count
  - zPIV per-denom spend count
  - total transaction bytes
  - total fees in block range
  - average fee per kB

  Since it expands the functionality of `getfeeinfo`, this method has been redirected to call `getblockindexstats` (over the **last** N blocks).

  To avoid code duplication with `getserials` and `getmintsinblocks`, the initial validation of the input params has been refactored in the function `validaterange()`.
  This also contains a fix to prevent the wallet from crashing when calling these functions over out-of-range blocks.

ACKs for commit eea991:
  Fuzzbawls:
    ACK eea9915
  Warrows:
    ACK eea9915

Tree-SHA512: fd424d27b09133f8e1b646044f6e48cb7be8e7b7f6bbe51797b229e7e1c5d721226022915876d3810b38e7c2eb6bb089a7e3b8df2b0487ac251bde405e1f964a

* Merge #925: [Consensus] Time checks

88705a6099 [Consensus] Guard time checks changes (warrows)
105ee5fd07 [Consensus] Readd checks removed in 3b778f56fe2b5e5b363c8c6d794a848a84d630d1 (warrows)
2621b7f3f7 [Refactoring] Move ContextualCheckZerocoinStake() to kernel.cpp (warrows)

Pull request description:

  Two checks on the age of a transaction used to stake were removed by mistake in 3b778f5. We reintroduce them here.
  2621b7f is a bit of refactoring
  105ee5f is the real change
  88705a6 avoid checking blocks already in the blockchain

ACKs for commit 88705a:
  furszy:
    ACK 👌  [88705a6](https://github.com/PIVX-Project/PIVX/pull/925/commits/88705a6099f0c42d122c5717fccd08f6485f0b0a)
  Fuzzbawls:
    ACK 88705a6

Tree-SHA512: 13397aac35b1d8c6680993ba90a1266113baf25bd16410f408d7d16f9eaa93f7cd0f665224959c64dfac5725bdacc25bead9d65cd8d9bdcd5570b9434ebd851a

# Conflicts:
#	src/kernel.cpp
#	src/main.cpp

* Fixed compile error

* Merge #824: [Refactor] Remove stale obfuscation code

fe67706fd2 Remove more useless obfuscation code (Fuzzbawls)
eed0a1d34e Remove more useless obfuscation code (Fuzzbawls)
3bb5c768bf Remove unused functions in wallet.cpp (Fuzzbawls)
166b2d31c8 Remove nAnonymizePivxAmount and nLiquidityProvider (Fuzzbawls)
886d806f58 Remove unused code in DoAutomaticDenominating (Fuzzbawls)
742a7b187c [Qt] Remove unused obfuscationconfig (Fuzzbawls)

Pull request description:

  Removal of "dead" code surrounding the defunct obfuscation feature.

  Obfuscation as a usable feature was removed in November 2017, but much of it's underlaying code remained. This PR aims to clean up and remove the now unnecessary code.

  Marking as [WIP] for the time being.

ACKs for commit fe6770:
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/commit/fe67706fd222168e4bb6a387566a48dbd667638c

Tree-SHA512: 46ab7d035aa899677d1337c6a58def25e452c24db038b769e9e6f980ac43e03a34af968114facadcd62ec93eacf41de0a385f60d91630a0ac8425cd385d9a513

# Conflicts:
#	src/init.cpp
#	src/obfuscation.cpp
#	src/obfuscation.h
#	src/qt/obfuscationconfig.cpp
#	src/qt/obfuscationconfig.h
#	src/qt/optionsmodel.cpp
#	src/util.cpp
#	src/util.h
#	src/wallet.cpp

* Fixed compile error

* Merge #930: [Net] Add a couple new testnet checkpoints

ab441f3728 [Net] Add a couple new testnet checkpoints (Fuzzbawls)

Pull request description:

  1. `1106100` height that zc public spends became available
  2. `1112700` random recent testnet block that meets criteria

ACKs for commit ab441f:

Tree-SHA512: c138a71939e66a0a9ac598a25f6984c4f05f846533ded2a90f0430c7d71608baf81e48e8bd3ca71206794f3212c2f9e3e8ed5cd282f9c9d02a38db61f7585e85

* Merge #926: [Doc] 3.3.0 Notable Changes

cd11699936 [Doc] 3.3.0 Notable Changes (Fuzzbawls)

Pull request description:

  Notable changes for 3.3.0

  #ci-skip

ACKs for commit cd1169:

Tree-SHA512: 6cb841dd65873c1c3cc7c7b03ab672ae17e0945e9872b3f53a4accf6b919f46aab9fbdc95753fd159cda88db86f2fcc087a15a3e1605fda170a99b6c50e0f7e9

# Conflicts:
#	doc/release-notes.md

* Fixed coin name

* Merge #929: [Net] Update hard-coded seeds

c447aecc1b [Net] Update hard-coded seeds (Fuzzbawls)

Pull request description:

  Updated hard-coded seeds based on uptime and availability from primary
  DNS seeder.

ACKs for commit c447ae:

Tree-SHA512: 4ca56e41e277092093eead76fbc229a130bb786790c784a91e0d78a724f35a6e6594c4daa82a9dda88f7ed2eae441bc371fa2b4ab3d50d203d518d667ecbd2a9

# Conflicts:
#	src/chainparamsseeds.h

* PIVX Core v3.3.0

# Conflicts:
#	configure.ac
#	doc/release-notes.md

* Fixed coin name

* Fixed coin name

* Fixed coin name

* Updated doxyfile

* Merge #934: [Build] Bump master to 3.3.99 (pre-3.4)

7b4680a [Build] Bump master to 3.3.99 (pre-3.4) (Fuzzbawls)

Pull request description:

  Now that 3.3 has been branched off, bump master to 3.3.99 (pre-3.4).
  Gitian descriptors reflect this as well.

ACKs for commit 7b4680:
  Mrs-X:
    utACK https://github.com/PIVX-Project/PIVX/pull/934/commits/7b4680a881dcaddba82bddbd3161506358c99ac7

Tree-SHA512: b582d3f9ede816d28902991e8b891a8e56261dcf9a857cdbc5af1787add52c402a66c0eebf1cfc8197dee7dc295a3410406f2e4e347e078232e9f4d2036459bb

# Conflicts:
#	configure.ac
#	contrib/gitian-descriptors/gitian-linux.yml
#	contrib/gitian-descriptors/gitian-osx.yml
#	contrib/gitian-descriptors/gitian-win.yml

* Merge #932: [Node] Do all block index writes in a batch

e515b1e [Node] Do all block index writes in a batch (Pieter Wuille)

Pull request description:

  Backport from bitcoin https://github.com/bitcoin/bitcoin/pull/5367

ACKs for commit e515b1:
  Mrs-X:
    ACK https://github.com/PIVX-Project/PIVX/pull/932/commits/e515b1e9f2309d27efea69beae6569ee92178d88
  furszy:
    ACK [e515b1e](https://github.com/PIVX-Project/PIVX/pull/932/commits/e515b1e9f2309d27efea69beae6569ee92178d88)

Tree-SHA512: 8eff741bcbe357b7f6af0d1aea627f77498543efd117173ab2b4c325c3bc3ef3e761b6f4ad7cf70379b55daf68724bed2e10fe22a273b0fc1c3009fac8008a60

# Conflicts:
#	src/main.cpp

* Merge #933: [Qt] Add blockhash + datadir to information tab

7c9859f [Qt] Add blockhash + datadir to information tab (Mrs-X)

Pull request description:

  Added the block hash of the latest block to the Tools -> Information tab.
  And, while I was at it, added the used data-directory (similar to upstream).

  ![InfoTab](https://user-images.githubusercontent.com/22873440/59847234-3febb200-9362-11e9-982e-1d8742e47c4d.png)

ACKs for commit 7c9859:
  Fuzzbawls:
    ACK 7c9859f

Tree-SHA512: dcfa1443253255c1eaa8773e47d53e4541a01f956636f8c6f710d7d048eee33e7ceea8151c0cc619b382b3ce67472a594fc229d434af3c9e62c27c86686d9edd

# Conflicts:
#	src/qt/forms/rpcconsole.ui

* show the progress of functional test

example (added the progress index `n/m`)
```
1/107 - wallet_hd.py passed, Duration: 27 s
.........................................................................................
2/107 - mining_getblocktemplate_longpoll.py passed, Duration: 72 s
..................................................................
3/107 - feature_maxuploadtarget.py passed, Duration: 78 s
```

- clear dots line
```
$ test/functional/test_runner.py -t can_trash
Temporary test directory at can_trash/test_runner_₿_🏃_20181018_220600
1/105 - wallet_hd.py passed, Duration: 21 s
2/105 - mining_getblocktemplate_longpoll.py passed, Duration: 71 s
3/105 - feature_maxuploadtarget.py passed, Duration: 68 s
..................
```

- don't print the `dot` progressive if `--quiet`

- done_str
- nothing commit to check again travis tests

* tests: Print dots by default

* tests: Print remaining jobs in test_runner.py

This helps finding out which tests fail to finish.

* travis: Fix caching issues

* [Travis] Log more info

* travis: Use absolute paths for cache dirs

* [Travis] Give more time to tests

Travis was regularly failing because the full test suite with coverage
takestoo much time.
Bitcoin has some optimisations in there which allows them to give less
time to the test part of the process. We don't so until we do, we have
to reserve more time. We will probably have to restart manually more
travis jobs but that's the only way to have them run to the end.

* Merge #947: [Scripts] Sync github-merge.py with upstream

cd9a6edfea [Scripts] Sync github-merge.py with upstream (Fuzzbawls)

Pull request description:

  Pulls in further updates to the script from upstream since #921 was
  merged.

  Most notably, this allows for shorter commit hashes in ACK/utACK comments/reviews

ACKs for commit cd9a6e:

Tree-SHA512: 0aef9f8e587ba3045628d6bce6ed9d29c2efbc0ac70ebfe7f0ba0ff52f3b9f23abd6d85095f783510868c9d35c15cfe63dbe885b9f02889867b7a71cc2a78bff

* Merge #949: [Refactor] Remove all "using namespace" statements

ef41333993fc7f9a8b1a845766b68f15576bd4c2 [Refactor] Replace tabs with spaces (warrows)
604d365c5ee12c2273789fd3afa2f496e8550eb1 [Refactor] Remove all "using namespace" statements (warrows)

Pull request description:

  This goes towards following more closely the coding guidelines.
  No functional change.

ACKs for top commit:
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/pull/949/commits/ef41333993fc7f9a8b1a845766b68f15576bd4c2
  Fuzzbawls:
    ACK ef41333993fc7f9a8b1a845766b68f15576bd4c2

Tree-SHA512: 18b1744a397a9ade766456980f980ea915c468c9484ff61401c3e96b4008c6c615bb4dbf533009bedb89297aaec5f1dc7cd0b27aafcb08d3088fb7abd579cf87

# Conflicts:
#	src/activemasternode.cpp
#	src/activemasternode.h
#	src/init.cpp
#	src/main.cpp
#	src/main.h
#	src/masternode-budget.cpp
#	src/masternode.cpp
#	src/masternode.h
#	src/masternodeman.cpp
#	src/masternodeman.h
#	src/net.cpp
#	src/obfuscation-relay.cpp
#	src/obfuscation-relay.h
#	src/obfuscation.cpp
#	src/obfuscation.h
#	src/qt/multisigdialog.cpp
#	src/qt/pivxstrings.cpp
#	src/qt/privacydialog.cpp
#	src/qt/transactiondesc.cpp
#	src/qt/vitae.cpp
#	src/qt/walletmodel.cpp
#	src/rpcblockchain.cpp
#	src/rpcdump.cpp
#	src/rpcmasternode-budget.cpp
#	src/rpcmasternode.cpp
#	src/rpcmining.cpp
#	src/rpcmisc.cpp
#	src/rpcrawtransaction.cpp
#	src/rpcserver.h
#	src/rpcwallet.cpp
#	src/stakeinput.cpp
#	src/test/zerocoin_transactions_tests.cpp
#	src/timedata.cpp
#	src/util.cpp
#	src/vitae-tx.cpp
#	src/wallet.cpp
#	src/wallet.h
#	src/walletdb.cpp
#	src/walletdb.h
#	src/zvit/zvitwallet.cpp

* Fixed compile error

* Removed more "using namespace" statements

* Merge #939: [Wallet] Remove (explicitely) unused tx comparator

3da857b52879c186295057a5f91ec731cd65e3de [Wallet] Remove (explicitely) unused tx comparator (warrows)

Pull request description:

  '==' and '!=' operators in CMutableTransaction are never used explicitly.
  Them being used implicitly is probably what causes #510. There is no good reason to keep them and BTC removed them here: https://github.com/bitcoin/bitcoin/pull/13443
  Should fix #510

ACKs for top commit:
  Fuzzbawls:
    ACK 3da857b52879c186295057a5f91ec731cd65e3de

Tree-SHA512: f5874d794b0a43b1290c977b10d16b1a8078b09862886f34bcdcc65e5a1ef2b9eb1c3e43dfe4711861609cf5a6c92d35180e37a95f5d5afcbac16854d5189dee

* Merge #951: [Trivial] typo fixes

639b43dee61c5d918bc5538eb563de376d51ee78 [Trivial] Spelling - Wither -> Whether (Cave Spectre)
c9a2cc35d201421b3de20a539f1598372a36efae Trivial: typo fixes (Cave Spectre)

Pull request description:

  "monthly" instead of "monthy"
  "budget" instead of "buddget"

  Also included "std::" on the throw runtime_error for a smoother merge with #949

ACKs for top commit:
  Fuzzbawls:
    ACK 639b43dee61c5d918bc5538eb563de376d51ee78

Tree-SHA512: 3e6d72e4842c4e2100e6252b4b452da9368c76583dee9bf7427e73fc1f8115fbcd059bd7869d7f43e9b40f7026a65b07a0d916f6fc9df5f76c93eb08145437dc

# Conflicts:
#	src/rpcmasternode-budget.cpp

* Merge #941: [Refactor] Move ThreadStakeMinter out of net.cpp

42fe4040acff08450168416ccf35413abdc1747a [Refactor] Move ThreadStakeMinter out of net.cpp (Fuzzbawls)

Pull request description:

  This moves the implementation function and thread creation to a more
  appropriate file (`miner.cpp`).

  Resolves #938

ACKs for top commit:
  CaveSpectre11:
    ACK https://github.com/PIVX-Project/PIVX/commit/42fe4040acff08450168416ccf35413abdc1747a
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/pull/941/commits/42fe4040acff08450168416ccf35413abdc1747a
  furszy:
    utACK [42fe404](https://github.com/PIVX-Project/PIVX/pull/941/commits/42fe4040acff08450168416ccf35413abdc1747a)

Tree-SHA512: d3417f03cab63aa41b1ff0fb4d391d42f4448b83efe70391d4014407008af34eb265a23b5807ebecb90cf9637fb74e5b330b02c92e7038e5400a5f16608800ee

# Conflicts:
#	src/net.cpp

* Merge #961: [Trivial][Tests] Do not fail test when warnings are written to stderr

20aab1152afa3a0ef71ffeb05d4dd4eb171ba116 [Tests] Do not fail when warnings are written to stderr (random-zebra)

Pull request description:

  Fixes https://github.com/PIVX-Project/PIVX/issues/960

  Rationale: the test result should be set only through `assert`s in the test and not rely on what's printed on the console. Furthermore, as shown in the issue, stderr could contain simple warnings that don't affect the test's outcome.
  If stderr is not empty though, print its content.

  Also re-sort tests by duration.

ACKs for top commit:
  Fuzzbawls:
    ACK 20aab1152afa3a0ef71ffeb05d4dd4eb171ba116
  Warrows:
    utACK 20aab11

Tree-SHA512: 34685dd81b7849d761eb3427a3f67c825605b58d985d3c992491007ac84085632b6c5a24427ac53e8c6f340b3becf68e5b0a036bf2614b47f20ab9886b027432

* Merge #964: [Refactor] Combine parameter checking of budget commands

983d97a86c6450c85a0411eed5b533e3109c1aea [Refactor] Combine parameter checking of budget commands (Cave Spectre)

Pull request description:

  ### **Release notes**
  - [Refactor] Move common budget parameter checking code into a function

  ### **Details**
  The code in both `preparebudget` and `submitbudget` used the same parameter checking.  This pulls that parameter checking and loading into a common routine used by both; for ease of improvements and adjustments to the parameter checking... so the risk of not adjusting them consistently in both routines is removed.

  ### **Note**
  The early discussion below is based on a combined PR that addressed this, plus #950 and a PR to be named later.  The decision was made to split and focus; so the discussions can be independent of each other and refactor as needed.

ACKs for top commit:
  Fuzzbawls:
    ACK 983d97a86c6450c85a0411eed5b533e3109c1aea
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/commit/983d97a86c6450c85a0411eed5b533e3109c1aea

Tree-SHA512: a88eb41e06d1936db77f1cd9c4f04360b446c48d27652d57dfd6e4b119140d56e24b24e00e0ac48890cc78d4130f8f688a711f74899f9c9301d1aba22dff5315

# Conflicts:
#	src/rpcmasternode-budget.cpp

* Merge #952: [Staking] Prevent potential negative out values during stake splitting

139d333dd9c294e13115bfd8e1b1a8d7ad1e9d2e Minting: Prevent potential negative out values (Cave Spectre)

Pull request description:

  On the rare occasion that a small UTXO wins a stake; and that user has (by lack of understanding, or by error) configured a very small StakeSplitThreshold; they can end up in a situation where their extremely lucky stake win fails at consensus because of the way the stake split is calculated.

  The logic split the block reward between the two outputs; along with the input.  However if that input is significantly small, and the block reward is significantly weighted to the masternode; then the potential for a negative (and thus very very large) output would be created in the second side of the split.  This is due to the fact that the full masternode reward is taken out of the "previous" output (`vout[i - 1]`).

  This is a rare, if not relatively impossible, scenario with PIVX at it's current state, but the potential grows much larger when coin parameters are re-arranged; e.g. small stakes with a heavy weight onto the masternode reward.  i.e. a stake split of 5, with a block reward of 10, and 90% to the masternode.   15 ends up split into vout[1] and vout[2], both receiving 7.5; yet FillBlockPayee will subtract 9 from vout[2]; resulting in a negative wrapped to a large positive.

  This logic simply puts the reward that will be deducted from into the second vout.  So with the above numbers; vout[1] is split to 2.5, vout[2] is initially 12.5 and then after the unknown (at that time) masternode fee of 9, is reduced to 3.5; no longer going negative.

  Of course this is an extreme example; but the potential still exists.

  Alternatively, restrictions could be placed on setstakesplitthreshold to prevent the user from setting a threshold dangerously low; or a minstake could be setup to prevent a stake small enough to be a problem from being considered.  However, this seems like the best solution to the problem; by handling it without adding a lot of logic to collect the chain parameters and set limits that make sense to whatever chosen configuration is used.

ACKs for top commit:
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/pull/952/commits/139d333dd9c294e13115bfd8e1b1a8d7ad1e9d2e
  Warrows:
    utACK 139d333
  Mrs-X:
    utACK https://github.com/PIVX-Project/PIVX/pull/952/commits/139d333dd9c294e13115bfd8e1b1a8d7ad1e9d2e and merging...

Tree-SHA512: 2b8b91adeb5b5f053e60087f3f3b350228491a6be4970180d68475c11610f95fa62fb9e2583f8fff7e7b567fec3d2105ffa48246cc4addb3914cfb37ee3e312d

* Updated fundamental node

* Merge #971: [Wallet][zPIV] zc public spend parse crash in wallet startup.

12c44cafdeb49ec0b5fbe5815cb4fa431bc2a934 [Wallet][zPIV] zc public spend parse crash in wallet startup fixed. (furszy)

Pull request description:

  ### Crash Details
  Essentially the crash happens when the wallet.dat file contains a zc public spend transaction (input) and the user have removed the chain data.

  Specifically inside the `decomposeTransaction` in the `TransactionRecord` class the wallet tries to parse the `publicCoinSpend` looking for every output that is linked to the transaction, as there is no information about the output in disk, the wallet throws a runtime error on the startup blocking the initialization (only two ways to surpass this issue for current users:

  1) Download the snapshot.
  2) Start the wallet with another wallet.dat file and let it sync until the required output data is downloaded).

  --------
  ### Fix
  Use only the coin spend serial and not try to parse + validate the whole object, there is no need to do it there, if the transaction is in the internal wallet txes map then it means that it passed all of the validations.

ACKs for top commit:
  Warrows:
    ACK 12c44ca
  Fuzzbawls:
    ACK 12c44cafdeb49ec0b5fbe5815cb4fa431bc2a934
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/pull/971/commits/12c44cafdeb49ec0b5fbe5815cb4fa431bc2a934 and merging...

Tree-SHA512: 6b15b5f99fd85ddbf1349c71f62a3287ae4194b6b345ca2b72849ff72c72e4709b092e95ff5cfb6c5a2d9ff52cc30380b6eba34ffedb825e8b3c5764d63c65cb

# Conflicts:
#	src/zvit/zvitmodule.cpp

* Merge #974: [Tests] Add Spork functional test and update RegTest spork key

db702dcc200f9c70562039d422de2ec36c3248f9 [Tests] Enable Spork messages on RegTest net (random-zebra)
421956f80325331bd145c83e4e182687dfe13c00 [Tests] Add Spork functional test and update RegTest spork key (random-zebra)

Pull request description:

  This adds a first basic functional test for the spork RPC.
  The spork key for RegTestNet is updated, and the relative private key is provided in the comment so anyone is able to test (prior to this, there was no public key set for RegNet so it inherited the TestNet value).

ACKs for top commit:
  Warrows:
    Very nice: ACK db702dcc200f9c70562039d422de2ec36c3248f9
  Fuzzbawls:
    ACK db702dcc200f9c70562039d422de2ec36c3248f9

Tree-SHA512: 507ca538a7f399ad1872ccdce689e2d144311adb6355cdcc16d0526272ca748b1fa9fecab3c681c4d5cf73898fb686774ced179a318404bc67452abf4666f707

* Merge #965: [RPC] Correct issues with budget commands

72611349f10c94de54162ab1a226a81dd9af35fd [Review] Convert runtime_error to JSONRPCError (Cave Spectre)
f7ac53b2d5de29951240718680443b62acfa6db2 [RPC] Correct issues with budget commands (Cave Spectre)

Pull request description:

  ### **Release notes**
  - [RPC] Fix potential wallet crashes in budget commands
  - [RPC] Remove unnecessary conditionals in parameter checking of budget commands

  ### **Details**
  **wallet segfault**
  `preparebudget`, invoked before the wallet has fully started, caused a segfault and crashed.  This was due to the lack of checking for `pwalletMain` before referencing cs_wallet.  This is solved with a throw error to tell the user to try again after the wallet has started.

  Furthermore; both `preparebudget` and `submitbudget` has a check for `pindexPrev` to conditionalize the assignment of nBlockMin (which references `pindexPrev->nHeight`); however later checks, `pindexPrev->nHeight` is referenced even if the pindexPrev check failed; which would have caused a crash if pindexPrev was NULL.  This would occur if `chainActive->Tip()` returns null.  Given the logic of `getnextsuperblock`, the check added to preparebudget and submitbudget will generate a throw error if there is no active chain tip.

  **Remove unnecessary conditionals and code**
  `pindexPrev` is loaded from `chainActive.Tip()` pindexPrev->nHeight is checked multiple times in the parameter checking.  For ease of reading, pindexPrev->nHeight is now saved in a variable as it is used multiple times in the execution of the RPC commands in question.  Likewise, two function calls are used to determine the constant length of a budget cycle `Params().GetBudgetCycleBlocks()`; and is used several times.  Storing this information in a constant is more efficient then several calls for the information.

  nBlockMin is determined (the next superblock).  However later nNext was defined to be the exact same thing.  It's not necessary to build them both.

  By nature of validating that the chosen budget cycle block is greater than the current block, and validating the number of cycles is greater than zero; the need to check the end of the budget cycle is unnecessary.

  Having a separate throw message for choosing the wrong block (not a budget block), and specifying a block that has passed is unnecessary.  These have been combined so that the user, putting in the wrong block, is informed, in both cases, what the next budget block is.

  ### **Note**
  This PR was originally part of #964, but split out to distinguish between these changes and the other's refactoring.

ACKs for top commit:
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/pull/965/commits/72611349f10c94de54162ab1a226a81dd9af35fd
  Fuzzbawls:
    ACK 72611349f10c94de54162ab1a226a81dd9af35fd

Tree-SHA512: b0ccabae52d02767971104353b48d4efb76926017d7099b52b341d525710aa3a70d343c92c260048bb1c288990a914730a4dd0832578f07e96abb384d628cd4e

# Conflicts:
#	src/rpcmasternode-budget.cpp

* Updated fundamental node

* Merge #915: Modify GetNextWorkRequired to set Target Limit correctly

2bef330bc538d7b84a36915a8c60cb2ff7260bcf [Review] Move block identification to chainparams to support testnet also (Cave Spectre)
9294bbfd4629b2bacd62c9c4b55d92d248c0becc Modify GetNextWorkRequired to set Target Limit correctly on first PoS block (CaveSpectre11)

Pull request description:

  GetNextWorkRequired() was not setting the work required properly on the first Proof of Stake block.  The code section to cap the work at the bnTargetLimit wasn't called on that first block, but rather on the second Proof of Stake block.

  The end result is that the first PoS block uses the difficulty from the PoW, rather than capping it at the target limit; with the second PoS block capping it at the target limit:

  `uint256 bnTargetLimit = (~uint256(0) >> 24);`

  Creating a difficulty problem should the final PoW difficulty be greater than bnTargetLimit.

  ---
  This code has been tested on an altcoin; and I can provide debug output demonstrating the shift of the TargetLimit to 00000FFFF the block after the first PoS block should it be desired.

ACKs for top commit:
  random-zebra:
    ACK https://github.com/PIVX-Project/PIVX/pull/915/commit…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Block Generation Mining/Staking related issues Validation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants