Commit Graph

15856 Commits

Author SHA1 Message Date
Alexander Block
aeb4c60c8e Reimplement CMNAuth::NotifyMasternodeListChanged to work with new interface 2019-04-09 13:28:53 +02:00
Alexander Block
fa90c0204f Also call NotifyMasternodeListChanged when MNs have been updated
And not only when added/removed.
2019-04-09 13:28:53 +02:00
Alexander Block
db781b32dc Pass oldList and diff instead of newList into NotifyMasternodeListChanged 2019-04-09 13:28:40 +02:00
UdjinM6
1ba8694cd7
Various fixes for RemoveInvalidVotes() (#2845)
* Fix crash in RemoveInvalidVotes()

Caused by lock not being held while accessing lastMNListForVotingKeys when RemoveInvalidVotes() is called from DoMaintenance() and UpdatedBlockTip() at the same time.

* No need to call RemoveInvalidVotes() from DoMaintenance()

MN list only changes on new blocks and we already call RemoveInvalidVotes() from UpdatedBlockTip()

* No need to call RemoveInvalidVotes() until we are fully synced
2019-04-08 08:38:13 +03:00
Alexander Block
b5bc7c9dac Call HandleFullyConfirmedBlock when ChainLocks are enabled but not enforced (#2844)
Otherwise IS locks never get removed before DIP8 activates via BIP9.
2019-04-08 08:07:47 +03:00
UdjinM6
9fa09b974b
CBLSWrapper::SetHexStr() should not accept non-hex strings (#2843)
* CBLSWrapper::SetHexStr() should not accept non-hex strings

* Rework to implement suggested behaviour
2019-04-08 08:07:26 +03:00
Nathan Marley
0f0d8eaf48 Add RPC for BLS secret to public key (#2841)
* Add RPC for BLS secret to public key

* Simplify and unify "bls s2pk"

* Reuse "generate"

* Revert "Reuse "generate""

This reverts commit c12388c5b5d54f6b8221c1e086e916426bb331c4.

* Rename sk2pk to fromsecret
2019-04-08 08:06:54 +03:00
UdjinM6
2c72c075af
Merge pull request #2842 from UdjinM6/mergemaster133develop
Merge master v0.13.3 into develop
2019-04-08 08:05:42 +03:00
UdjinM6
fa6db6d69b Merge branch 'master' into mergemaster133develop 2019-04-05 20:52:53 +03:00
UdjinM6
6982d98548 Ignore cache files on reindex (#2840) 2019-04-05 14:39:30 +02:00
Alexander Block
565754e019
Merge pull request #2839 from codablock/pr_llmq_scanquorumsfix
Fix invalid results from ScanQuorum
2019-04-05 14:39:17 +02:00
Alexander Block
f8bedba7c4
Don't retry locks when new IS system is disabled (#2837)
Retrying still failed, but this spammed logs quite a bit.
2019-04-05 14:38:58 +02:00
Peter Bushnell
92feade817 Remove unused forward declaration (#2838) 2019-04-05 14:38:45 +02:00
Alexander Block
206e5a1b47 Use big endian inversed height in CInstantSendDb 2019-04-05 13:40:18 +02:00
Alexander Block
4b9f6cd3a9 Use big endian inversed height in BuildInversedHeightKey
Otherwise keys are not properly sorted.
2019-04-05 13:39:29 +02:00
Alexander Block
53656b3e82 Compare CDataStream internal vector with unsigned comparison 2019-04-05 13:37:58 +02:00
Alexander Block
dd21d046f5 Avoid unnecessary calls to parentIt->GetKey 2019-04-05 13:37:25 +02:00
Alexander Block
1caee15425
Merge pull request #2836 from codablock/pr_is_removeconfirmed
Better handle removing of fully confirmed IS locks
2019-04-05 10:13:56 +02:00
Alexander Block
d34ec78664 Update wallet transactions when confirmed IS locks are removed 2019-04-05 08:18:56 +02:00
Alexander Block
b897505f85 Remove the need for maintaining the last ChainLocked block in the DB 2019-04-05 08:05:12 +02:00
Alexander Block
8e7083cb89 Use db.RemoveConfirmedISLocks() in NotifyChainLock to remove confirmed locks
Also move the actual logic into HandleFullyConfirmedBlock and call it
from NotifyChainLock and UpdatedBlockTip.
2019-04-05 08:05:12 +02:00
Alexander Block
4577438e87 Implement RemoveConfirmedInstantSendLocks to prune confirmed IS locks from DB 2019-04-05 08:05:12 +02:00
Alexander Block
d6e7758519 Keep track of when IS locks were mined 2019-04-05 06:36:09 +02:00
Alexander Block
20ec1de4c6
Merge pull request #2833 from codablock/pr_dip4_quorums
Implement quorum merkle roots for DIP4 coinbases and add quorums to MNLISTDIFF
2019-04-05 05:58:05 +02:00
UdjinM6
0a6416e064 Wipe llmq db on reindex (#2835) 2019-04-05 05:57:46 +02:00
Peter Bushnell
4af5ea8a7f Remove netfulfilledman.h duplicate (#2834) 2019-04-05 05:57:33 +02:00
UdjinM6
208406df71 Re-introduce nInstantSendKeepLock check for LLMQ-based IS when spork19 is OFF (#2829) 2019-04-05 05:55:30 +02:00
Alexander Block
7d765a0fce Track best block to later know if a DB upgrade is needed 2019-04-04 17:58:51 +02:00
UdjinM6
1a25c2084c Apply suggestions from code review
Co-Authored-By: codablock <ablock84@gmail.com>
2019-04-04 17:41:30 +02:00
Alexander Block
282cb697aa Use version 2 CCbTx in create_coinbase to fix test failures 2019-04-04 12:27:35 +02:00
Alexander Block
adc101a11a Implement quorum commitment merkle root tests in dip4-coinbasemerkleroots.py 2019-04-04 12:27:35 +02:00
Alexander Block
40ad06e775 Return the fresh quorum hash from mine_quorum 2019-04-04 12:27:35 +02:00
Alexander Block
17b9318a04 Mine SIGN_HEIGHT_OFFSET additional blocks after the quorum commitment
Otherwise the fresh quorum won't be eligable for signing sessions.
2019-04-04 12:27:35 +02:00
Alexander Block
5e832e2fa6 Implement support for CbTx version 2 (with quorum merkle root)
Also implement support for new fields in MNLISTDIFF.
2019-04-04 12:27:35 +02:00
Alexander Block
b1b41f02ae Fix a crash in mininode.py when inventory type is unknown 2019-04-04 12:27:35 +02:00
Alexander Block
44a3b9c90f Don't use pindex->GetBlockHash() in ProcessCommitment
The block hash is not necessarily set at this point, for example when
coming from TestBlockValidity().
2019-04-04 12:27:35 +02:00
Alexander Block
f9dbe3ed50 Track in which block a quorum commitment was mined
And return it in GetMinedCommitment and the "quorum info" RPC
2019-04-04 12:27:35 +02:00
Alexander Block
ba459663be Add deletedQuorums and newQuorums to CSimplifiedMNListEntry 2019-04-04 12:27:35 +02:00
Alexander Block
8f7929bed8 Implement and enforce quorum commitment merkle roots in coinbases
This bumps CCbTx::CURRENT_VERSION to 2 and enforces the new version after
DIP8 BIP9 activation.
2019-04-04 12:27:35 +02:00
Alexander Block
07620746a5 Implement GetMined(AndActive)CommitmentsUntilBlock and use it in ScanQuorums
This fixes a bug in ScanQuorums which made it return quorums which were not
mined at the time of pindexStart. This was due to quorumHashes being based
on older blocks (the phase=0 block) which are ancestors of pindexStart even
if the commitment was actually mined in a later block.

GetMinedAndActiveCommitmentsUntilBlock is also going to be used for quorum
commitment merkle roots in CCbTx.

This also removes GetFirstMinedQuorumHash as it's not needed anymore.
2019-04-04 12:27:35 +02:00
Alexander Block
d5250a333a Track at which height a quorum commitment was mined
Also add upgrade code to allow smooth upgrades from v13 to v14.
2019-04-04 12:27:35 +02:00
Alexander Block
806948f90e Store the full commitment in CQuorum
Instead of just individual fields of it.
2019-04-04 12:27:35 +02:00
Alexander Block
b67f6a0dc6 Implement CDBTransactionIterator
This iterator allows merged iteration of the key/values from the parent and
the not-yet-committed key/values from the transaction. This also works for
nested transactions (as used in CEvoDB).

It's interface mimics CDBIterator.
2019-04-04 12:27:35 +02:00
Alexander Block
6d1599bc68 Change CDBTransaction to compare keys by their serialized form
...instead of comparing by using the keys < operator.
There are 2 reasons for this:
1. This better mimics the behavior of CDBWrapper. Otherwise there is
   a chance of discrepancy when it comes to key equality.
2. Next commit will introduce CDBTransactionIterator, which relies on
   CDBTransaction and CDBWrapper being compatible in the way keys are
   compared.
2019-04-04 12:27:35 +02:00
Alexander Block
5482083eba Support passing CDataStream as key into CDBWrapper/CDBBatch/CDBIterator
This allow to pre-serialize keys in advance and pass the serialized form
into these classes.
2019-04-04 12:27:35 +02:00
Alexander Block
92c1cdcb81
Merge pull request #2832 from codablock/pr_dip4_tests
Implement DIP4 integration tests
2019-04-04 12:26:38 +02:00
UdjinM6
c23dfaf573
Update qa/rpc-tests/dip4-coinbasemerkleroots.py
Co-Authored-By: codablock <ablock84@gmail.com>
2019-04-04 11:46:52 +02:00
Alexander Block
9f2e5d0852 Use FromHex to deserialize block header 2019-04-04 10:42:13 +02:00
Alexander Block
999848432a Implement dip4-coinbasemerkleroots.py integration tests 2019-04-04 10:39:15 +02:00
Alexander Block
ade5760a92 Allow registering MNs without actually starting them
This can be done by calling prepare_masternode() when inside run_test.
Also implement remove_masternode() which spends the collateral.
2019-04-04 10:39:15 +02:00