* Add LLMQ parameters to consensus params
* Add DIP6 quorum commitment special TX
* Implement CQuorumBlockProcessor which validates and handles commitments
* Add quorum commitments to new blocks
* Propagate QFCOMMITMENT messages to all nodes
* Allow special transactions in blocks which have no inputs/outputs
But only for TRANSACTION_QUORUM_COMMITMENT for now.
* Add quorum commitments to self-crafted blocks in DIP3 tests
* Add simple fork logic for current testnet
This should avoid a fork on the current testnet. It only applies to the
current chain which activated DIP3 at height 264000 and block
00000048e6e71d4bd90e7c456dcb94683ae832fcad13e1760d8283f7e89f332f.
When we revert the chain to retest the DIP3 deployment, this fork logic
can be removed again.
* Use quorumVvecHash instead of quorumHash to make null commitments unique
Implementation of https://github.com/dashpay/dips/pull/31
* Re-add quorum commitments after pruning mempool selected blocks
* Refactor CQuorumBlockProcessor::ProcessBlock to have less nested if/else statements
Also add BEGIN/END markers for temporary code.
* Add comments/documentation to LLMQParams
* Move code which determines if a commitment is required into IsCommitmentRequired
This should make the code easier to read and also removes some duplication.
The also changes the error types that are possible from 3 to 2 now. Instead
of having "bad-qc-already-mined" and "bad-qc-not-mining-phase", there is
only "bad-qc-not-allowed" now.
* Use new parameter from consensus parames for the temporary fork
* check request is not empty to use it for filtering
* Filter vote INVs by tx hash
* fix lock requests filtering
* Apply suggestions from code review
Co-Authored-By: gladcow <sergey@dash.org>
* Properly initialize confirmedHash in CSimplifiedMNListEntry
* Add consensus params for temporary hard-fork on testnet
This hard-fork is required on testnet as we have to fix a few consensus
bugs in DIP3/DIP4. It will also be required to introduce LLMQ commitments
to testnet.
* Add temporary fork-logic for testnet, which sets confirmedHash to null
...before fork activation. Otherwise we'd invalidate all DIP3 blocks on
testnet.
* Bump nTemporaryTestnetForkHeight to 273000
Mixing on a newer version with small number of upgraded masternodes
causes mixing txes to "stuck" - old nodes refuse to relay dstxes from new ones because
they come from the same masternodes too often. Basing threshold on the total number
of up to date masternodes and not only on a newer (enabled) ones should solve this.
This however will cause mixing to fail if there are not enough masternodes
on the needed protocol version (i.e. at least GetMinMasternodePaymentsProto())
but it's better to stop mixing than having funds kind of spent yet not confirmed
for a long time.
* Fix wrong index for argument to protx_update_service when error is thrown
* Unify and fix variable name in TxToJSON
The UniValue variable name for TRANSACTION_COINBASE was wrong and is fixed
now. Also changed names for all other special TXs to unify names. This
should avoid such errors in the future when new "else if" branches are
copy/pasted.
* Use "proRegTx" instead of "proTx" as key TRANSACTION_PROVIDER_REGISTER payloads
* Implement context menu and extra info on double-click for DIP3 masternode list
Menu items:
- "Copy ProTx hash"
- "Copy Collateral hash"
On double click:
Show simple message box with the json representation of the DMN.
* Fix review comments
* Do not hold cs_main while emitting messages
Fixes potential deadlock:
```
POTENTIAL DEADLOCK DETECTED
Previous lock order was:
(1) cs_deqsessions privatesend-client.cpp:966
(2) cs_main privatesend-client.cpp:816
Current lock order is:
(2) cs_main qt/walletmodel.cpp:299
wallet->cs_wallet qt/walletmodel.cpp:299
(1) cs_deqsessions privatesend-client.cpp:350
```
* Keep CWalletTx* newTx in inner scope
* Fix incorrect inline help for "protx update_registrar"
Initial ProRegTx does not define a field named "collateralAddress". It is not necessary to use the collateral address to receive payout, any Dash address can be defined here.
* Fix incorrect syntax for "protx revoke" inline help
"operatorKey" is required here
* Updating de, es, fi, nl, pt, sk, zh_CN, zh_TW
Known issues:
dash_zh_CN.ts: Mismatch between 'Start &all' and '启动全部(%A)'
dash_zh_CN.ts: Mismatch between 'Open the %1 debug log file from the current data directory. This can take a few seconds for large log files.' and '打开当前目录中的调试日志文件。日志文件大的话可能要等上几秒钟。'
dash_zh_CN.ts: Mismatch between 'Too many %f denominations, removing.' and '太多面额化资金,正在移除。'
dash_zh_CN.ts: Mismatch between 'Initialization sanity check failed. %s is shutting down.' and '初始化完整性检查失败。% 即将
* Fix issues in zh_CN
* Implement tab for DIP3 MN list
* Update src/qt/masternodelist.cpp
Co-Authored-By: codablock <ablock84@gmail.com>
* Change "x.xx% to UNSPECIFIED" to "x.xx% but not claimed" for opeartor reward
* Track confirmedHash of masternodes
* Also include confirmedHash in DIP4
* Implement CalculateQuorum and CalculateScores in CDeterministicMNList
* Use new ProRegTx based scoring function in GetMasternodeScores
* Update test vectors for simplifiedmns_merkleroots tests
* Implement VersionBitsCountBlocksInWindow
This gives the count of blocks that voted for the given BIP9 deployment
* Add additional information to BIP9 softforks returned by getblockchaininfo
* make sure progress doesn't exceed 1
* Allow to reuse collaterals and addresses in ProRegTx
This also requires to move out the duplication check from CheckService to
the 2 individual ProTx check methods.
* Implement replacement logic for reused collaterals
* Add tests for new replacement logic
* Update defaultAssumeValid and nMinimumChainWork for mainnet
* Update defaultAssumeValid and nMinimumChainWork for testnet
* Add checkpoint for mainnet
* Add checkpoint for testnet
* RPC - Correct protx register_prepare help example
Use collateral hash and index instead of address
* RPC - Change protx register help ECDSA address to BLS operator key
* RPC - protx register_prepare help correction
Should direct to protx register help, not protx register_fund
* RPC - protx help typo
* Bump PS
- add 5th denom (0.001)
- always allow OP_RETURN in PS collaterals
- collateral amount is always 1/10 of the smallest denom
- bump MIN_PRIVATESEND_PEER_PROTO_VERSION to 70211
* drop backward compatibility in dsa/dsq serialization
* Use GetSmallestDenomination() in GetCollateralAmount()
* bump MIN_PRIVATESEND_PEER_PROTO_VERSION to 70212
* update en source
* remove pt_BR
it's no longer present on Transifex
* Update existing translations
NOTE: there are some mismatches in zh_CN
dash_zh_CN.ts: Mismatch between 'Start &all' and '启动全部(%A)'
dash_zh_CN.ts: Mismatch between 'Open the %1 debug log file from the current data directory. This can take a few seconds for large log files.' and '打开当前目录中的调试日志文件。日志文件大的话可能要等上几秒钟。'
dash_zh_CN.ts: Mismatch between 'Too many %f denominations, removing.' and '太多面额化资金,正在移除。'
dash_zh_CN.ts: Mismatch between 'Initialization sanity check failed. %s is shutting down.' and '初始化完整性检查失败。% 即将关闭。'
* Add ar, ko, th
NOTE: there are 2 mismatches in ar
dash_ar.ts: Mismatch between '(of %1 GB needed)' and '(على 1% جيغابايت محتاجة)'
dash_ar.ts: Mismatch between 'Output debugging information (default: %u, supplying <category> is optional)' and 'معلومات تصحيح الخرج <category>ا(ختياري)'
* update bg, it, ja, ko, nl, pl, th
* fix ru
* add tr
* fix
* Remove reference to now removed "protocolVersion"
* Allow to use non-DIP3 collaterals after DIP3 activation
This removes a rule which only made sense when we assumed all collaterals
would remain in DIP3 ProRegTx transactions after DIP3 activation.
As we allow to refer external collaterals now, this rule should vanish as
well.
* Sleep in case block time is ahead of real time
See comment. This was not a problem before as we had enough time passed
between the last block that caused this and the start-alias call.
Now we added another start-alias call which is directly after we generated
many blocks.
* drop most of custom PS logic from SelectCoins and inject it into regular flow (i.e. SelectCoinsMinConf)
* different priority for different denoms
* move CompareByPriority higher
* update comment
Co-Authored-By: UdjinM6 <udjinm6@gmail.com>
Add decimal places to clarify:
1. Non-integers are valid (e.g. 3.25)
2. Granularity - anything beyond x.xx is rounded (e.g. 3.259 -> 3.26)
This is due to DIP3 allowing values 0-10000 for operator reward (1/10000
= 0.01%)
* Do not run scheduled DoMaintenance if shutdown was requested
* Don't dump cache files if the load sequence was interrupted
* Stop privatesend and release keys before wallet flush
* fix typo
* fLiteMode should be set via GetBoolArg before first usage
Also move related stuff to be closer to each other
* Cleanup Dash-specific init steps
* Move deterministicMNManager creation slightly higher for consistensy
* RPC: Add help details for the bls RPC
* RPC: Refactor to match gobject RPC behavior
* RPC: Use command instead of strCommand for consistency within file
* RPC: BLS help cleanup
* RCP: Remove leading underscore on bls_help
* Don't crash when spork15 is enabled but no MNs have been registered
* Don't bail out when no masternode payee is found
We should pay superblocks even if no masternode payee is found.
* Add missing newline to LogPrint call
* Handle review comments
* Add BIP9 parameters for DIP3 deployment on testnet
* Remove autoix BIP9 deployment and reuse DIP3 deployment
* Add BIP9CheckMasternodesUpgraded to chain params
This controls if miners should check for upgraded masternodes first before
adding BIP9 bits to the block version. This only makes sense in network
where masternodes are up and running before BIP9 activation, which is not
necessarely the case in regtest and devnet.
Also refactor ComputeBlockVersion to use fCheckMasternodesUpgraded instead
of the inverse fAssumeMasternodeIsUpgraded. It is set to false by default
and only set to true in CreateNewBlock.
* Check for upgraded masternodes for DIP3 activation (only mainnet and testnet)
* Bump PROTOCOL_VERSION and DMN_PROTO_VERSION
We probably have nodes with 70211 already running on testnet.
* Implement RemoveAskFor to indicate that we're not interested in an item anymore
When an INV item is received from the first node, the item is requested
immediately. If the same item is received from another node, an entry is
added to mapAskFor which marks the item for re-requesting in case the first
node did not respond. When the item is received from the first node,
the item was previously never removed from mapAskFor. Only the later getdata
loop in SendMessages would then gradually remove items from the map. This
is quite delayed however as the entries in mapAskFor have a timeout value.
RemoveAskFor allows to remove all entries from mapAskFor and setAskFor
when we are not interested in the item anymore (e.g. because we received
it already).
* Call RemoveAskFor whenever we receive a message
* Only pass hash instead of CInv object to RemoveAskFor
* Add pooled_secure_allocator and mt_pooled_secure_allocator
* Use mt_pooled_secure_allocator for BLS secure allocation
The old solution relied on thread-local-storage and was thus not compatible
to libc6 2.11 (which is the minimum supported version we use).
Also, the old solution turned out to be erroneous. It would have crashed
or memory leaked when ownership of CBLSPrivateKey would be handled over
to another thread.
* Add new header files to Makefile.am
* Fix copyright headers of new files
* Bail out early from secure deallocation
* Clean up global BLS keys when shutting down
* Remove global fDIP0003ActiveAtTip flag and always use VersionBitsState
fDIP0003ActiveAtTip was used much more often when introduced but turned out
to be not very useful in most places. Always use VersionBitsState now.
* Fix wrong use of VersionBitsState auto IX
* Make sure isAutoLockBip9Active flag is reset in case of chain reorgs
* Pass CCoinsView reference to special TX handling methods
* Allow referencing other TX outputs for ProRegTx collateral
* Remove "collateralAmount" from "protx register"
* Rename "protx register" to "protx fund_register"
* Remove UpdateSpork15Value from CDeterministicMNManager
Was not used/implemented anymore
* Lock masternode collaterals after chain/DIP3 is fully initialized
Otherwise detection of collaterals does not work.
* Implement new "protx register" RPC which uses existing collaterals
* Remove "masternode info" RPC
It is not consistent with other "masternode" RPCs anymore as it requires
the ProRegTx hash while all other RPCs work with the collateral.
* Load sporks from disk cache before initializing the chain
Otherwise spork15 is not loaded when we check it for the first time.
* Implement "protx info" RPC
* Use "protx info" instead of "masternode info" in DIP3 tests
* Test external collaterals for ProTx
* Handle review comments
* Don't pass CCoinView reference when it's not used
* Revert "Pass CCoinsView reference to special TX handling methods"
This reverts commit 28688724e1.
* Use GetUTXOCoin instead of now removed coinsView
Also remove collateral height check as GetUTXOCoin only returns confirmed
coins.
* Add conflict handling for external collaterals to mempool
* Handle review comments (squashed Github suggestions)
Co-Authored-By: codablock <ablock84@gmail.com>
* Clear devNetParams and mimic behavior of other param types
Mainnet, testnet and regtest params are global and thus zero initialized,
we should mimic the same for devnet params.
Not doing so results in all kinds of issues on devnet.
* Remove unnecessary <string.h> includein chainparamsbase.cpp
* Allow to use low difficulty and higher block rewards for devnet
Configurable through -minimumdifficultyblocks, -highsubsidyblocks and -highsubsidyfactor
* Fix review comments
* Handle review comments
* Remove nProtocolVersion fields from deterministic masternode lists
This field was part of my initial implementation from DIP3. One of the last
changes of DIP3 was then to remove this field, which I did not bring back
into code yet. This commit removes it now.
We use PROTOCOL_VERSION now in cases were compatibility in the the pre-DIP3
list is needed.
* Add type and mode fields in DIP3 special TXs
These were added to DIP3 but not in-code yet.
* Add DMN_PROTO_VERSION
* Use BLS keys for operator keys
* Add "bls generate" RPC to generate BLS keys
* Use unique_ptr to store blsKeyOperator and blsPubKeyOperator
Needed because the Chia BLS library crashes when keys are created before
the library is initialized, even if keys are not used. This is the case here
as we have static instances here.
* Remove unnecessary CheckSignature calls
This seems to be some garbage I left in by mistake.
* Fixed review comments
* Fix rpc help for operator keys
All keys that are used as examples are random. None of the secret keys
belongs to any of the public keys.
* Use .GetHash() instead of ::SerializeHash() for BLS pubkeys in txmempool.cpp
* Rename mapProTxBlsPubKeys to mapProTxBlsPubKeyHashes
* Move handling of size >= SerSize into SetBuf/GetBuf
Instead of performing this in the individual implementations of
InternalSetBuf and InternalGetBuf
* Assert that size if GetBuf is always SerSize
* fix CTxLockRequest::GetMinFee()
* Force regular IS txes to include MIN_FEE * n_inputs fee on creation regardless of auto-IS status
* set_autoix_spork_state should bump mocked time
* make sure IS fee matches the expected one
* turn off spork16 and test all types of txes again
* Alternative solution: pick rounds with the most inputs available to mix first
* randomly skip some inputs when we have at least one of this denom already
* More randomization in PrepareDenominate
* fix `vecSteps[nBit] >= 1 ?` and adjust speed/privacy ratio for more speed i.e. `GetRandInt(5) == 0`
* fix typos
* no comments