* Add recently accepted blocks and txn to AttemptToEvictConnection.
This protects any not-already-protected peers who were the most
recent four to relay transactions and most recent four to send
blocks to us.
* Allow disconnecting a netgroup with only one member in eviction.
With the latest additions there are enough protective measures that
we can take the training wheels off.
* net: don't import std namespace
This file is about to be broken up into chunks and moved around. Drop the
namespace now rather than requiring other files to use it.
* net: remove unused set
* net: use the exposed GetNodeSignals() rather than g_signals directly
* net: make Ban/Unban/ClearBan functionality consistent
- Ban/Unban/ClearBan call uiInterface.BannedListChanged() as necessary
- Ban/Unban/ClearBan sync to disk if the operation is user-invoked
- Mark node for disconnection automatically when banning
- Lock cs_vNodes while setting disconnected
- Don't spin in a tight loop while setting disconnected
* net: No need to export DumpBanlist
DumpBanList currently does this:
- with lock: take a copy of the banmap
- perform I/O (write out the banmap)
- with lock: mark the banmap non-dirty
If a new ban is added during the I/O operation, it may never be persisted to
disk.
Reorder operations so that the data to be persisted cannot be older than the
time at which the banmap was marked non-dirty.
* Make ProcessNewBlock dbp const and update comment
* Switch reindexing to AcceptBlock in-loop and ActivateBestChain afterwards
* Optimize ActivateBestChain for long chains
* Add -reindex-chainstate that does not rebuild block index
* Report reindexing progress in GUI
* Only store and connect to NODE_NETWORK nodes
* Keep addrman's nService bits consistent with outbound observations
* Verify that outbound connections have expected services
* Don't require services in -addnode
* Introduce enum ServiceFlags for service flags
* Introduce REQUIRED_SERVICES constant
* CAddrDB modified so that when de-serialization code throws an exception Addrman is reset to a clean state
* CAddrDB modified to make unit tests possible
* Regression test created to ensure bug is fixed
* StartNode modifed to clear adrman if CAddrDB::Read returns an error code.
* process governance objects in CheckMasternodeOrphanObjects as usual
* code refactoring: SetRateChecksHelper class added
* fixed race condition issues with propagation of governance objects
* change GetCollateralConfirmations signature
* code refactoring
* reduced minimum number of collateral confirmations required for relaying proposals
* bug fixes and improvements
* banlist: update set dirty to be more fine grained
- move the SetBannedSetDirty(false) call from DumpData() into DumpBanlist()
- ensure we only set false, if the write succeeded
* banlist: better handling of banlist in StartNode()
- only start working on/with banlist data, if reading in the banlist from
disk didn't fail
- as CNode::setBannedIsDirty is false (default) when reading fails, we
don't need to explicitly set it to false to prevent writing
banlist.dat in that case either
* banlist: add more banlist infos to log / add GUI signal
- to match the peers.dat handling also supply a debug.log entry for how
many entries were loaded from banlist.dat and how long it took
- add a GUI init message for loading the banlist (same as with peers.dat)
- move the same message for peers.dat upwards in the code, to be able to
reuse the timing variable nStart and also just log, if our read from
peers.dat didn't fail
* banlist (bugfix): allow CNode::SweepBanned() to run on interval
- allows CNode::SweepBanned() to run, even if !CNode::BannedSetIsDirty(),
because if nBanUntil is over we want the ban to be disabled for these
nodes
* Add hassentinelping to governanceinfo
* sentinelping rpc call
* additional fields in mnp
* sentinel ping implementation
* change sentinel state to byte in mnp
* use adjusted time in sentinel ping
* update nTimeLastWatchdogVote if sentinel ping is actual
* remove unused fields
* bump protocol to 70207
* Fix small issues
- fix the error message text in CActivbeMasternodeUpdateSentinelPing;
- add empty string before public: in CActiveMasternode class declaration;
- rename field sentinelPing in CMasternodePing to sentinelIsActual and change $
- decrease sentinelVersion field size to uint16_t;
* revert proto bump for MIN_... consts
* revert changes in getgovernanceinfo
* Update mn vote time for remote masternodes
- call UpdateWatchdogVoteTime in CMasternodeMan::ProcessMessage
- deserialize masternodeping from the previous version archive without exception
- add ability to set time in UpdateWatchdogVoteTime
- set nTimeLastWatchdogVote to masternode ping sigTime if sentinel is actual
- bump CMasternodeMan::SERIALIZATION_VERSION_STRING
* remove mn state checks and add correct rpc param convertion
* fix var names
* Helper class for version in string and integer form
* String version in sentinel ping
Version format is "x.x.x"
* test for bacward compatibility in serialization
* Change VersionInfo class to convert functions
* Build against system UniValue when available
* doc: Add UniValue to build instructions
* Bugfix: The var is LIBUNIVALUE,not LIBBITCOIN_UNIVALUE
* Change default configure option --with-system-univalue to "no"
* Bugfix: Always include univalue in DIST_SUBDIRS
* LDADD dependency order shuffling
* build-unix: Update UniValue build conditions
ProcessNewBlock would return failure early if CheckBlock failed, before
calling AcceptBlock. AcceptBlock also calls CheckBlock, and upon failure
would update mapBlockIndex to indicate that a block was failed. By returning
early in ProcessNewBlock, we were not marking blocks that fail a check in
CheckBlock as permanently failed, and thus would continue to re-request and
reprocess them.
Adds several unittests for CAddrMan and CAddrInfo.
Increases the accuracy of addrman tests.
Removes non-determinism in tests by overriding the random number generator.
Extracts testing code from addrman class to test class.
* log bytes recv/sent per command
* net: Account for `sendheaders` `verack` messages
Looks like these were forgotten in #6589.
* Backport remaining part of Bitcoin PR bitcoin/bitcoin#7181.
Most of this PR is already merged, but a small part remaining
that makes per-command byte counts in CNode working.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
Fixes: #1345
The actual problem is that GetDataDir has the side effect of creating the
datadir, even if it is not known yet where it really is. This is only
known after reading the config file or when explicitly specified in the
cmd line.
Thus, if GetDataDir gets called before the datadir value from the config
is read, it tries to create it at the default location.
* Implement proposal validation
Includes commits:
Implemented CProposalValidator
Use CProposalValidator to check proposals at prepare and submit stages
Modify proposal validator to support numerical data in string format
Multiple bug fixes in governance-validators.cpp
Fixed bug in CheckURL
Fixed stream state check
Increase strictness of payment address validation for compatibility with sentinel
Improved error reporting
Implemented "check" rpc command to validate proposals
Fixes to RPC check command
Fix error message
Unit test and data files for proposal validator
Added test cases
Removed debugging code
* Fix name validation
* Changes to address code review comments
Added clarifications in order to avoid that newcomers encounter this error when trying to build:
configure: error: libdb_cxx headers missing, Dash Core requires this library for wallet functionality
(see issue https://github.com/dashpay/dash/issues/1442 )
* HD wallet
Minimal set of changes (no refactoring) backported from Bitcoin upstream to make HD wallets work in Dash 0.12.1.x+
* minimal bip44 (hardcoded account and change)
* minimal bip39
Additional cmd-line options for new wallet:
-mnemonic
-mnemonicpassphrase
* Do not recreate HD wallet on encryption
Adjusted keypool.py test
* Do not store any private keys for hd wallet besides the master one
Derive all keys on the fly.
Original idea/implementation - btc PR9298, backported and improved
* actually use bip39
* pbkdf2 test
* backport wallet-hd.py test
* Allow specifying hd seed, add dumphdseed rpc, fix bugs
- -hdseed cmd-line param to specify HD seed on wallet creation
- dumphdseed rpc to dump HD seed
- allow seed of any size
- fix dumpwallet rpc bug (wasn't decrypting HD seed)
- print HD seed and extended public masterkey on dumpwallet
* top up keypool on HD wallet encryption
* split HD chain: external/internal
* add missing cs_wallet lock in init.cpp
* fix `const char *` issues (use strings)
* default mnemonic passphrase is an empty string in all cases
* store mnemonic/mnemonicpassphrase
replace dumphdseed with dumphdinfo
* Add fCrypted flag to CHDChain
* prepare internal structures for multiple HD accounts
(plus some code cleanup)
* use secure allocator for storing sensitive HD data
* use secure strings for mnemonic(passphrase)
* small fix in GenerateNewHDChain
* use 24 words for mnemonic by default
* make sure mnemonic passphrase provided by user does not exceed 256 symbols
* more usage of secure allocators and memory_cleanse
* code cleanup
* rename: CSecureVector -> SecureVector
* add missing include
* fix warning in rpcdump.cpp
* refactor mnemonic_check (also fix a bug)
* move bip39 functions to CMnemonic
* Few fixes for CMnemonic:
- use `SecureVector` for data, bits, seed
- `Check` should return bool
* init vectors with desired size where possible
* dont waste keys from keypool on failure in CreateDenominated
* bug fix - log actual number of total outputs, comment error
* log number of total outputs as separate value
* add lock so no one can spend outputs used for denominations
* clear trafficgraph on clear button click
* set default sample height
set default sample height so after clearing traffic graph have some
scale
* reduce available traffic graph ranges, add optimized graph data storage
reduce available traffic graph ranges to 10
(5m,10m,15m,30m,1h,2h,3h,6h,12h,24h),
store graph data so range change is possible,
data storage contains only necessary data to create graphs for all
supported ranges
eg. for 10m range storage only half of 10m samples - the second half is
calculated from 5m range samples,
encapsulate all traffic graph related data into one class
* code formatting corrections
The rpcserver.h header file is included twice as a result of
changes merged from Bitcoin 2 years ago
(commit 64eebc3316).
Include this file just once.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
OBJCXX's std flags don't get defined by our cxx macro. Rather than hard-coding
to c++11, just force OBJCXX to be the same as CXX unless the user specified
otherwise.
Change the few occurrences of the deprecated `auto_ptr` to c++11 `unique_ptr`.
Silences the deprecation warnings.
Also add a missing `std::` for consistency.
* c++11: detect and correct for boost builds with an incompatible abi
This is ugly, but temporary. boost::filesystem will likely be dropped soon
after c++11 is enabled. Otherwise, we could simply roll our own copy_file. I've
fixed this at the buildsystem level for now in order to avoid mixing in
functional changes.
Explanation:
If boost (prior to 1.57) was built without c++11, it emulated scoped enums
using c++98 constructs. Unfortunately, this implementation detail leaked into
the abi. This was fixed in 1.57.
When building against that installed version using c++11, the headers pick up
on the native c++11 scoped enum support and enable it, however it will fail to
link. This can be worked around by disabling c++11 scoped enums if linking will
fail.
Add an autoconf test to determine incompatibility. At build-time, if native
enums are being used (a c++11 build), and force-disabling them causes a
successful link, we can be sure that there's an incompatibility and enable the
work-around.
* c++11: add scoped enum fallbacks to CPPFLAGS rather than defining them locally
Due to include ordering, defining in one place was not enough to ensure correct
usage. Use global defines so that we don't have to worry abou this ordering.
Also add a comment in configure about the test.
* Remove unneeded include that was added by bitcoin commits