Commit Graph

92 Commits

Author SHA1 Message Date
Kittywhiskers Van Gogh
bb7d6aed99
refactor(llmq): substitute memberless class llmq::CLLMQUtils with namespace llmq::utils (#4931)
* refactor(llmq): substitute memberless class llmq::CLLMQUtils with namespace llmq::utils

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

* chore: mark functions internal to `llmq::utils` as `static`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-08-02 12:14:25 -05:00
UdjinM6
0d67aa1915
fix: Pass KeyOriginInfo instead of CKeyMetadata to DeriveChildExtKey (#4918)
Resolves "hdchain -> wallet/walletdb -> ... -> hdchain" circular dependencies
2022-07-18 16:56:33 +03:00
Konstantin Akimov
0a951622f1
Bitcoin backport #16227 refactoring CWallet (#4903)
* Add HaveKey and HaveCScript to SigningProvider

* Remove CKeyStore and squash into CBasicKeyStore

* Move HaveKey static function from keystore to rpcwallet where it is used

* scripted-diff: rename CBasicKeyStore to FillableSigningProvider

-BEGIN VERIFY SCRIPT-
git grep -l "CBasicKeyStore" | xargs sed -i -e 's/CBasicKeyStore/FillableSigningProvider/g'
-END VERIFY SCRIPT-

* Move KeyOriginInfo to its own header file

* Move various SigningProviders to signingprovider.{cpp,h}

Moves all of the various SigningProviders out of sign.{cpp,h} and
keystore.{cpp,h}. As such, keystore.{cpp,h} is also removed.

Includes and the Makefile are updated to reflect this. Includes were largely
changed using:
git grep -l "keystore.h" | xargs sed -i -e 's;keystore.h;script/signingprovider.h;g'

* Remove CCryptoKeyStore and move all of it's functionality into CWallet

Instead of having a separate CCryptoKeyStore that handles the encryption
stuff, just roll it all into CWallet.

* Fixed cases of mess CWallet functions with CCryptoKeyStore and conflicts

* Move WatchOnly stuff from SigningProvider to CWallet

* Fixes for lint cirtular dependencies to calm linter

Co-authored-by: Andrew Chow <achow101-github@achow101.com>
2022-07-12 22:46:31 -05:00
Kittywhiskers Van Gogh
f14bf83a9d merge bitcoin#15141: Rewrite DoS interface between validation and net_processing
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-06-21 19:11:26 +05:30
PastaPastaPasta
e090d9a9e7
trivial(llmq): trivial fixes in llmq/utils.cpp (#4884)
* trivial(llmq): fix indentation

* trivial(llmq): remove unused / commented out includes

* trivial(llmq): adjust formatting

* trivial(llmq): use const

* trivial(llmq): use ranges

* trivial: fix linter
2022-06-16 00:00:43 +03:00
UdjinM6
103f49aa41 fix linter 2022-04-20 00:25:14 +05:30
Odysseas Gabrielides
83ef1c6c66
feat: implement quorum rotation and updated LLMQ parameters (#4752)
* Added GET_SNAPSHOT_INFO message handling

* Quorum members by rotation

* Quorum utils functions

* Handle GET_QUORUM_ROTATION_INFO with baseBlockHash from client

* Storing QuorumSnaphots in evoDB when requesting them

* Added DIP Enforcement param

* quorumIndex cache

* Quorum Rotation deployment control

* Usage of Bitsets for storing CQuorumSnapshots

* Correct handling of early quorum quarters

* More asserts

* Corrections

* Handling of quorumIndex

* Refactoring of truncate mechanism

* Various fixes

* Interface correction

* Added template type for indexed cache

* Added quorumIndex into commitmenHash

* Various changes

* Needs to update maqQuorumsCache along with indexedQuorumsCache

* Added CFinalCommitment version 2

* Renamed variables

* Fixes

* Refactoring & correct caching of quorumMembers by rotation

* Added assertions

* Refactoring

* Interface change

* Handling of previous DKG session failure

* Applied refactoring

* Build quarter members improvments

* Merge Quorum Rotation and Decreased fee into one deployment (DIP24)

* Added new LLMQ Type

* Added functional tests + refactoring

* Refactoring

* Spreaded Quorum creation and Quorum Index adaptation

* quorumIndex adaptations

* Added quorumIndex in CFinalCommitment

* Latest work

* Final refactoring

* Batch of refactoring

* Fixes for tests

* Fix for CFinalCommitment

* Fix for Quorums

* Fix

* Small changes

* Thread sync fic

* Safety changes

* Reuse mns when needed

* Refactoring

* More refactoring

* Fixes for rotationinfo handling

* Fix for rotation of members

* Correct order of MNs lists in Quorum Snapshots

* Adding extra logs

* Sync rotation quorums + qrinfo changes

* Fix + extra logs

* Removed redundant field

* Fix for null final commitment + refactoring

* Added timers in tests

* Fix for qrinfo message: quorumdiff and merkleRootQuorums

* Small changes for rotation test

* Remove reading from scanQuorumCache

* Added quorum list output

* Crash fix

* Experimental commit

* apply changes to specialtxman.cpp from specialtx.cpp

* all the changes

* substancially speed up feature_llmq_rotation.py

* reenable asserts, add check for reorgs

* Refactoring

* Added extra logs

* format

* trivial

* drop extra boost includes

* drop ContainsMN

* fix ScanQuorums

* check quorum hash and index in CFinalCommitment::Verify

* fix/tweak tests

* IsQuorumRotationEnabled should be aware of the context

* Calculating members based on earlier block.

* Fix for Quorum Members Cache

* Removed duplicate size of baseBlockHashes

* Adaptations of qrinfo to -8 mn lists

* Introduction of llmqTypeDIP24InstantSend

* Adaptation for llmqTypeDIP24InstantSend

* Adaptations for IS

* bump protocol version

* Added feature_llmq_is_migration test

* Various cleanups

* use unordered_lru_cache for quorumSnapshotCache

* trivial refactor ComputeQuorumMembersByQuarterRotation

* Reduced CFinalCommitment::quorumIndex from 32 to 16 bits

* Keep verified LLMQ relay connections

* Experimental Relay connection fix

* Fix for EnsureQuorumConnections rotation

* Using only valid Mns for checking

* Override of nPowTargetSpacing (devnet only)

* Show penalty score in masternode rpc

* fixups

* Rotation refactoring

* Update src/chainparams.cpp

* Replaced LogPrintf with LogPrint

* IS locking fix once DIP24 activation

* Various cleanup

* Updated MIN_MASTERNODE_PROTO_VERSION

* Introduce LLMQ_TEST_INSTANTSEND reg-test only quorum and actually test switching to dip0024 quorums

* Renamed field lastQuorumHashPerIndex

* Renamed to DIP0024

* chore: update nStartTime and nTimeout for mainnet / testnet for DEPLOYMENT_DIP0024

Co-authored-by: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-16 17:46:04 +03:00
Vijay Manikpuri
77e84287e9
Merge #16226: Move ismine to the wallet module (#4640)
e61de6306fd89fe9aae90253062e7b1b20343f8a Change ismine to take a CWallet instead of CKeyStore (Andrew Chow)
7c611e20007bf5face34d33dffa26c8db67e29ec Move ismine to wallet module (Andrew Chow)

Pull request description:

  `IsMine` isn't used outside of the wallet except for the tests. It also doesn't make sense to be outside of the wallet. This PR moves `IsMine` into the wallet module and for it to take a `CWallet` instead of `CKeyStore`. The test that used `IsMine` is also moved to the wallet tests.

  This is first [prerequisites](https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Class-Structure-Changes#ismine) for the wallet structure changes.

ACKs for commit e61de6:
  MarcoFalke:
    re-ACK e61de6306f (only change is rebase with git auto-merge)
  meshcollider:
    Very light code review ACK e61de6306f

Tree-SHA512: 1cb4ad12652aef7922ab7460c6d413e8b9d1855dca78c0a286ae49d5c0765bc7996c55f262c742001d434eb9bd4215dc2cc7aae1b371ee1a82d46b32c17e6341

Co-authored-by: MeshCollider <dobsonsa68@gmail.com>
2022-04-03 17:26:52 -05:00
Kittywhiskers Van Gogh
7d989179f9
refactor(evo): introduce IsTriviallyValid() to CheckPro*Tx objects (#4696)
* evo: introduce IsTriviallyValid() to CheckPro*Tx objects

* evo: relocate Check* and CheckPro*Tx logic to deterministicmns (move-only)

* evo: relocate masternode state and chainlock sig logic to dedicated files (move-only)

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

* evo: issue penalty for CheckInputsHash failure when validating ProUp*Tx

Co-authored-by: PastaPastaPasta <PastaPastaPasta@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-02-26 12:50:35 -06:00
MeshCollider
ed0e2dd075
Merge #14021: Import key origin data through descriptors in importmulti (+ changes from PRs partially merged earlier: 15368, 15749)
cb3511b9d Add release notes for importing key origin info change (Andrew Chow)
4c75a69f3 Test importing descriptors with key origin information (Andrew Chow)
02d6586d7 Import KeyOriginData when importing descriptors (Andrew Chow)
3d235dff5 Implement a function to add KeyOriginInfo to a wallet (Andrew Chow)
eab63bc26 Store key origin info in key metadata (Andrew Chow)
345bff601 Remove hdmasterkeyid (Andrew Chow)
bac8c676a Add a method to CWallet to write just CKeyMetadata (Andrew Chow)
e7652d3f6 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow)
c45415f73 Refactor keymetadata writing to a separate method (Andrew Chow)

Pull request description:

  This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet.

  In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this.

Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
2022-02-18 03:42:05 +03:00
PastaPastaPasta
8ef0231166
refactor: break circular dependencies(-16, +2) (#4670)
* refactor: break circular dependencies(-13, +2)

introduces specialtxman, which handles validation of special transactions, specialtx is now simply the primitive underlying type. This breaks a lot of the circular depends

Also removes an unneeded `#include <masternode/payments.h>` in net_processing.cpp, which resolves a circular dependency. (we know it's okay to remove b/c masternode/payments.h isn't included in any header files, and removing it doesn't break compilation)

* format: make clang-format happy

* remove unrelated change

* remove some unneeded includes to `evo/deterministicmns.h`, explicitly include some previously implicitly included includes.

Resolves two circular dependencies

* refactor: remove circular depend, unused include
2022-01-24 17:20:50 +03:00
Vijay Manikpuri
3148450032
Merge #16129: refactor: Remove unused includes (#4623)
67f4e9c522 Include core_io.h from core_read.cpp (practicalswift)
eca9767673 Make reasoning about dependencies easier by not including unused dependencies (practicalswift)

Pull request description:

  Make reasoning about dependencies easier by not including unused dependencies.

  Please note that the removed headers are _not_ "transitively included" by other still included headers. Thus the removals are real.

  As an added bonus this change means less work for the preprocessor/compiler. At least 51 393 lines of code no longer needs to be processed:

  ```
  $ git diff -u HEAD~1 | grep -E '^\-#include ' | cut -f2 -d"<" | cut -f1 -d">" | \
        sed 's%^%src/%g' | xargs cat | wc -l
  51393
  ```

  Note that 51 393 is the lower bound: the real number is likely much higher when taking into account transitively included headers :-)

ACKs for commit 67f4e9:

Tree-SHA512: 0c8868aac59813f099ce53d5307eed7962dd6f2ff3546768ef9e5c4508b87f8210f1a22c7e826c3c06bebbf28bdbfcf1628ed354c2d0fdb9a31a42cefb8fdf13

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2022-01-03 13:10:02 -06:00
UdjinM6
5bdd245105
Merge pull request #4619 from PastaPastaPasta/remove-includes
refactor: Remove includes; backport 16659
2021-12-17 20:21:12 +03:00
pasta
f04cf7bf47
16659 continuation
Signed-off-by: pasta <pasta@dashboost.org>
2021-12-17 12:02:16 -05:00
Wladimir J. van der Laan
f659d98cc6
Merge #16294: qt: test: Create at most one testing setup
faa1e0fb1712b1f94334e42794163f79988270fd qt: test: Create at most one testing setup (MarcoFalke)

Pull request description:

  It is assumed that ideally only one BasicTestingSetup exists at any point in time for each process (due to use of globals).

  This assumption is violated in the GUI tests, as a testing setup is created as the first step of the `main` function and then (sometimes) another one for the following test cases.

  So, the gui tests create two testing setups:
  * `BasicTestingSetup` in `main` (added in fa4a04a5a942d582c62773d815c7e1e9897975d0)
  * a testing setup for individual test cases

  Avoid that by destructing the testing setup in main after creation and then move the explicit `ECC_Stop` to the only places where it is needed (before and after `apptests`).

ACKs for top commit:
  laanwj:
    code review ACK faa1e0fb1712b1f94334e42794163f79988270fd

Tree-SHA512: b8edceb7e2a8749e1de3ea80bc20b6fb7d4390bf366bb9817206ada3dc8669a91416f4803c22a0e6c636c514e0c858dcfe04523221f8851b10deaf472f107d82
2021-12-15 20:09:55 +05:30
pravblockc
459bc3ee7e
add ehf special tx (#4577) 2021-12-11 23:00:27 +03:00
fanquake
ffe950bbc7
partial merge #16327: scripts and tools: Update ShellCheck linter
1ac454a3844b9b8389de0f660fa9455c0efa7140 Enable ShellCheck rules (Hennadii Stepanov)

Pull request description:

  Enable some simple ShellCheck rules.

  Note for reviewers: `bash` and `shellcheck` on macOS are different from ones on Ubuntu.
  For local tests the latest `shellcheck` version 0.6.0 should be used (see #15166).

ACKs for top commit:
  practicalswift:
    utACK 1ac454a3844b9b8389de0f660fa9455c0efa7140
  dongcarl:
    utACK 1ac454a
  fanquake:
    ACK 1ac454a3844b9b8389de0f660fa9455c0efa7140

Tree-SHA512: 8d0a3a5c09fe1a0c22120178f5e6b80f81f746f8c3356b7701ff301c117acb2edea8fe08f08fb54ed73f94b1617515fb239fa28e7ab4121f74872e6494b6f20e
2021-12-03 18:13:01 +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
MarcoFalke
02c6ecb02f
Merge #15655: Resolve the checkpoints <-> validation circular dependency
418d3230f8 Resolve the checkpoints <-> validation CD. (251)

Pull request description:

  This pull request attempts to resolve the `checkpoints -> validation -> checkpoints` circular dependency.

  The circular dependency is resolved by moving the `CheckPoints::GetLastCheckpoint(const CCheckpointData& data)` function to `validation.cpp` where it used exclusively by the private function `ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& params, const CBlockIndex* pindexPrev, int64_t nAdjustedTime)`.

ACKs for commit 418d32:
  promag:
    utACK 418d323, only `GetLastCheckpoint` usage is in `validation.cpp` and so makes sense to move it there.
  practicalswift:
    utACK 418d3230f86f77dde6e817f502baff8a54b707fa
  MarcoFalke:
    utACK 418d3230f86f77dde6e817f502baff8a54b707fa
  sipa:
    utACK 418d3230f86f77dde6e817f502baff8a54b707fa

Tree-SHA512: 03c3556bc192e65f5e3fa76fd545d4ee7d63d3fb06b132f7a1fa6131aa21ddd2e5b2d19e2222dfe524f422daaca30efde219bed188db8c74ff4b088876b5bc16
2021-10-25 12:22:06 -04: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
f22be5a16b refactor: llmq/quorums_*[cpp/h] --> llmq/*.[cpp/h] 2021-10-06 09:04:45 +05:30
Kittywhiskers Van Gogh
cb1d4766f5
refactor: remove redundant filename prefixes for Dash-specific logic (#4475)
* refactor: coinjoin/coinjoin-*[cpp/h] --> coinjoin/*.[cpp/h]

* refactor: governance/governance-*[cpp/h] --> governance/*.[cpp/h]

* refactor: masternode/masternode-*[cpp/h] --> masternode/*.[cpp/h]

* fix linter

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-01 22:19:08 +03:00
Dzutte
6d90e71076
Merge #12490: [Wallet] [RPC] Remove deprecated wallet rpc features from bitcoin_server (#4380)
f7e9e70468 [rpc] Remove deprecated sigrawtransaction rpc method. (John Newbery)
90c834089a [RPC] Remove warning about wallet addresses in createmultisig() (John Newbery)
df905e390e [rpc] Remove deprecated validateaddress usage. (John Newbery)

Pull request description:

  The following rpc features were deprecated in V0.17:

  - `validateaddress` returning wallet information about an address
  - `signrawtransaction`

  This PR fully removes those features. It can be merged once V0.17 has been branched from master.

Tree-SHA512: 28293d218cf7e348632081e362f8775f243d091f49aed54c354f017d4a12ae92b87b99f81ee592a1bbf4aebd5d8cd5119278141edde7a0399ff82917ed68b9f6

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2021-08-31 23:31:31 -04:00
PastaPastaPasta
f87d62d677
refactor: misc bls, evo, include refactoring (#4305)
* refactor/bls: misc refactoring and spelling/grammar fixes in bls code

* refactor/evo: misc refactoring and spelling/grammar fixes in evo code

* refactor: some include changes

* refactor: remove redundant `public`

* fix linter

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

* Sort includes

* Move `class CTxDSIn;`

* Drop unused functions in CBLSWorker

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-31 21:29:12 +03:00
Wladimir J. van der Laan
4cd32e43e4
Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h
1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley)
e62fdfeea Drop unused init.h includes (Ben Woosley)

Pull request description:

  Most includers just wanted to react to pending shutdown.

  This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`.

Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
2021-07-02 00:42:18 +03:00
Kittywhiskers Van Gogh
ef4dfa8524 merge bitcoin#14555: Move util files to directory
(script modified to account for Dash backports, doesn't account for rebasing)

------------- BEGIN SCRIPT ---------------
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp
git mv src/utilasmap.h src/util/asmap.h
git mv src/utilasmap.cpp src/util/asmap.cpp
git mv src/utilstring.h src/util/string.h
git mv src/utilstring.cpp src/util/string.cpp

gsed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilasmap\.h>/<util\/asmap\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilstring\.h>/<util\/string\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')

gsed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
gsed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
gsed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
gsed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
gsed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h
gsed -i 's/BITCOIN_UTILASMAP_H/BITCOIN_UTIL_ASMAP_H/g' src/util/asmap.h
gsed -i 's/BITCOIN_UTILSTRING_H/BITCOIN_UTIL_STRING_H/g' src/util/string.h

gsed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
gsed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
gsed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
gsed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
gsed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am
gsed -i 's/utilasmap\.\(h\|cpp\)/util\/asmap\.\1/g' src/Makefile.am
gsed -i 's/utilstring\.\(h\|cpp\)/util\/string\.\1/g' src/Makefile.am

gsed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
gsed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
gsed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
gsed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
------------- END   SCRIPT ---------------
2021-06-27 12:03:13 +05:30
Wladimir J. van der Laan
82659a4eb8 Merge #12257: [wallet] Use destination groups instead of coins in coin select
232f96f5c8a3920c09db92f4dbac2ad7d10ce8cf doc: Add release notes for -avoidpartialspends (Karl-Johan Alm)
e00b4699cc6d2ee5697d38dd6607eb2631c9b77a clean-up: Remove no longer used ivars from CInputCoin (Karl-Johan Alm)
43e04d13b1ffc02b1082176e87f420198b40c7b1 wallet: Remove deprecated OutputEligibleForSpending (Karl-Johan Alm)
0128121101fb3ee82f3abd3973a967a4226ffe0e test: Add basic testing for wallet groups (Karl-Johan Alm)
59d6f7b4e2f847ec1f2ff46c84e6157655984f85 wallet: Switch to using output groups instead of coins in coin selection (Karl-Johan Alm)
87ebce25d66952f5ce565bb5130dcf5e24049872 wallet: Add output grouping (Karl-Johan Alm)
bb629cb9dc567cc819724d9f4852652926e60cbf Add -avoidpartialspends and m_avoid_partial_spends (Karl-Johan Alm)
65b3eda458221644616d0fdd6ba0fe01bdbce893 wallet: Add input bytes to CInputCoin (Karl-Johan Alm)
a443d7a0ca333b0bae63e04b5d476f9ad9c7aeac moveonly: CoinElegibilityFilter into coinselection.h (Karl-Johan Alm)
173e18a289088c6087ba6fac708e322aa63b7a94 utils: Add insert() convenience templates (Karl-Johan Alm)

Pull request description:

  This PR adds an optional (off by default) `-avoidpartialspends` flag, which changes coin select to use output groups rather than outputs, where each output group corresponds to all outputs with the same destination.

  It is a privacy improvement, as each time you spend some output, any other output that is publicly associated with the destination (address) will also be spent at the same time, at the cost of fee increase for cases where coin select without group restriction would find a more optimal set of coins (see example below).

  For regular use without address reuse, this PR should have no effect on the user experience whatsoever; it only affects users who, for some reason, have multiple outputs with the same destination (i.e. address reuse).

  Nodes with this turned off will still try to avoid partial spending, if the fee of the resulting transaction is not greater than the fee of the original transaction.

  Example: a node has four outputs linked to two addresses `A` and `B`:

  * 1.0 btc to `A`
  * 0.5 btc to `A`
  * 1.0 btc to `B`
  * 0.5 btc to `B`

  The node sends 0.2 btc to `C`. Without `-avoidpartialspends`, the following coin selection will occur:
  * 0.5 btc to `A` or `B` is picked
  * 0.2 btc is output to `C`
  * 0.3 - fee is output to (unique change address)

  With `-avoidpartialspends`, the following will instead happen:
  * Both of (0.5, 1.0) btc to `A` or `B` is picked (one or the other pair)
  * 0.2 btc is output to `C`
  * 1.3 - fee is output to (unique change address)

  As noted, the pro here is that, assuming nobody sends to the address after you spend from it, you will only ever use one address once. The con is that the transaction becomes slightly larger in this case, because it is overpicking outputs to adhere to the no partial spending rule.

  This complements #10386, in particular it addresses @luke-jr and @gmaxwell's concerns in https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-300667926 and https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-302361381.

  Together with `-avoidreuse`, this fully addresses the concerns in #10065 I believe.

Tree-SHA512: 24687a4490ba59cf4198ed90052944ff4996653a4257833bb52ed24d058b3e924800c9b3790aeb6be6385b653b49e304453e5d7ff960e64c682fc23bfc447621

# Conflicts:
#	src/Makefile.am
#	src/bench/coin_selection.cpp
#	src/wallet/coincontrol.h
#	src/wallet/coinselection.cpp
#	src/wallet/coinselection.h
#	src/wallet/init.cpp
#	src/wallet/test/coinselector_tests.cpp
#	src/wallet/wallet.cpp
#	src/wallet/wallet.h
#	test/functional/test_runner.py
2021-06-24 13:21:20 -04:00
Pieter Wuille
7ff6515c88
Merge #13033: Build txindex in parallel with validation
9b2704777c [doc] Include txindex changes in the release notes. (Jim Posen)
ed77dd6b30 [test] Simple unit test for TxIndex. (Jim Posen)
6d772a3d44 [rpc] Public interfaces to GetTransaction block until synced. (Jim Posen)
a03f804f2a [index] Move disk IO logic from GetTransaction to TxIndex::FindTx. (Jim Posen)
e0a3b80033 [validation] Replace tx index code in validation code with TxIndex. (Jim Posen)
8181db88f6 [init] Initialize and start TxIndex in init code. (Jim Posen)
f90c3a62f5 [index] TxIndex method to wait until caught up. (Jim Posen)
70d510d93c [index] Allow TxIndex sync thread to be interrupted. (Jim Posen)
94b4f8bbb9 [index] TxIndex initial sync thread. (Jim Posen)
34d68bf3a3 [index] Create new TxIndex class. (Jim Posen)
c88bcec93f [db] Migration for txindex data to new, separate database. (Jim Posen)
0cb8303241 [db] Create separate database for txindex. (Jim Posen)

Pull request description:

  I'm re-opening #11857 as a new pull request because the last one stopped loading for people

  -------------------------------

  This refactors the tx index code to be in it's own class and get built concurrently with validation code. The main benefit is decoupling and moving the txindex into a separate DB. The primary motivation is to lay the groundwork for other indexers that might be desired (such as the [compact filters](https://github.com/bitcoin/bips/pull/636)). The basic idea is that the TxIndex spins up its own thread, which first syncs the txindex to the current block index, then once in sync the BlockConnected ValidationInterface hook writes new blocks.

  ### DB changes

  At the suggestion of some other developers, the txindex has been split out into a separate database. A data migration runs at startup on any nodes with a legacy txindex. Currently the migration blocks node initialization until complete.

  ### Open questions

  - Should the migration of txindex data from the old DB to the new DB block in init or should it happen in a background thread? The downside to backgrounding it is that `getrawtransaction` would return an error message saying the txindex is syncing while the migration is running.

  ### Impact

  In a sample size n=1 test where I synced nodes from scratch, the average time [Index writing](https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1903) was 3.36ms in master and 1.72ms in this branch. The average time between `UpdateTip` log lines for sequential blocks between 400,000 and IBD end on mainnet was 0.297204s in master and 0.286134s in this branch. Most likely this is just variance in IBD times, but I can try with some more trials if people want.

Tree-SHA512: 451fd7d95df89dfafceaa723cdf0f7b137615b531cf5c5035cfb54e9ccc2026cec5ac85edbcf71b7f4e2f102e36e9202b8b3a667e1504a9e1a9976ab1f0079c4
2021-05-25 13:48:04 +03:00
PastaPastaPasta
da480fcd70
refactoring: governance tidying and include refactoring (#4111)
* remove unneeded semi-colons

* remove an unneeded CGovernanceException

* adjust and optimize listVotes to vector conversion

* governance-vote.h forward declare and include in cpp

* governance: use more forward decl. less includes in headers

* remove a number of unneeded includes in dash rpc code

* resolve circular depends linter

* Reorder includes

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-23 00:32:03 +02:00
PastaPastaPasta
d70d987be2
refactor: remove some validationinterface includes, resolve circular depends (#4116) 2021-04-20 22:32:27 +03:00
PastaPastaPasta
5074e6df9e
Extensive include refactoring (#4095)
* Simple changes, mostly just includes

* Continued include changes combined with using pointers to avoid including more than necessary in headers

* remove dup include

* masternode-utils.cpp include net.h in all builds

* resolve linter -7 +11

* drop quorums.h from dkgsessionhandler.cpp

* Add `<utilstrencodings.h>`

* Initialize lastMNListForVotingKeys

* Refactor GetMinedCommitment to return sharedptr

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-15 23:41:16 -04:00
UdjinM6
6ba3b2f3b8
Merge pull request #4081 from xdustinface/pr-fix-issue-3521
backport: Some wallet related PRs
2021-04-07 00:38:41 +03:00
Wladimir J. van der Laan
d4ac6d62a9 Merge #14350: Add WalletLocation class
65f3672f3b82a6fa30e5171f85bc8d8a29e0797e wallet: Refactor to use WalletLocation (João Barbosa)
01a4c095c87500650663341533f000c6b613e9da wallet: Add WalletLocation utility class (João Barbosa)

Pull request description:

  Advantages of this change:
   - avoid resolving wallet absolute path and name repetitively and in multiple places;
   - avoid calling `GetWalletDir` in multiple places;
   - extract these details from the actual wallet implementation.

  The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory.

Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2021-04-05 03:31:50 +02:00
PastaPastaPasta
a72acc113d
Move net.h include from quorums_*.h into quorums.cpp (#4075)
* Remove net include from quorums-util.h

* circular depends -1

* include timedata.h in quorums_debug.cpp

* fix circular depends linter
2021-04-02 03:19:34 +02:00
PastaPastaPasta
7e71a54e54
trivial: various include adjustments (#4074)
* remove unused includes in validation.cpp

circular depends -2

* use more specific include in quorums.h

circular depends -1

* Remove unneeded include from quorums.cpp

circular depends -1
2021-03-31 16:02:22 -04:00
PastaPastaPasta
4a84c99bad
trivial: Remove unneeded include from quorums_instantsend.cpp (#4073)
* Remove unneeded include from quorums_instantsend.cpp

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

* circular depends -6
2021-03-31 16:01:59 -04:00
PastaPastaPasta
9d1c35438c
rely on stopRequested which is set when ShutdownRequested (#4069)
circular depends -1

Signed-off-by: pasta <pasta@dashboost.org>
2021-03-29 14:03:17 -04:00
PastaPastaPasta
f492291aca
refactor: llmq pretty trivial refactor circular dependancy (#4065)
* move DEFAULT_WATCH_QUORUMS to quorums.h

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

* resolve circular lint, -10, +4
2021-03-26 13:21:41 +01:00
dustinface
ae506bae66
refactor: PrivateSend -> CoinJoin + Move the tab (#4038)
* qt|wallet|privatesend: Rename PrivateSend to CoinJoin in GUI strings

* qt: Move CoinJoin next to Transactions

* qt: Adjust status tip of privateSendCoinsMenuAction

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

* rename: privateSend -> coinJoin

* rename: privatesend -> coinjoin

* rename: PrivateSend -> CoinJoin

* rename: use_ps -> use_cj

* rename: PRIVATESEND -> COINJOIN

* rename: privatesend -> coinjoin for files and folders

* refactor: Re-order coinjoin files in cmake/make files

* refactor: Re-order coinjoin includes where it makes sense

* test: Update lint-circular-dependencies.sh

* Few cleanups

* test: test/coinjoin_tests.cpp -> wallet/test/coinjoin_test.cpp

* s/AdvancedPSUI/AdvancedCJUI/g

* s/privateSentAmountChanged/coinJoinAmountChanged/g

* wallet: Rename "ps_salt" backwards compatible

* Minimal PrivateSend -> CoinJoin migration for settings and cmd-line

* wallet: Fix privatesendrounds -> coinjoinrounds migration

* qt: Migrate nPrivateSendAmount -> nCoinJoinAmount

* `-coinjoindenoms` never existed

* Migrate all PS options/settings

* rpc: Formatting only

* qt: Make Send/CoinJoin tabs a bit more distinguishable

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-17 18:36:11 -04:00
UdjinM6
8da57523b7
Make recently added help strings dynamic, add one missing string (#3996)
* docs: Add help for -recsigsmaxage option

* Make `-llmq-data-recovery` help string dynamic

* Make devnet/regtest specific help strings dynamic

Only show devnet related help strings on devnet.

* Make linter happy

* Skip FindDevNetGenesisBlock when creating devnet params for help purposes only
2021-02-23 01:46:40 +03:00
UdjinM6
e029f24c1c Fix some circular dependencies, update EXPECTED_CIRCULAR_DEPENDENCIES to make linter happy 2021-02-04 14:58:20 -06:00
Wladimir J. van der Laan
cd59867e7b Merge #13695: lint: Add linter for circular dependencies
5c613aadd64453c75cb2373c6fcc1326c3cf0b7a lint: Add linter for circular dependencies (Ben Woosley)

Pull request description:

  Protects against added circular depencies, makes it explicit in the
  code when circular dependencies have been removed.

  Modeled after EXPECTED_BOOST_INCLUDES in lint-includes.sh

  Example output:
  ```
  $ test/lint/lint-circular-dependencies.sh
  A new circular dependency in the form of "qt/paymentserver -> qt/walletmodel -> qt/paymentserver" appears to have been introduced.

  $ echo $?
  1
  $ test/lint/lint-circular-dependencies.sh
  Good job! The circular dependency "Fake" is no longer present.
  Please remove it from EXPECTED_CIRCULAR_DEPENDENCIES in test/lint/lint-circular-dependencies.sh
  to make sure this circular dependency is not accidentally reintroduced.

  $ echo $?
  1
  $ test/lint/lint-circular-dependencies.sh
  $ echo $?
  0

  ```

Tree-SHA512: 4519434de29f6d50859daed1480e531c01c1cdbc3f0a5f093251daf62ae2b5b9073fb274b86f541a985e06837aa1165b76558c5f35fb51a759d72e83f1b61e44
2021-02-04 14:58:13 -06:00