b6b6d6c Added nSuperblockStartBlock, adjusted testnet/regtest params
15a3c64 More for governance block checks, p1 (non-compilable):
- add GetPaymentsLimit() and GetPaymentsTotalAmount()
- IsValidBlockHeight() should check nSuperblockStartBlock
- CSuperblock::IsValid should check payment limit and miner payout
- no cs_main
- slightly refactored related things
e8f9e5d More for governance checks, p2 (compilable):
- IsBlockValueValid(), IsBlockPayeeValid() and FillBlockPayee() rewritten, no cs_main for them
- CreateNewBlock adjusted, need more work on CBlockTemplate (see TODO)
- moved (and simplified) IsBlockPayeeValid() call from CheckBlock() to ConnectBlock()
51434cf Add ability to calculate only superblock part of subsidy in GetBlockSubsidy()
aa74200 Fix GetPaymentsLimit()
f7b6234 braces and comment
ade8f64 more checks for IsValidBlockHeight()
13316a4 Return true from IsBlockValueValid when masternode data is not synced
- This restores behavior very close to that in 12.0
- Needed to prevent the forking problem currently being seen on
testnet between online and offline nodes
- This is expected to be a temporary fix while we develop a
long-term solution for this problem
427086e Restore miner payments for superblocks
794b90d Added IsSynced field to JSON output of mnsync status RPC command
- This is needed to allow fixing RPC tests so that they wait until
the nodes are fully synced before performing tests
a9ddf6f Wait for nodes to sync masternode data during p2p-fullblocktest
f0ed400 darkSendSigner.SignMessage() should not return error message
154f1b6 darkSendSigner.VerifyMessage() should return non-localized message, its callers should populate error to debug.log
b130c32 darkSendSigner.GetKeysFromSecret() should not return error message, its callers should handle it
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.
86d8505 Refactor CActiveMasternode
+ move strMasterNodeAddr to CActiveMasternode
a005c79 Refactor InstantSend
+ new lock cs_instantsend to protect maps on CleanTransactionLocksList()
+ new DEFAULT_INSTANTSEND_DEPTH constant
+ rename MIN_INSTANTX_PROTO_VERSION to MIN_INSTANTSEND_PROTO_VERSION and bump it
d24182c Refactor Privatesend
+ decouple from util.h and version.h
+ more functions for CDarksendBroadcastTx: constructors, signing, serialization
+ move from rand() to insecure_rand() in general but to GetRand() for session id
+ fix defaults
2b1c567 To prevent high cpu usage we should update list only once in MASTERNODELIST_UPDATE_SECONDS seconds or MASTERNODELIST_FILTER_COOLDOWN_SECONDS seconds after filter was last changed. Also changing date/time format - QDateTime ToString() is way to slow for a list of thousands items, using DateTimeStrFormat instead. UI should work much smoother on mainnet now.
- mn hash compatibility with 70103
- ignore some requests while syncing
- fix locking/initializing in sync
- do not ban for old mnw
- split budget/governance messages/invs
513506f Fixing AddRef() usage
Using AddRef() in ConnectNode() for existing connections doesn't feel right considering how refs are released in ThreadSocketHandler(). I guess this could be the reason that sometimes refs stay >0 no matter what and nodes stuck in vNodesDisconnected forever which means that node never get deleted and FinalizeNode signal is never fired which in its turn means that for example mapBlocksInFlight can't be cleaned properly and then blocks stuck.
This commit should solve the issue by:
- removing AddRef() for existing connections
- adding AddRef() in CNode's constructor using the same conditions as in ThreadSocketHandler()
- addding AddRef() in ConnectNode() and Release() in ThreadSocketHandler() for mixing nodes
- removing explicit calls to Release() (back to `pnode->fDisconnect = true` in `CMasternodeMan::ProcessMasternodeConnections`)
9da4a83 fix names/comments
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
swap was using an incorrect condition to determine when to apply an optimization
(not swapping the full direct[] when swapping two indirect prevectors).
Rather than correct the optimization I'm removing it for simplicity. Removing
this optimization minutely improves performance in the typical (currently only)
usage of member swap(), which is swapping with a freshly value-initialized
object.
Fixes a bug in which pop_back did not call the deleted item's destructor.
Using the most general erase() implementation to implement all the others
prevents similar bugs because the coupling between deallocation and destructor
invocation only needs to be maintained in one place.
Also reduces duplication of complex memmove logic.