* support set of keys to sign spork
* several addresses support in -sporkkey
* tests for multykey sporks
* command line option -minsporkkeys
* make spork active only after given number of signers
* use signature in spork hash calculation
* test for new and old spork messages interaction
* add multikeyspork.py to integration tests
* change test to have ability to distinguish default spork value
* require min spork keys number to be more than the half of the common spork keys number
* calc current spork value with majority of signers
* set test nodes time in integration test
* extract keyid from signed spork message directly
* change -sporkaddr option syntax to process several addresses
* codestyle fixes
* fix test comments
* codestyle fixes
* simplify CSporkManager::SporkValueIsActive
* Calc signature hash without signature field
* do not restore pubkey ids from cach
* Calc different keyids to check signature because not all sporks can be synced at moment
* codestyle fixes
* Fix CSporkManager::CheckAndRemove to use several keys
* codestyle fixes
* Correct processing of not actual spork6 value with GetSignerKeyID
* add locktransaction rpc call
* Remove special instantsend fee for simple transactions
* Function to check if trx is simple enough to be autolocked
* Automatic lock for all received from peers simple trxes
If we get a new transaction with CInv message and it is "simple" and
is accepted in mempool, we initiate its lock. We don't lock orphan trxes
that accepted in mempool after this trx because they are locked by other
peers.
* Automatically lock simple trxes in wallet
* protocol bump for InstantSend without special fee
* Add function to detect used mempool share
* Mempool threshold for auto IX locks
* Add SPORK_16_INSTANTSEND_AUTOLOCKS spork
* Make autolocks active only when spork SPORK_16_INSTANTSEND_AUTOLOCKS is active
* BIP9 autolocks activation
* revert increasing min peer protocol version for mn rank
* move IsTrxSimple check to CTxLockRequest class
* make MAX_INPUTS_FOR_AUTO_IX private member of CTxLockRequest class
* make AUTO_IX_MEMPOOL_THRESHOLD private member of CInstantSend class
* remove locktransaction RPC call
* tests for automatic IS locks
* fix mempool threshod calculation
* bump mocktime in activate_autoix_bip9
* set node times
* no need to spam the node with gettransaction rpc requests that often
* use `spork active` instead of leaking spork logic into tests
* codestyle fixes
* add test description in comments
* fix typo
* sync test nodes more often during BIP9 activation
* Use 4th bit in BIP9 activation
* Fix comments according codestyle guide
* Call AcceptLockRequest and Vote at the first node creating autoix lock
* fix mempool used memory calculation
* rallback not necessary change in CWallet::CreateTransaction
* test for stopping autolocks for full mempool
* Inject "simple autolockable" txes into txlockrequest logic
The SporkMessage is a lower-level construct which shouldn't be aware of
SporkManager. This commit moves the `sporkManager.IsSporkActive()` calls
outside the SporkMessage functions. This follows the dependency injection
pattern and makes it easier to test SporkMessage as well.
* CSporkManager class serialization
* Read/write sporks.dat file
* Move mapSporks into CSporkManager and serialize it
* fix GetSporkByHash
* spork tests
* add missed cs lock
* clear mapSporksByHash in CSporkManager::Clear
* use spork active rpc call to hide spork inner logic
* set small pause between rpc calls in cycles
* Drop CInstantSend::IsEnoughOrphanVotesForTxAndOutPoint
* small cleanup in rpc tests
* move some pieces from .h to .cpp
* fix few log outputs
* fix some comments
* some trivial fixes + readability
* Support passing CKeyID to CMessageSigner/CHashSigner
* Use Dash addresses instead of raw public keys for sporks
The spork addresses are identical to the previously used public keys.
Also use CKeyID/CKey directly inside CSporkManager instead of parsing the
addresses/keys over and over. The default spork key (from chainparams) is
initialized with InitDefaultSporkAddress(). SetPrivKey parses the private
key now and stores it in sporkPrivKey instead of parsing it in
CSporkMessage::Sign().
* Allow setting of spork address via command line
* Remove unused strMasternodePaymentsPubKey chainparam
Traces from the past...
* Review fixes
1. Remove the need for InitDefaultSporkAddress
2. Remove bogus checks for hex private keys
3. Alphabetical order for new include
4. Add . to help string
* Add regtest spork key
As this key is not meant to be private, the private key is also added in
the form of a comment (for later use in regtests)
* Review fixes
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (gobject)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (gobjvote)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (mnw)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (txlvote)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (dsq)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (dstx)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (spork)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (mnb)
* Actually care about old signature format in mnp, otherwise we can start banning peers rather quickly
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (mnv)
* Unify sign/verify code a bit by using GetSignatureHash() (even when it matches GetHash())
* fix docs
* address review comments
* fix log output (copy/paste error)
* Replace custom GetSignatureHash/GetHash with serialization (where applicable)
* Convert from/to old format in SerializationOp only for p2p
* fix
* Use new spork SPORK_6_NEW_SIGS to fix masternode payment vote signature format
* Use SPORK_6_NEW_SIGS to also fix masternode ping signature format
* Use SPORK_6_NEW_SIGS to also fix privatesend queue signature format
* adjust spork6 description in docs
* mnp hashing/signing changed - hash everything and use SignHash/VerifyHash directly instead of constructing a string to sign (both activate via SPORK_6_NEW_SIGS)
* fix
* cleanup
0729102 Net: pass interruptMsgProc as const where possible (Jorge Timón)
fc7f2ff Net: Make CNetMsgMaker more const (Jorge Timón)
d45955f Net: CConnman: Make some methods const (Jorge Timón)
Pass reference to CConnman instance to methods of CSporkManager and
CSporkMessage instead of using g_connman global variable.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
- rename all 3 instantsend sporks
- remove SPORK_7_MASTERNODE_SCANNING (not used anymore)
- change `_DEFAULT` for spork 2 and 3, adjust comments for for them
- fix GetSporkNameByID() (should not return smth_DEFAULT)
068c178 Added DBG macro in util.h to facilitate debugging
- This macro allows debugging statements (typically printf's or cout's) to
be activated or deactivated with a single comment. Uncomment the line:
//#define ENABLE_DASH_DEBUG
in util.h to enable debugging statements.
- When commented any code wrapped with the DBG() macro will simply be removed
by the preprocessor. When not commented all such wrapped statements will
be present.
- For maximum effectiveness it is best that util.h be the first effective include
in all source files. It is also possible to enable the macro for a single file
by temporarily adding #define ENABLE_DASH_DEBUG to the top of the file.
- Code committed to non-development branches should always have the define
commented.
d125d9b V0.12.1.x -- merging trigger/generic object/superblock changes for testnet phase II
- This commit contains the core governance system changes for 0.12.1. Any unrelated
changes have either been removed or moved to separate commits.
120724c File mode fixes
- Changed mode 0755->0644 on several source files.
c7f9e11 Updated todo reminders
- Added reminder to revert temporary reduction of number of votes
required to trigger superblock to 1 for testing
92adc98 Made CSuperblockManager::IsValidSuperblockHeight an inline function
- This is for efficiency since this function is called often and is
only 1 line of code.
c050ed7 Added comment explaining rationale for no LOCK(cs) in CSuperblock::IsValid
dc933fe Removed unused CSuperblockManager::IsBlockValid function
decec88 Moved calls to SuperblockManager::IsValidSuperblockHeight into IsSuperblockTriggered.
- Since calls to the later function are always protected by the former there's
no reason to keep these separate and this simplifies the code in
masternode-payments.cpp.
8672885 Reestablished expected value check for non-superblocks in IsBlockValueValid
b01cbe0 Changes to IsBlockValueValid to fix rpc test failure
a937c76 Changed include order to allow per file activation of the DBG macro
d116aa5 Fixed IsValidSuperblockHeight logic
- Note this has an effect on testing because we can now only create
1 superblock per day. Devs may need to temporarily change testnet params
for easier testing.
2d0c2de Convert superblock payments to CAmount
- We assume that payment values in JSON are in units of DASH
for consistency with other RPC functions, such as
createrawtransaction.
376b833 Revert temporary testing value for nAbsVoteReq
- Also ensure that number of votes required is never smaller than 1
8c89f4b Cleaned up CSuperblock error handling
- Exceptions are now thrown consistently rather than using a mix of
exceptions and return code checking. Exceptions are now caught only
in AddNewTrigger when the CSuperblock constructor is called. Unnecessary object
status members have been removed.
d7c8a6b Removed utilstrencodings header
- This appears to help with travis tests, for unknown reasons.
c4dfc7a Fixed some minor code review issues
63c3580 Reverted locking change in miner.
- This should have been done in the original PR but was overlooked.
4ab72de Fixed variable name to match common practice and bracket formatting
886a678 Improvements to vote conversion code
- Replaced redundantly defined function with inclusion of governance-vote.h
- Replaced magic numbers with their corresponding constant symbols
0a37966 Reordered governance message handling
5bb8dca Fixed non-deterministic CSporkMessage hash function
CSporkMessage::GetHash() was including random data
in the hash due to 4 bytes of structure padding between the 32 bit
nSporkID and the following 64 bit nValue members.
This has been fixed by using CHashWriter which serializes the structure
data properly before hashing rather than relying on compiler defined behavior
such as structure alignment. The underlying hash function is CHash256 which is
bitcoin's double SHA-256 hash. HashX11 is not necessary here
because the hash is only used to identify distinct spork messages.
42bdf42 Refactor/fix spork:
- move ProcessSpork, GetSporkValue, IsSporkActive, ExecuteSpork and mapSporksActive to CSporkManager
- move Sign, CheckSignature, Relay to CSporkMessage
- move ReprocessBlocks out of sporks to main.cpp / rename DisconnectBlocksAndReprocess to DisconnectBlocks
- rename SporkKey to SporkPubKey
- bugfix: only set strMasterPrivKey if spork signature produced by that key was verified successfully
- few log format changes, cleaned up includes
- Client bump
- Improved syncing logic (sholud stop hanging issues)
- New spork for turning on super blocks
- Fixed issue with sending old/invalid finalized budgets
- Fixed issue with syncing clients and lack of confirmations with budget items (for IX)
- Implemented spork for only paying new nodes after a period of time on mainnet
- protocol bump
- fixed a few issues with sporks. Spork show now shows all sporks, instead of the changed ones. IsSporkActive now supports sporks set to 0 as on.
- Added FindProposal and FindFinalBudget to budgeting class
- Added 2 new sporks for Proposals and Budget payment enforcement. This is outside of the decentralized code so we can turn it off if there's a problem.
- Detect budget blocks and pay correct amounts in super blocks
- Ensures ports remain open and client are responsive to IX requests.
- Completely 100% decentralized. This farms out the work of checking the masternode network to the masternode network. 1% of the network is determistically selected to check another 1% of the network each block. It takes six separate checks to deactivate a node, thus making it tamper proof.
- Nodes are kept in the masternode list if they fail enough PoSe checks to deactivate. They will continue to be checked until the operator fixes them. However they will not be paid while they're failing checks.