Commit Graph

144 Commits

Author SHA1 Message Date
Konstantin Akimov
08d1b35ee4
refactor: spork no more depends on net_processing 2024-01-10 15:12:06 -06:00
Kittywhiskers Van Gogh
ee313525ad
refactor: decouple db hooks from CFlatDB-based C*Manager objects, migrate to *Store structs (#5555)
## Motivation

As highlighted in https://github.com/dashpay/dash-issues/issues/52,
decoupling of `CFlatDB`-interacting components from managers of objects
like `CGovernanceManager` and `CSporkManager` is a key task for
achieving deglobalization of Dash-specific components.

The design of `CFlatDB` as a flat database agent relies on hooking into
the object's state its meant to load and store, using its
(de)serialization routines and other miscellaneous functions (notably,
without defining an interface) to achieve those ends. This approach was
taken predominantly for components that want a single-file cache.

Because of the method it uses to hook into the object (templates and the
use of temporary objects), it explicitly prevented passing arguments
into the object constructor, an explicit requirement for storing
references to other components during construction. This, in turn,
created an explicit dependency on those same components being available
in the global context, which would block the backport of bitcoin#21866,
a requirement for future backports meant to achieve parity in
`assumeutxo` support.

The design of these objects made no separation between persistent (i.e.
cached) and ephemeral (i.e. generated/fetched during initialization or
state transitions) data and the design of `CFlatDB` attempts to "clean"
the database by breaching this separation and attempting to access this
ephemeral data.

This might be acceptable if it is contained within the manager itself,
like `CSporkManager`'s `CheckAndRemove()` but is utterly unacceptable
when it relies on other managers (that, as a reminder, are only
accessible through the global state because of restrictions caused by
existing design), like `CGovernanceManager`'s `UpdateCachesAndClean()`.

This pull request aims to separate the `CFlatDB`-interacting portions of
these managers into a struct, with `CFlatDB` interacting only with this
struct, while the manager inherits the struct and manages
load/store/update of the database through the `CFlatDB` instance
initialized within its scope, though the instance only has knowledge of
what is exposed through the limited parent struct.

## Additional information

* As regards to existing behaviour, `CFlatDB` is written entirely as a
header as it relies on templates to specialize itself for the object it
hooks into. Attempting to split the logic and function definitions into
separate files will require you to explicitly define template
specializations, which is tedious.

* `m_db` is defined as a pointer as you cannot instantiate a
forward-declared template (see [this Stack Overflow
answer](https://stackoverflow.com/a/12797282) for more information),
which is done when defined as a member in the object scope.

* The conditional cache flush predicating on RPC _not_ being in the
warm-up state has been replaced with unconditional flushing of the
database on object destruction (@UdjinM6, is this acceptable?)

## TODOs

This is a list of things that aren't within the scope of this pull
request but should be addressed in subsequent pull requests

* [ ] Definition of an interface that `CFlatDB` stores are expected to
implement
* [ ] Lock annotations for all potential uses of members protected by
the `cs` mutex in each manager object and store
* [ ] Additional comments documenting what each function and member does
* [ ] Deglobalization of affected managers

---------

Co-authored-by: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
2023-09-24 09:50:21 -05:00
Kittywhiskers Van Gogh
f2384ffa90 merge bitcoin#19791: Move Misbehaving() to PeerManager 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
d9d98505e4 net: pass PeerLogicValidation to remaining ProcessMessages 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
00802bb21d partial bitcoin#17938: Disallow automatic conversion between disparate hash types
includes:
- 0a5ea32ce605984094c5552877cb99bc81654f2c
- 3fcc46812334074d2c77a6233e8a961cd0785872
- 2c54217f913967703b404747133be67cf2f4feac
- 966a22d859db37b1775e2180e5be032fc4fdf483
- 4d7369125a82214ea42b808a32b71b315a5c3c72
2023-04-15 12:12:30 -05:00
Kittywhiskers Van Gogh
07fe6d4738 merge bitcoin#19607: Add Peer struct for per-peer data in net processing 2023-02-28 00:11:11 +03:00
Konstantin Akimov
7681d63934
refactor: using C++11/14/17 features in dash specifict code (#5190)
## Issue being fixed or feature implemented
This refactoring helps to make code more specific and clear.
There's using syntax feature from modern C++ such as 'enum class',
structure bindings in loops, declaration variables inside if/switch
statements, etc.


## What was done?
This PR is based on @PastaPastaPasta 's PR
https://github.com/dashpay/dash/pull/4472

There excluded changes related to using std::optional. Let's decide
firstly about `Result` class: https://github.com/dashpay/dash/pull/5109


## How Has This Been Tested?
Run unit/functional tests

## Breaking Changes
No breaking changes

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: Pasta <pasta@dashboost.org>
2023-02-19 17:04:57 -06:00
Wladimir J. van der Laan
2d13a4b190 Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types
78e407ad0c26190a22de1bc8ed900164a44a36c3 GetKeyBirthTimes should return key ids, not destinations (Gregory Sanders)
70946e7fee54323ce6a5ea8aeb377e2c7c790bc6 Replace CScriptID and CKeyID in CTxDestination with dedicated types (Gregory Sanders)

Pull request description:

  The current usage seems to be an overloading of meanings. `CScriptID` is used in the wallet as a lookup key, as well as a destination, and `CKeyID` likewise. Instead, have all destinations be dedicated types.

  New types:
  `CScriptID`->`ScriptHash`
  `CKeyID`->`PKHash`

ACKs for commit 78e407:
  ryanofsky:
    utACK 78e407ad0c26190a22de1bc8ed900164a44a36c3. Only changes are removing extra CScriptID()s and fixing the test case.
  Sjors:
    utACK 78e407a
  meshcollider:
    utACK 78e407ad0c

Tree-SHA512: 437f59fc3afb83a40540da3351507aef5aed44e3a7f15b01ddad6226854edeee762ff0b0ef336fe3654c4cd99a205cef175211de8b639abe1130c8a6313337b9
2023-02-10 23:34:57 +03:00
Kittywhiskers Van Gogh
99f6c314c0 refactor: rearrange argument order to be more consistent 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
97d485159b refactor: rename ProcessSporkMessages to match other functions 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
b8873243e3 merge bitcoin#18134: Replace std::to_string with locale-independent alternative 2023-01-02 14:19:33 -06:00
PastaPastaPasta
aaa5c7967d
refactor: change Process* functions from accepting a ptr to a reference (#5062)
also drops an almost always unneeded string
converts some std::strings to std::string_view
also drops an unneeded param
2022-10-28 22:50:54 +03:00
Kittywhiskers Van Gogh
76c8e8f2e8 merge bitcoin#20480: Replace boost::variant with std::variant 2022-10-20 16:08:45 -05:00
PastaPastaPasta
f4bb06985f
refactor: use std::optional in some spork code (#4736)
* refactor: use std::optional in some spork code

* fix: return std::nullopt
2022-10-19 21:37:28 +03:00
Kittywhiskers Van Gogh
d155f13c76 merge bitcoin#17577: deduplicate the message sign/verify code 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
71e8caf4b9
refactor: migrate globals to managed pointers in preparation for deglobalization (#4930)
* coinjoin: make CCoinJoinServer managed pointer, assign CConnman during init

* coinjoin: make CCoinJoinClientQueueManager managed pointer, assign CConnman during init

* sporks: move spork validation logic downwards after CConnman initialization

* sporks: make CSporkManager a pointer, reduce global invocations

* governance: make CGovernanceManager a pointer, reduce global invocations

* llmq: migrate LLMQ subsystem raw pointers to managed pointers

* masternode: make activeMasternodeManager a managed pointer

* masternode: make masternodeSync a managed pointer, assign CConnman during init

* refactor: make instantsend helper functions class members

* fix: send empty CDeterministicMNList if pointer isn't initialized yet

* fix: refactor governance object retrieval logic across node and ui

Update src/interfaces/node.cpp

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-08-26 16:52:53 -05:00
PastaPastaPasta
d64b7229cd
chore: bump copyrights (#4873)
* chore: bump copyright in configure.ac

* chore: bump copyright via copyright_header.py

ran command `python3 contrib/devtools/copyright_header.py update .`
2022-06-08 02:36:46 +03:00
Kittywhiskers Van Gogh
41252a1de2 merge bitcoin#17997: Remove mempool global from net 2022-04-20 00:25:14 +05:30
Vijay
c66a2ec6fd
scripted-diff: Merge #18533 Replace strCommand with msg_type (#4761)
-BEGIN VERIFY SCRIPT-
sed -i 's/\<strCommand\>/msg_type/g' src/coinjoin/client.cpp
sed -i 's/\<strCommand\>/msg_type/g' src/coinjoin/client.h
sed -i 's/\<strCommand\>/msg_type/g'  src/coinjoin/server.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/coinjoin/server.h
sed -i 's/\<strCommand\>/msg_type/g'  src/evo/mnauth.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/evo/mnauth.h
sed -i 's/\<strCommand\>/msg_type/g'  src/governance/governance.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/governance/governance.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/blockprocessor.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/blockprocessor.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/chainlocks.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/chainlocks.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionhandler.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionhandler.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionmgr.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionmgr.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/instantsend.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/instantsend.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/quorums.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/quorums.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing_shares.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing_shares.h
sed -i 's/\<strCommand\>/msg_type/g'  src/masternode/sync.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/masternode/sync.h
sed -i 's/\<strCommand\>/msg_type/g'  src/net_processing.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/spork.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/spork.h
-END VERIFY SCRIPT-
2022-04-18 11:47:26 -05:00
PastaPastaPasta
eec6c13dd0
refactor(spork): use Mutex not CCriticalSection, use distinct mutexes for caches (#4737) 2022-04-11 18:22:05 +03:00
PastaPastaPasta
f2c603b45c
util: add ranges.h to emulate c++20 std::ranges (#4622)
* refactor: introduce ranges.h for prettier std algo. Also use it in dash core

* fix formatting, use ranges instead of std

* remove commented out code

* introduce ranges find_if_opt, count_if, find_if. Use them all, and more

* use std::accumulate

* capture everything so that threadsaftey analysis is happy

* fix linter

* fix linter

* remove pessimizing move
2021-12-21 15:05:29 +03:00
PastaPastaPasta
72e1d79fb8
refactor: misc spork refactoring (#4620)
* Use string_view instead of string for SERIALIZATION_VERSION_STRING. Also introduces string_view serialization. Also use string_view where (trivially) possible for params

* separate GetSporks and sporks net msg processing into its own method

* refactor: spork, use c++17 if-init

* refactor: spork, remove unused params, make param pt

* refactor: spork, use simplier construction

* refactor: spork, make strError part of if-init, also w/o redundant initialization

* refactor: spork, use structured binding

* refactor: spork, use for instead of while

* clang-format: spork.cpp

* resolve cppcheck linter warning about unused variable
2021-12-17 20:22:11 +03:00
Kittywhiskers Van Gogh
d978259654
merge bitcoin#15638: Pull wallet code out of libbitcoin_server (#4560)
* merge 15638: Move CheckTransaction from lib_server to lib_consensus

* merge 15638: Move policy settings to new src/policy/settings unit

* merge 15638: Move rpc utility methods to rpc/util

* merge 15638: Move rpc rawtransaction util functions to rpc/rawtransaction_util.cpp

* merge 15638: Move several units into common libraries

* merge 15638: Move wallet load functions to wallet/load unit

* merge 15638: Document src subdirectories and different libraries

* [build] Add several util units (cleanup)

* build: resolve missing declarations by re-specifying headers
2021-11-16 10:19:47 -05:00
PastaPastaPasta
7b78390015
refactor: Include adjustments (#4526)
* include adjustments

* fix macOs build failure

Signed-off-by: pasta <pasta@dashboost.org>

* expcitly include array in spork.h

* sort includes in most files
2021-10-25 16:55:34 +03:00
Kittywhiskers Van Gogh
1f436f8aee merge bitcoin#15948: rename chainActive
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-22 08:15:22 +05:30
PastaPastaPasta
fb03681423
spork: make sporkDefs static constexpr, remove sporkDefsById, sporkDefsByName maps (#4510)
* spork: make sporkDefs static constexpr, remove sporkDefsById, sporkDefsByName maps

Signed-off-by: pasta <pasta@dashboost.org>

* fixes

Signed-off-by: pasta <pasta@dashboost.org>

* Revert "fixes"

This reverts commit 42f599ee

Signed-off-by: pasta <pasta@dashboost.org>

* access statically

Signed-off-by: pasta <pasta@dashboost.org>

* add [[maybe_unused]] to sporkDefs

Signed-off-by: pasta <pasta@dashboost.org>
2021-10-12 02:08:02 +03:00
PastaPastaPasta
fdcfb25b98
Add some thread annotations (#4464)
* Add some thread annotations

* spork cs adjustments
2021-09-29 00:23:34 +03:00
PastaPastaPasta
c5b919d084
Update copyright (#4115)
* run: `python3 contrib/devtools/copyright_header.py update .`

* bump copyright year
2021-04-20 22:33:02 +03:00
dustinface
e695209d6c
spork: Add more constness in CSporkManager and CSporkMessage (#3955) 2021-01-22 00:57:42 -05:00
PastaPastaPasta
393ed59718
spork: implement spork caching (#3942)
* Implement Spork Caching

Signed-off-by: pasta <pasta@dashboost.org>

* spork: Add missing lock

* spork: Keep constness of SporkValueIsActive

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-21 03:04:14 +01:00
UdjinM6
e9341da0a7
spork: Fix a couple of issues with multikey sporks cleanup, add more tests (#3947)
* Fix a couple of issues with multikey sporks cleanup

1. Should remove sporks with signatures from unknown signers from mapSporksActive
2. Should advance itSignerPair while doing (1)...

* tests: make sure sporks cleanup works as expected for multikey sporks

* tests: make sure multiple multikey sporks (and their cleanups) work together as expected

* Prettify node extra args
2021-01-20 17:27:41 -05:00
UdjinM6
8178b297ee
spork: Introduce SPORK_23_QUORUM_POSE (#3907)
This splits SPORK_21_QUORUM_ALL_CONNECTED into two which should let us control node connectivity and quorum PoSe individually.
2021-01-10 21:23:01 -06:00
Wladimir J. van der Laan
70c82570b2
Merge #11372: Address encoding cleanup
92f1f8b31 Split off key_io_tests from base58_tests (Pieter Wuille)
119b0f85e Split key_io (address/key encodings) off from base58 (Pieter Wuille)
ebfe217b1 Stop using CBase58Data for ext keys (Pieter Wuille)
32e69fa0d Replace CBitcoinSecret with {Encode,Decode}Secret (Pieter Wuille)

Pull request description:

  This PR contains some of the changes left as TODO in #11167 (and built on top of that PR). They are not intended for backporting.

  This removes the `CBase58`, `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey` classes, in favor of simple `Encode`/`Decode` functions. Furthermore, all Bitcoin-specific logic (addresses, WIF, BIP32) is moved to `key_io.{h,cpp}`, leaving `base58.{h,cpp}` as a pure utility that implements the base58 encoding/decoding logic.

Tree-SHA512: a5962c0ed27ad53cbe00f22af432cf11aa530e3efc9798e25c004bc9ed1b5673db5df3956e398ee2c085e3a136ac8da69fe7a7d97a05fb2eb3be0b60d0479655

Make linter happy

Dashify
2021-01-08 22:35:34 +03:00
UdjinM6
f13852e662
PrivateSend: Harden SPORK_22_PS_MORE_PARTICIPANTS (#3860) 2020-12-09 20:00:08 +00:00
UdjinM6
757c99eb20
evo/llmq/spork: Fix various (potential) locking issues (#3829)
* Fix potential deadlock in `CSporkManager::UpdateSpork()`

* Protect `inputRequestIds` with cs lock

* Protect `curDBTransaction` in `CEvoDB::CommitRootTransaction()`

* Check for `AssertLockNotHeld` in `EnforceBestChainLock()` instead of just having a comment in code

* Protect spork maps on (de)serialization
2020-11-28 19:06:51 +00:00
PastaPastaPasta
8baf69d448
Harden spork6 logic then remove spork6 (#3662)
* Harden Spork6

Spork6 was previously activated on testnet, but we then developed an alternative fix for the issue and never activated spork6 on mainnet. At this point, Spork6 will not be activated on mainnet.
As such, it makes sense to harden Spork6 and ensure that spork6 will never be activated on mainnet. So, we just change from checking Spork6 to checking if we are on testnet. If we are on testnet, use spork6 logic, else don't.

Signed-off-by: pasta <pasta@dashboost.org>

* remove now unused SPORK_6_NEW_SIGS

Signed-off-by: pasta <pasta@dashboost.org>

* force fSporkSixActive to be correct, otherwise return

Signed-off-by: pasta <pasta@dashboost.org>

* Harden spork6 even more

* Add TODO in chainparams as a reminder to drop all spork6 related code on next testnet reset

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-30 17:22:21 +03:00
PastaPastaPasta
1d94d914c5
privatesend: Increase max participants to 20 (#3610)
* Add spork to change max mixing participants to 20

Signed-off-by: pasta <pasta@dashboost.org>

* Also change min participants on devnet/testnet

Signed-off-by: pasta <pasta@dashboost.org>

* adjust formatting

Signed-off-by: pasta <pasta@dashboost.org>

* add nPoolNewMinParticipants under regtest

Signed-off-by: pasta <pasta@dashboost.org>
2020-07-17 13:19:29 +03:00
PastaPastaPasta
5ea76e8649
Change litemode from disabling all Dash specific features to disabling governance validation (#3488)
* enable privatesend by default in litemode

Signed-off-by: Pasta <pasta@dashboost.org>

* remove useless litemode check in CPrivateSendServer::ProcessMessage, must be MN, so must have litemode off already

Signed-off-by: Pasta <pasta@dashboost.org>

* change litemode to mean, doesn't validate governance, but has all other dash features

Signed-off-by: Pasta <pasta@dashboost.org>

* litemode must be off for MNs cont

Signed-off-by: Pasta <pasta@dashboost.org>

* change litemode help text

Signed-off-by: Pasta <pasta@dashboost.org>

* don't skip MN sync in litemode

Signed-off-by: Pasta <pasta@dashboost.org>

* drop fLiteMode in bitcoingui.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* skip governance sync in litemode

Signed-off-by: pasta <pasta@dashboost.org>

* remove fLiteMode in walletview.cpp

Signed-off-by: pasta <pasta@dashboost.org>

* add back

Signed-off-by: pasta <pasta@dashboost.org>

* fix comments

* fix cache loading

* fix scheduled tasks

* Fix help text for some rpcs (revert what's left of 3478)

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-06-13 21:18:31 +03:00
PastaPastaPasta
8fcda67a54
Remove spork 15, 16, 20 (#3493)
Signed-off-by: pasta <pasta@dashboost.org>
2020-05-20 12:24:35 +03:00
Alexander Block
26fcd3f0bf Also remove m_tx_announced and m_tx_in_flight entries when EraseObjectRequest is called
Otherwise they'll run into false-positive timeouts.
2020-04-07 13:25:29 +02:00
Alexander Block
004d9224c4 Replace uses of CConnman::RemoveAskFor with EraseObjectRequest 2020-04-07 07:14:42 +02:00
Alexander Block
486463d622 Add SPORK_21_QUORUM_ALL_CONNECTED 2020-03-27 15:12:20 +01:00
PastaPastaPasta
8a1ec935a0
Backport 11651 (#3358)
* scripted-diff: Replace #include "" with #include <> (ryanofsky)

-BEGIN VERIFY SCRIPT-
for f in \
  src/*.cpp \
  src/*.h \
  src/bench/*.cpp \
  src/bench/*.h \
  src/compat/*.cpp \
  src/compat/*.h \
  src/consensus/*.cpp \
  src/consensus/*.h \
  src/crypto/*.cpp \
  src/crypto/*.h \
  src/crypto/ctaes/*.h \
  src/policy/*.cpp \
  src/policy/*.h \
  src/primitives/*.cpp \
  src/primitives/*.h \
  src/qt/*.cpp \
  src/qt/*.h \
  src/qt/test/*.cpp \
  src/qt/test/*.h \
  src/rpc/*.cpp \
  src/rpc/*.h \
  src/script/*.cpp \
  src/script/*.h \
  src/support/*.cpp \
  src/support/*.h \
  src/support/allocators/*.h \
  src/test/*.cpp \
  src/test/*.h \
  src/wallet/*.cpp \
  src/wallet/*.h \
  src/wallet/test/*.cpp \
  src/wallet/test/*.h \
  src/zmq/*.cpp \
  src/zmq/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-

Signed-off-by: Pasta <pasta@dashboost.org>

* scripted-diff: Replace #include "" with #include <> (Dash Specific)

-BEGIN VERIFY SCRIPT-
for f in \
  src/bls/*.cpp \
  src/bls/*.h \
  src/evo/*.cpp \
  src/evo/*.h \
  src/governance/*.cpp \
  src/governance/*.h \
  src/llmq/*.cpp \
  src/llmq/*.h \
  src/masternode/*.cpp \
  src/masternode/*.h \
  src/privatesend/*.cpp \
  src/privatesend/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-

Signed-off-by: Pasta <pasta@dashboost.org>

* build: Remove -I for everything but project root

Remove -I from build system for everything but the project root,
and built-in dependencies.

Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/Makefile.test.include

* qt: refactor: Use absolute include paths in .ui files

* qt: refactor: Changes to make include paths absolute

This makes all include paths in the GUI absolute.

Many changes are involved as every single source file in
src/qt/ assumes to be able to use relative includes.

Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/qt/dash.cpp
#	src/qt/optionsmodel.cpp
#	src/qt/test/rpcnestedtests.cpp

* test: refactor: Use absolute include paths for test data files

* Recommend #include<> syntax in developer notes

* refactor: Include obj/build.h instead of build.h

* END BACKPORT #11651 Remove trailing whitespace causing travis failure

* fix backport 11651

Signed-off-by: Pasta <pasta@dashboost.org>

* More of 11651

* fix blockchain.cpp

Signed-off-by: pasta <pasta@dashboost.org>

* Add missing "qt/" in includes

* Add missing "test/" in includes

* Fix trailing whitespaces

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: MeshCollider <dobsonsa68@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-03-20 01:46:56 +03:00
UdjinM6
67c8484e20
More of 11583 for Dash-specific code 2020-01-28 15:42:25 -06:00
PastaPastaPasta
141861ebae Merge #11117: Prepare for non-Base58 addresses (#3294)
* Merge #11117: Prepare for non-Base58 addresses

864cd2787 Move CBitcoinAddress to base58.cpp (Pieter Wuille)
5c8ff0d44 Introduce wrappers around CBitcoinAddress (Pieter Wuille)

Pull request description:

  This patch removes the need for the intermediary Base58 type `CBitcoinAddress`, by providing {`Encode`,`Decode`,`IsValid`}`Destination` functions that directly operate on the conversion between `std::string`s and `CTxDestination`.

  As a side, it also fixes a number of indentation issues, and removes probably several unnecessary implicit `CTxDestination`<->`CBitcoinAddress` conversions.

  This change is far from complete. In follow-ups I'd like to:
  * Split off the specific address and key encoding logic from base58.h, and move it to a address.h or so.
  * Replace `CTxDestination` with a non-`boost::variant` version (which can be more efficient as `boost::variant` allocates everything on the heap, and remove the need for `boost::get<...>` and `IsValidDestination` calls everywhere).
  * Do the same for `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey`.

  However, I've tried to keep this patch to be minimally invasive, but still enough to support non-Base58 addresses. Perhaps a smaller patch is possible to hack Bech32 support into `CBitcoinAddress`, but I would consider that a move in the wrong direction.

Tree-SHA512: c2c77ffb57caeadf2429b1c2562ce60e8c7be8aa9f8e51b591f354b6b441162625b2efe14c023a1ae485cf2ed417263afa35c892891dfaa7844e7fbabccab85e

* CBitcoinAddress -> EncodeDestination in providertx.h

Signed-off-by: Pasta <pasta@dashboost.org>

* more CBitcoinAddress -> EncodeDestination in providertx.h

Signed-off-by: Pasta <pasta@dashboost.org>

* more CBitcoinAddress -> EncodeDestination in providertx.h

Signed-off-by: Pasta <pasta@dashboost.org>

* more CBitcoinAddress -> EncodeDestination in providertx.h

Signed-off-by: Pasta <pasta@dashboost.org>

* fix CBitcoinAddress GetKeyID check

Signed-off-by: Pasta <pasta@dashboost.org>

* fix providertx.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* hopefully fix governance-classes.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* partially fix governance-validators.cpp, unable to resolve "address.IsScript()"

Signed-off-by: Pasta <pasta@dashboost.org>

* partially fix governance-classes.cpp, unable to resolve "address.IsScript()"

Signed-off-by: Pasta <pasta@dashboost.org>

* fix governance-classes.h

Signed-off-by: Pasta <pasta@dashboost.org>

* DecodeTransaction -> DecodeDestination, fix governance-validators.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* More fixes for 3294

* Move GetIndexKey into rpc/misc.cpp near getAddressesFromParams

No need to have it in base58.cpp anymore as this is only used in getAddressesFromParams

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: Alexander Block <ablock84@gmail.com>
2020-01-22 13:35:04 +03:00
UdjinM6
9abc393839
Refactor few things here and there (#3066)
* Refactor `HandleFullyConfirmedBlock()`

* Pass `pindexMined` into `AddNonLockedTx()`

* Unify time import in Dash specific tests

* Refactor UpdateSpork and SetPrivKey
2019-08-28 14:51:59 +03:00
Alexander Block
2f21e55514 Remove legacy InstantSend code (#3020)
* Remove ppszTypeName from protocol.cpp and reimplement GetCommand

This removes the need to carefully maintain ppszTypeName, which required
correct order and also did not allow to permanently remove old message
types.

To get the command name for an INV type, GetCommandInternal uses a switch
which needs to be maintained from now on.

The way this is implemented also resembles the way it is implemented in
Bitcoin today, but it's not identical. The original PR that introduced the
switch case in Bitcoin was part of the Segwit changes and thus never got
backported. I decided to implement it in a slightly different way that
avoids throwing exceptions when an unknown INV type is encountered.

IsKnownType will now also leverage GetCommandInternal() to figure out if
the INV type is known locally. This has the side effect of old/legacy
message types to return false from now on. We will depend on this side
effect in later commits when we remove legacy InstantSend code.

* Stop handling/relaying legacy IX messages

When we receive an IX message, we simply treat it as a regular TX and relay
it as such.

We'll however still request IX messages when they are announced to us. We
can't simply revert to requesting TX messages in this case as it might
result in the other peer not answering due to the TX not being in mapRelay
yet. We should at some point in the future completely drop handling of IX
messages instead.

* Remove IsNewInstantSendEnabled() and only use IsInstantSendEnabled()

* Remove legacy InstantSend from GUI

* Remove InstantSend from Bitcoin/Dash URIs

* Remove legacy InstantSend from RPC commands

* Remove legacy InstantSend from wallet

* Remove legacy instantsend.h include

* Remove legacy InstantSend from validation code

* Completely remove remaining legacy InstantSend code

* Remove now unused spork

* Fix InstantSend related test failures

* Remove now obsolete auto IS tests

* Make spork2 and spork3 disabled by default

This should have no influence on mainnet as these sporks are actually set
there. This will however affect regtest, which shouldn't have LLMQ based
InstantSend enabled by default.

* Remove instantsend tests from dip3-deterministicmns.py

These were only testing legacy InstantSend

* Fix .QCheckBox#checkUsePrivateSend styling a bit

* s/TXLEGACYLOCKREQUEST/LEGACYTXLOCKREQUEST/

* Revert "verified via InstantSend" back to "verified via LLMQ based InstantSend"

* Use cmd == nullptr instead of !cmd

* Remove last parameter from AvailableCoins call

This was for fUseInstantSend which is not present anymore since rebase
2019-07-09 17:50:08 +03:00
Wladimir J. van der Laan
2edd094a21
Merge #10189: devtools/net: add a verifier for scriptable changes. Use it to make CNode::id private.
0f3471f net: make CNode's id private (Cory Fields)
9ff0a51 scripted-diff: net: Use accessor rather than node's id directly (Cory Fields)
e50c33e devtools: add script to verify scriptable changes (Cory Fields)

skipped travis changes

Tree-SHA512: a0ff50f4e1d38a2b63109b4996546c91b3e02e00d92c0bf04f48792948f78b1f6d9227a15d25c823fd4723a0277fc6a32c2c1287c7abbb7e50fd82ffb0f8d994

pnode->id to pnode->GetId()

Signed-off-by: Pasta <pasta@dashboost.org>
2019-06-19 08:20:15 -05:00
PastaPastaPasta
2756cb7954 remove spork 12 (#2754)
Signed-off-by: Pasta <Pasta@dash.org>
2019-06-18 14:32:11 +03:00
Alexander Block
fc73b4d6e6 Refactor sporks to get rid of repeated if/else blocks (#2946)
* Use enum to define spork IDs

* Introduce CSporkDef and remove if/else blocks in GetSporkIDByName/GetSporkNameByID

* Deduplicate code in IsSporkActive

* Fix spork RPC to use new spork defs

This also removes the need for SPORK_START/SPORK_END

* Move sporkManager global variable below sporkDefs

This ensures correct order of initialization.
2019-05-29 21:18:31 +03:00