Fixing this https://bitslog.wordpress.com/2017/01/08/a-bitcoin-transaction-that-takes-5-hours-to-verify/
* Unit test for CScript::FindAndDelete
* Replace memcmp with std::equal in CScript::FindAndDelete
Function is stl; std::equal just makes more sense.
* Replace c-style cast with c++ style static_cast.
* Improve worst-case behavior of CScript::FindAndDelete
Thanks to Sergio Lerner for identifying this issue and suggesting this kind of solution.
* Store time we saw mnb last time, bump sync timeout
if we received seen mnb but we are too close to MASTERNODE_NEW_START_REQUIRED_SECONDS
* Reset blockchain sync status if new blocks were accepted during sync
* Add some debug log output
* wait for at least one new block to be accepted
* bump CGovernanceManager-Version
* Few mn list sync changes:
- add more mn states
- only remove spent
- send mn ping in addition to mn announce on sync
- manage mn announces more carefully
- expire mns created from broadcasts with invalid ping
- old fWaitForPing logic for old nodes, should be helpful during migration period
This also adjusts active mn auto-start logic accordingly.
Should also store/check node we asked for mn list entry, not outpoint only. This should help to get mn list in sync when some nodes refuse to answer thus blocking such requests for the same outpoint for the next 3h and increasing mn list inconsistency.
- some were not used, some were included twice, some were in the wrong place, some were missing (but it compiled because some were in the wrong place)
- organized a bit better, grouped dash specific includes in original bitcoin files, should save some time solving conflicts when/if merging patches later
* Revert behaviour introduced in 5e1a6afe7f, make nLastDsq local variable instead of being network-wide one. Should fix mixing for new clients and for those who was offline for too long.
* fix docs
* Make local address discovery more robust in CActiveMasternode
* parameter interaction: -masternode=1 -> setting -listen=1
* slightly postpone first run to give net thread a chance to connect to some peers
* make sure local address detected in CActiveMasternode::ManageStateInitial is valid
* Simplified address detection logic
- added description for 'deserialize'
- added 'type' filter to 'list'
- added 'count' command (changed CGovernanceManager::ToString to output a bit more detailed info)
* Change rate check logic to avoid DoS attacks
* Convert rate check to use object timestamp instead of arrival time
* Update cached variables before checking for superblocks
* Ensure that last times are monotonically non-decreasing
* Bump governance manager serialization format
* Improved rate check error reporting
- make script verification a part of IsInstantSendTxValid()
- relax nLockTime for IS txes since we don't have compatibility with 12.0 IS txes anyway now (fee is lower in 12.1)
* Vote relaying changes
- Remove vote relaying from ProcessVote
- Remove vote relaying from orphan vote processing
- Relay vote in ProcessMessages (only)
* Do not relay governance objects during orphan processing
* Restore relaying of local votes
* Changed overloaded function name: ProcessVote->ProcessVoteAndRelay