* Pass nAcceptTime via TransactionAddedToMempool and use it for ChainLocks
Otherwise the "first seen" time is way off after node restart
* Don't skip TransactionAddedToMempool for chainlocks while blockchain is not synced yet
Otherwise txes from mempool.dat won't be processed there
* Don't rely on UTXO set in CheckCanLock
The UTXO set only works for TXs in the mempool and won't work when we try
to retroactively lock unlocked TXs from blocks.
This is safe as ProcessTx is only called when a TX was accepted into the
mempool or connected in a block, which means that all input checks were
good.
* Rename RetryLockMempoolTxs to RetryLockTxs and let it retry connected TXs
* Instead of manually calling ProcessTx, let SyncTransaction handle all cases
SyncTransaction is called from AcceptToMemoryPool and when transactions got
connected in a block. So this is the time we want to run TXs through
ProcessTx. This also enables retroactive signing of TXs that were unknown
before a new block appeared.
* Test retroactive signing and safe TXs in LLMQ ChainLocks tests
* Also test for retroactive signing of chained TXs
* Honor lockedParentTx when looking for TXs to retry signing
* Stop scanning for TXs to retry after a depth of 6
* Generate 6 block to avoid retroactive signing overloading Travis
* Avoid retroactive signing
* Don't rely on NewPoWValidBlock and use SyncTransaction to build blockTxs
NewPoWValidBlock is not guaranteed to be called when blocks come in fast.
When a block is accepted in AcceptBlock, NewPoWValidBlock is only called
when the new block is a successor of the currently active tip. This is not
the case when after the first block a second block is accepted immediately
as the first block is not connected yet.
This might be a bug actually in the handling of NewPoWValidBlock, so we
might need to check/fix this later, but currently I prefer to not touch
that part.
Instead, we now use SyncTransaction to gather TXs for blockTxs. This works
because SyncTransaction is called for all transactions in a freshly
connected block in one go. The call also happens before UpdatedBlockTip is
called, so it's fine with the existing logic.
* Use tx.IsCoinBase() instead of checking index 0
Also check for empty vin.
* Remove CActiveLegacyMasternodeManager
* Remove sentinelping RPC
* Remove unused P2P messages and inv types
There are still places where these are used in the code. The next commits
will clean these up.
* Remove MNB/MNP/MNVERIFY related code from masternode(man).h/cpp
* Remove all legacy code regarding block MN payee voting
* Remove MASTERNODE_SYNC_LIST and MASTERNODE_SYNC_MNW states
Also replace all uses of IsMasternodeListSynced and IsWinnersListSynced
with IsBlockchainSynced.
* Remove unsupported masternode RPCs
* Remove UpdateLastPaid methods
* Remove duplicate deterministicmns.h include
* Remove masternode.conf support
* Remove legacy MN lists support from masternode list GUI
* Remove unnecessary AskForMN call
* Remove compatibility code in CPrivateSendQueue::GetSignatureHash
* Don't add locally calculated MN payee in case GetBlockTxOuts failed
This is not valid in DIP3 mode
* Remove check for IsDeterministicMNsSporkActive in "masternode status"
* Move CMasternode::IsValidNetAddr to CActiveDeterministicMasternodeManager
* Remove use of CMasternode::CheckCollateral in governance code
* Remove uses of MASTERNODE_SENTINEL_PING_MAX_SECONDS/MASTERNODE_SENTINEL_PING_MAX_SECONDS
* Remove support for "-masternodeprivkey"
* Remove pre-DIP3 vote cleanup
* Remove compatibility code for quorumModifierHash/masternodeProTxHash
* Remove check for invalid nBlockHeight in CMasternodePayments::GetBlockTxOuts
...and let it crash instead. We expect this method to be called with the
correct height now (after DIP3 was fully deployed).
* Remove ECDSA based Sign/CheckSignature from CGovernanceObject
Only masternodes sign governance objects, so there is no need for ECDSA
support here anymore.
* Always add superblock and MN reward payments into new block
* Always check block payees (except if fLiteMode==true)
* Always allow superblock and MN payees in same block
* Remove/Fix a few references to masternode.conf and related stuff
Also delete guide-startmany.md and masternode_conf.md
* Implement NotifyMasternodeListChanged signal and call governance maintenance
* Remove non-DIP3 code path from CMasternodeMan::Find
* Remove remaining unused code from CMasternode/CMasternodeMan
* Always load governance.dat on startup
* Mine an empty block instead of incrementing nHeight from chain tip in miner tests
This test is crashing otherwise in GetBlockTxOuts as it tries to access a
previous block that is not existing.
* Skip MN payments verification on historical blocks (pre-DIP3 blocks)
Even though DIP3 was active on BIP9 level, the spork was not active yet at
that point meaning that payments were not enforced at that time.
* Remove unused state and CollateralStatus enums
* Unconditionally return false from IsBlockPayeeValid when IsTransactionValid returns false
IsTransactionValid already handles the case where IsDIP3Active() returns
false, making it return true.
* Add override keyword to CDSNotificationInterface::NotifyMasternodeListChanged
* Fix help for masternodelist status (POSE_BANNED and no OUTPOINT_SPENT)
This monstrous change eliminates all remaining uses of
g_connman global variable in Dash-specific code.
Unlike previous changes eliminating g_connman use
that were isolated to particular modules, this one covers
multiple modules simultaneously because they are so interdependent
that change in one module was quickly spreading to others.
This is mostly invariant change that was done by
* changing all functions using g_connman to use connman argument,
* changing all functions calling these functions to use connman argument,
* repeating previous step until there's nothing to change.
After multiple iterations, this process converged to final result,
producing code that is mostly equivalent to original one, but passing
CConnman instance through arguments instead of global variable.
The only exception to equivalence of resulting code is that I had to
create overload of CMasternodeMan::CheckAndRemove() method without arguments
that does nothing just for use in CFlatDB<CMasternodeMan>::Dump() and
CFlatDB<CMasternodeMan>::Load() methods.
Normal CMasternodeMan::CheckAndRemove() overload now has argument of
CConnman& type and is used everywhere else.
The normal overload has this code in the beginning:
if(!masternodeSync.IsMasternodeListSynced()) return;
Masternode list is not synced yet when we load "mncache.dat" file,
and we save "mncache.dat" file on shutdown, so I presume that it's OK
to use overload that does nothing in both cases.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
- add `MASTERNODE_SYNC_WAITING` sync state/asset and initial timeout
- wait for block headers to be downloaded (new signal `AcceptedBlockHeader`)
- wait for blocks to reach best headers tip before switching to masternode list sync (new signal `NotifyHeaderTip`)
- switched sync from `UpdatedBlockTip` to a combination of `AcceptedBlockHeader` and `NotifyHeaderTip`
- all blockchain-related bumps should take place only while we are still syncing blockchain, should be no such bumps after that
* Multi-quorum InstantSend, complete refactoring
+ cleanup for IS and partial protobump
* more changes:
- allow InstantSend tx to have 10 inputs max
- store many unique tx hashes in mapVotedOutpoints
- more checks in AcceptToMemoryPoolWorker (moved from ProcessMessage + CTxLockRequest(tx).IsValid() )
* More changes:
- let multiple lock candidates compete for votes
- fail to vote on the same outpoint twice early
* More changes:
- notify CInstantSend on UpdatedBlockTip -> remove cs_main from CheckAndRemove()
- notify CInstantSend on SyncTransaction -> count expiration block starting from the block corresponding tx was confirmed instead of the block lock candidate/vote was created
- fixed few locks
* add comments about nConfirmedHeight
* Fix "Block vs Lock" edge case
* Fix "Block vs Lock" edge case, p2
* Fix issues:
- fix logic for locking inputs and notifying - see UpdateLockedTransaction, TryToFinalizeLockCandidate
- add missing hash inserting in ProcessTxLockVote
- add nMaxBlocks param to ResolveConflicts to limit max depth allowed to disconnect blocks recursively
- fix false positive mempool conflict
- add missing mutex locks
- fix fRequireUnspent logic in CTxLockRequest::IsValid