Commit Graph

906 Commits

Author SHA1 Message Date
PastaPastaPasta
988a1693fc
Dashification 2021-06-28 17:39:58 -05:00
MarcoFalke
00fed7aa95
Merge #15249: Docs: Update python docs to reflect that wildcard imports are disallowed
f618c58b75 Docs: Update python docs to reflect that wildcard imports are disallowed (Ben Woosley)

Pull request description:

  These have been disallowed via flake8 since: #13054

Tree-SHA512: f41651fd883e3786a7e87c4aa4c54749308e576287f2f88da3f1d8d0f59e14519d99061f1efd05b8745f495f87a14286cea576f1507d10ccd226f8cf2f2b3cc8
2021-06-28 13:40:58 -05:00
Jonas Schnelli
517788dabc
Merge #14353: REST: add blockhash call, fetch blockhash by height
42ff30ec6 [Docs] add short documentation for /rest/blockhashbyheight (Jonas Schnelli)
579d418f7 [QA] add rest tests for /rest/blockhashbyheight/<HEIGHT>.<FORMAT> (Jonas Schnelli)
eb9ef04c4 REST: add "blockhashbyheight" call, fetch blockhash by height (Jonas Schnelli)

Pull request description:

  Completes the REST interface for trivial block exploring by adding a call that allows to fetch the blockhash in the main chain by a given height.

Tree-SHA512: 94be9e56718f857279b11cc16dfa8d04f3b5a762e87ae54281b4d87247c71c844895f4944d5a47f09056bf851f4c4761ac4fbdbaaee957265d14de5c1c73e8d2
2021-06-28 13:40:57 -05:00
Wladimir J. van der Laan
949f158bc1
Merge #15177: rest: Improve tests and documention of /headers and /block
7cf994d5cfd53dcff76ebd0e0007e3477a7570e8 qa: Improve tests of /rest/headers and /rest/block (João Barbosa)
0825b86b280c684c32c60bac9e862298c7279f27 doc: /rest/block responds with 404 if block does not exist (João Barbosa)
be625f7c5562afed517ff51d2d85268ba5ce6017 doc: Explain empty result of /rest/headers (João Barbosa)

Pull request description:

  Follow up of #15107.

Tree-SHA512: a7fdeed05216e3eda9604664db529237c2d0ddf422cfac139d6345a22b6e00bfe870d4e3f177423db7d4efb295ac2dc0ca2eb20c9c27c0719b89fd5428860d03
2021-06-28 13:40:57 -05:00
Wladimir J. van der Laan
b12c459007
Merge #14409: utils and libraries: Make 'blocksdir' always net specific
e4a0c3547ed886871f8b3d51c6b4ffdb181a8b9c Improve blocksdir functional test. (Hennadii Stepanov)
c3f1821ac788e522e7558e3575150433450dcb8c Make blockdir always net specific (Hennadii Stepanov)

Pull request description:

  The blocks directory is net specific by definition.

  Also this prevents the side effect of calling `GetBlocksDir(false)` in the non-mainnet environment.
  Currently a new node creates an unused `blocks\` directory in the root of the data directory when `-testnet` or `-regtest` is specified.

  Refs:
  - #12653
  - https://github.com/bitcoin/bitcoin/pull/12653#discussion_r174784834 by @laanwj
  - https://github.com/bitcoin/bitcoin/issues/14595#issuecomment-436011186

Tree-SHA512: c9957a68a4a200ebd2010823a56db7e61563afedcb7c9828e86b13f3af2990e07854b622c1f3374756f94574acb3ea32de7d2a399eef6c0623f0e11265155627
2021-06-28 13:40:55 -05:00
Wladimir J. van der Laan
a54f338783
Merge #15170: refactor/lint: Add ignored shellcheck suggestions to an array
cbd9091ed5a76bb2e1e57cd0d8db035c15529341 refactor/lint: Add ignored suggestions to an array (Vidar Holen)

Pull request description:

  By adding excluded shellcheck suggestions to an array, you can avoid the current duplication
  between command and comments. This ensures that they never go out of sync, makes it easier to
  add new ones, and improves the readability of related diffs.

Tree-SHA512: 04afced1d27fda940cc5e61d7f9ed04507c8f7f7dfd0031c09898a599c6de93695923a80cb3d515a0f0bf728847592d8680c15ac2e376b48726c03ca744f13a5
2021-06-28 13:40:55 -05:00
MarcoFalke
89972eeca7
Merge #15173: [doc] explain what .python-version does
04215eb328 [doc] explain what .python-version does (Sjors Provoost)

Pull request description:

  Documentation followup to https://github.com/bitcoin/bitcoin/pull/14884#discussion_r241444376.

Tree-SHA512: 7b2b2718f998b7257273fab2e4f1d127f7af468cd26b2bf05b3dc7d6367e349e0a9c92e976a2760e83cf56feb68c37c89cb3a8d92e20be900bea3fb7f1f3d47b
2021-06-28 13:40:55 -05:00
Wladimir J. van der Laan
de60193469
Merge #15164: qa: Ignore shellcheck warning SC2236
f652f85d0c88629b4284f69b179362254307fb55 qa: Ignore shellcheck warning SC2236 (João Barbosa)

Pull request description:

  With shellcheck 0.6.0 the warning `SC2236 -  Use -n instead of ! -z` is raised. This change adds that warning to the ignored list.

Tree-SHA512: 7b0dfbce55e5da4efb927e251257993cdf67cd1c90f8490d99fa75bf6e233bbee79ea1c59d28774994c59862c5eac061313aa154833284950fc844bda60a54e9
2021-06-28 13:40:54 -05:00
MarcoFalke
36343da091
Merge #15127: docs: Clarifying testing instructions
ef5ebc6d8f docs: Clarifying testing instructions (benthecarman)

Pull request description:

  This statement confused me on my first time reading through.  Hopefully, this addition will help someone else on their first time.

Tree-SHA512: 17f421275adb7586eca954910269d29fcd3bacc42fab4bc2e01110f9e13ca6f8c1ca178246f7192e1131f14ced7f7dc0b57e7aec324898807c1813a2ebc513de
2021-06-28 13:40:54 -05:00
Wladimir J. van der Laan
a81158ab92
Merge #14790: Tests: Allow running rpc_bind.py --nonloopback test without IPv6
c9066f07c94e3610f7762d6406851cd135790511 Allow running rpc_bind.py --nonloopback test without IPv6 (Kristaps Kaupe)

Pull request description:

  Don't see a reason why this can't be tested with IPv4 only.

Tree-SHA512: 515bdf700fad420e4b1798fd4978b53e2da3ddb26e43b16d68b43071bc912c325f1ceb10046ba3d0494dab289a53c45ddc2de9064117d8c1d6bf11e88323f490
2021-06-28 13:40:45 -05:00
Wladimir J. van der Laan
05dd5c7079
Merge #13421: qa: Remove portseed_offset from test runner
fa6edfef358518022ee86c0abc77c1c068f106a3 qa: Remove portseed_offset from test runner (MarcoFalke)

Pull request description:

  The portseed_offset is no longer needed in the test runner, since we already kill leftover processes (see #12904). This "fixes" #10869 because we deterministically pick ports starting at 11000

Tree-SHA512: 1ee22e19e02acd3afadc7c6a2b391fd3b5cfcec22c0fe194f3207251e7b1264a04e47d90a3ff8be4aca7d0ec33219a2f5855076acb3565291767939bc2f2fa17
2021-06-28 02:31:49 +03:00
Wladimir J. van der Laan
2c7c4bcc08
Merge #13367: qa: Increase includeconf test coverage
fa4760fbb3f1099dcd3c43ebc53c2a761a2170e8 qa: Increase includeconf test coverage (MarcoFalke)

Pull request description:

  This adds some missing `return false` for error conditions and adds test coverage [1] for those.

  Also, extend recursion warning when the chain was set in one of the includeconfs.

  [1] See the red lines in https://marcofalke.github.io/btc_cov/total.coverage/src/util.cpp.gcov.html for missing coverage.

Tree-SHA512: d32563c9bb277879895a173e699034db5ecdb4061a1ec8890c566d61e36a09efa5eda19a029baf952ff6d568f8b9684a13a0bb90827850075470975e2088fee4
2021-06-28 02:31:48 +03:00
Wladimir J. van der Laan
b12936ba71
Merge #13353: qa: Fixup setting of PATH env var
fa26cf015658ac2aa52b5e5656e38af9a12160cc qa: Fixup setting of PATH env var (MarcoFalke)

Pull request description:

  This was an oversight of mine in #13188

  Can be trivially tested with `BITCOIND=bitcoin-qt ./test/functional/wallet_disable.py` before and after this fix.

Tree-SHA512: 06c7b2f12158855eb2b6392861943821bd7ad3152cf0dd49ac4abd878e5b937ebee55e256ce5bdc1c2a9c775a452112c34533366c934ff5f0f412b3a7e1c8118
2021-06-28 02:00:51 +03:00
MarcoFalke
ff9623ec1c
Merge #13441: Prevent shared conf files from failing with different available options in different binaries
c2dfbb4a97 Add unavailable options to hidden options category (Andrew Chow)

Pull request description:

  From IRC:

  ```
  <ossifrage> FYI, bitcoin-qt from the head I built today won't start if you have "daemon=0" in the config file, so you can't use the same config for either bitcoind or bitcoin-qt
  <ossifrage> Seems like bitcoin-qt should ignore this option?
  <provoostenator> ossifrage: probably caused by 13112. Another problem is disablewallet=1 will prevent a launch if you compile bitcoind without wallet. It probably needs to be relaxed slightly.
  ```

  Adds all of the options that are unavailable due to compiling options to the hidden category so that shared config files do not break with the alternative binaries.

Tree-SHA512: 1ef43f5f7ad46ecc2865d22ee683ef22831e8f131ec99b732bb36d90381f7964bf64829595e993c2d435823fe4425a20323c8e65307cf2463a9e40b8049ab559
2021-06-28 02:00:50 +03:00
MarcoFalke
0fcb967e4d
Merge #13112: Throw an error for unknown args
903055730b Test gArgs erroring on unknown args (Andrew Chow)
4f8704d57f Give an error and exit if there are unknown parameters (Andrew Chow)
174f7c8080 Use a struct for arguments and nested map for categories (Andrew Chow)

Pull request description:

  Following #13190, gArgs is aware of all of the command line arguments. This PR has gArgs check whether the arguments provided are actually valid arguments. When an unknown argument is encountered, an error is printed to stderr and the program exist.

  Since gArgs is used for everything that has command line arguments, `bitcoind`, `bitcoin-cli`, `bitcoin-qt`, `bitcoin-tx`, and `bench_bitcoin` are all effected by this change and all now have the same argument checking behavior.

  Closes #1044

Tree-SHA512: 388201319a7d6493204bb5433da47e8e6c8266882e809f6df45f86d925f1f320f2fd13edb3e57ffc6a37415dfdfc689f83929452bca224229783accb367032e7
2021-06-28 02:00:50 +03:00
Jonas Schnelli
21bb444ad3
Merge #12924: Fix hdmaster-key / seed-key confusion (scripted diff)
6249021d1 [docs] Add release notes for HD master key -> HD seed rename (John Newbery)
79053a5f2 [rpc] [wallet] Add 'hdmasterkeyid' alias return values. (John Newbery)
c75c35141 [refactor] manually change remaining instances of master key to seed. (John Newbery)
131d4450b scripted-diff: Rename master key to seed (John Newbery)

Pull request description:

  Addresses #12084 and #8684

  This renames a couple of functions and members (no functional changes, expect log prints):

  - Rename CKey::SetMaster to CKey::SetSeed
  - Rename CHDChain::masterKeyId to CHDChain::seedID
  - Rename CHDChain::hdMasterKeyID to CHDChain::hdSeedID
  - Rename CWallet::GenerateNewHDMasterKey to CWallet::GenerateNewHDSeed
  - Rename CWallet::SetHDMasterKey to CWallet::SetHDSeed

  As well it introduces a tiny API change:

  - RPC API change: Rename "hdmasterkeyid" to "hdseedid", rename "hdmaster" in wallet-dump output to "hdseed"

  Fixes also a bug:

  - Bugfix: use "s" instead of the incorrect "m" for the seed-key hd-keypath key metadata

Tree-SHA512: c913252636f213135a3b64df5de5d21844fb9c2d646567c1aad0ec65745188587de26119de99492c67e559bd49fdd9606b54276f00dddb84301785beba58f281
2021-06-28 02:00:48 +03:00
Wladimir J. van der Laan
ec9f526cec
Merge #13197: util: warn about ignored recursive -includeconf calls
2352aa9 test: Ensure that recursive -includeconf produces appropriate warnings (Karl-Johan Alm)
c5bcc7d util: warn about recursive -includeconf arguments in configuration files (Karl-Johan Alm)

Pull request description:

  This is a follow-up PR to #10267, and addresses https://github.com/bitcoin/bitcoin/pull/10267#issuecomment-387546144.

  ~~I am adding extra work for @jnewbery in #12755 here -- maybe I should just rebase on top of that, but not sure what the appropriate approach is here.~~

Tree-SHA512: 87f0c32436b70424e33616ffb88d7cb699f90d6a583a10237e224b28fc936d6a9df95536c8c52ee8546b3942da92b2a357e61bf87e00d1462bc10d46d3bee352
2021-06-28 02:00:48 +03:00
UdjinM6
13300e413a
More of 12755 ("no governance validation" warnings in tests)
TODO: Maybe stop warning about no governance validation on pruned nodes?
2021-06-28 02:00:47 +03:00
Wladimir J. van der Laan
cc38451955
Merge #12755: [tests] Better stderr testing
beee49b [tests] Allow stderr to be tested against specified string (John Newbery)
e503671 [Tests] Use LIBC_FATAL_STDERR_=1 in tests (John Newbery)
c22ce8a [Tests] Write stdout/stderr to datadir instead of temp file. (John Newbery)

Pull request description:

  **Due to a merge conflict, this is now based on #10267. Please review that PR first!**

  Subset of #12379 now that parts of that PR have been merged.

  #12362 was only observed when running the functional tests locally because:

  - by defatul libc logs to `/dev/tty` instead of stderr
  - the functional tests only check for substring inclusion in stderr when we're expecting bitcoind to fail.

  This PR tightens our checking of stderr and will cause tests to fail if there is any unexpected message in stderr:

  - commit *Write stdout/stderr to datadir instead of temp file* writes stderr to a file in the datadir instead of a temporary file. This helps with debugging in the case of failure.
  - commit *Use LIBC_FATAL_STDERR=1 in tests* ensures that libc failures are logged to stderr instead of the terminal.
  commit *Assert that bitcoind stdout is empty on shutdown* asserts that stderr is empty on bitcoind shutdown.

Tree-SHA512: 21111030e667b3b686f2a7625c2b625ebcfb6998e1cccb4f3932e8b5d21fb514b19a73ac971595d049343430e9a63155986a7f5648cad55b8f36f3c58b1c7048
2021-06-28 02:00:44 +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
UdjinM6
11796986df
Merge pull request #4200 from Munkybooty/backports-0.18-pr1
Backports 0.18 pr1
2021-06-26 16:10:09 +03:00
UdjinM6
c5cc285d0e
Merge pull request #4191 from kittywhiskers/checkqueue
partial #15842, merge #15849, #17342, #18710: Add local thread pool to CCheckQueue
2021-06-26 16:08:02 +03:00
Kittywhiskers Van Gogh
c9d0d92b2d merge #18710: Add local thread pool to CCheckQueue 2021-06-25 12:25:14 +05:30
Kittywhiskers Van Gogh
94e3a5de64 bitcoin#14209: Replace LogPrint macros with regular functions 2021-06-24 23:43:02 +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
MarcoFalke
4e26802df7 Merge #14225: tests: Reorder tests and move most of extended tests up to normal tests
d641c29a5a travis: Run feature_dbcrash functional tests in cron job (Chun Kuan Lee)
c0d947d725 tests: Reorder tests and move most of extended tests up to normal tests (Chun Kuan Lee)

Pull request description:

  The travis should run almost all jobs unless it takes really long time, however it does not take too long for now. So it's time for moving it to normal job.

  (The test sort is to see how many conflict will this cause, will drop it if there are too many)

  The first commit can be reviewed by `git diff --color-moved=plain`

Tree-SHA512: db6bd5b1f19de2f729012adda6ed00ca989071fd40a20710c0ff2579b5bd008edcf7421c1ad56d5f0752354e7df408f58351129d35a1ab7f4a6caa9d315df2ec

# Conflicts:
#	.travis/test_06_script.sh
#	test/functional/test_runner.py
2021-06-22 12:07:23 -04:00
MarcoFalke
259afa077c Merge #13965: tests: Fix extended functional tests fail
a9cf5c9623 Import CInv from correct module (Chun Kuan Lee)

Pull request description:

  Fix extended tests fail

  https://travis-ci.org/bitcoin/bitcoin/builds/415574232

Tree-SHA512: 1dd8cd3854ddf4d8c2f4cb700c2b4d866c0890b57c2e0cf73a38b97fbbd13c8c6149a8914c9d03453b4625873241cc3d470f069dd1918cf360d10ad5d79d717f
2021-06-15 14:47:22 -04:00
Wladimir J. van der Laan
edac135e2d Merge #13707: tests: Add usage note to check-rpc-mappings.py
03a2d680101a9fee47c6fd818df7585cfc93ac06 Tests: add usage note to check-rpc-mappings.py (Mason Simon)

Pull request description:

  This test would previously fail without a user-friendly warning message, if invoked with no arguments.

  Test plan:
  ```
  bitcoin @_@$ python3 test/lint/check-rpc-mappings.py
  Usage: test/lint/check-rpc-mappings.py ROOT-DIR
  bitcoin @_@$ echo $?
  1
  bitcoin @_@$ python3 test/lint/check-rpc-mappings.py .
  * Checking consistency between dispatch tables and vRPCConvertParams
  bitcoin @_@$ echo $?
  0
  ```

Tree-SHA512: 0b7a94125d18ba5dbf3c3281a4af60718d2e495bf7645d7c2a3e1a2a1d80cffcea1383c90247186728037f1f2b38de75d0f59ccf7f792d69edd33884f3698c07
2021-06-15 13:15:26 -04:00
UdjinM6
a8aee57447
Merge pull request #4190 from kittywhiskers/tlocks
merge #11640, #11599, #16112, #16127, #18635, #19249: thread safety and locking improvements
2021-06-11 15:23:35 +03:00
Kittywhiskers Van Gogh
8bc1cae8e2 merge #16112: Log early messages 2021-06-08 07:49:35 +05:30
Wladimir J. van der Laan
906be7e144
Merge #11423: [Policy] Several transaction standardness rules
364bae5 qa: Pad scriptPubKeys to get minimum sized txs (MarcoFalke)
7485488 Policy to reject extremely small transactions (Johnson Lau)
0f8719b Add transaction tests for constant scriptCode (Johnson Lau)
9dabfe4 Add constant scriptCode policy in non-segwit scripts (Johnson Lau)

Pull request description:

  This disables `OP_CODESEPARATOR` in non-segwit scripts (even in an unexecuted branch), and makes a positive `FindAndDelete` result invalid. This ensures that the `scriptCode` serialized in `SignatureHash` is always the same as the script passing to the `EvalScript`.

Tree-SHA512: a0552cb920294d130251c48053fa2ff1fbdd26332e62b52147d918837852750f0ce35ce2cd1cbdb86588943312f8154ccb4925e850dbb7c2254bc353070cd5f8
2021-06-05 22:13:01 +03:00
Wladimir J. van der Laan
4ae641ca18
Partial merge #8499: Add several policy limits and disable uncompressed keys for segwit scripts
67d6ee1 remove redundant tests in p2p-segwit.py (Johnson Lau)
9260085 test segwit uncompressed key fixes (Johnson Lau)
248f3a7 Fix ismine and addwitnessaddress: no uncompressed keys in segwit (Pieter Wuille)
b811124 [qa] Add tests for uncompressed pubkeys in segwit (Suhas Daftuar)
9f0397a Make test framework produce lowS signatures (Johnson Lau)
4c0c25a Require compressed keys in segwit as policy and disable signing with uncompressed keys for segwit scripts (Johnson Lau)
3ade2f6 Add standard limits for P2WSH with tests (Johnson Lau)
2021-06-05 22:12:55 +03:00
UdjinM6
bcc8b35194
Merge pull request #4178 from UdjinM6/backports-0.17-pr30
Merge #13033: Build txindex in parallel with validation
2021-06-05 22:08:47 +03:00
Kittywhiskers Van Gogh
680067ce7a
merge #19954: Complete the BIP155 implementation and upgrade to TORv3 2021-05-29 23:24:52 +03:00
UdjinM6
b4b24d370c
Merge pull request #4180 from UdjinM6/pre_pr4025_serialization
Various serialization backports
2021-05-29 23:23:19 +03:00
UdjinM6
95209acdc3
partial merge #8149: ser_vector changes from [qa] p2p segwit tests commit 2021-05-27 21:49:53 +03:00
Wladimir J. van der Laan
79568f97c3
Merge #13188: qa: Remove unused option --srcdir
fac1e1f qa: Remove unused option --srcdir (MarcoFalke)

Pull request description:

  The `srcdir` option was both unused and misleading; It should have been called `builddir`. So remove it.

Tree-SHA512: 2c24dcf2aa82219158b8cbbf03dd3f0f51f805f1f5f670faa1fd59e5a8d60fda120ffddadeccb058d8d3f20583b4952be7afd2df6bbefb9367d35c0f0a9fda3c
2021-05-25 14:09:36 +03:00
Wladimir J. van der Laan
dc1830a2f0
Merge #10267: New -includeconf argument for including external configuration files
25b7ab9 doc: Add release notes for -includeconf (Karl-Johan Alm)
0f0badd test: Test includeconf parameter. (Karl-Johan Alm)
629ff8c -includeconf=<path> support in config handler, for including external configuration files (Karl-Johan Alm)

Pull request description:

  Fixes: #10071.

  Done:
  - adds `-includeconf=<path>`, where `<path>` is relative to `datadir` or to the path of the file being read, if in a file
  - protects against circular includes
  - updates help docs

  ~~~Thoughts:~~~
  - ~~~I am not sure how to test this in a neat manner. Feedback on this would be nice. Will dig/think though.~~~

Tree-SHA512: cb31f1b2f69fbc0890d264948eb2e501ac05cf12f5e06a5942f9c1539eb15ea8dc3cae817f4073aecb2fcc21d0386747f14f89d990772003a76e2a6d25642553
2021-05-25 14:09:36 +03:00
MarcoFalke
f1ec546b35
Merge #13136: [tests] Fix flake8 warnings in several wallet functional tests
a533834d50 [tests] Fix flake8 warnings in several wallet functional tests (John Newbery)

Pull request description:

  Fixes flake8 warnings in several wallet functional tests.

  Several wallet functional tests need rewrite to remove the accounts API (#13075). To prepare for that, I fixed all the flake8 warnings in those tests.

  #13075 is blocked on a bitcoind bug. This PR is just the flake8 fixes so we're not completely blocked.

Tree-SHA512: 2dc1d589b2f8f4318083a681e487532d0f8f3d57e8bc8f37b660b728ffc33329b88e9251eb223104aea89f293c3f4074ca700fe690e645617326b859da3e93c3
2021-05-25 14:09:35 +03: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
Wladimir J. van der Laan
4aca43e24a
Merge #12909: wallet: Make fee settings to be non-static members
fac0db0 wallet: Make fee settings non-static members (MarcoFalke)

Pull request description:

  The wallet header defined some globals (they were called "settings"), that should be class members instead.

  This commit is hopefully only refactoring, apart from a multiwallet bugfix: Calling the rpc `settxfee` for one wallet, would set (and change) the fee rate for all loaded wallets. (See added test case)

Tree-SHA512: 4ab6ec2f5c714742396ded5e451ec3b1ceb771e3696492de29889d866de4365b3fbe4a2784d085c8b8bd11b1ebb8a1fec99ab2c62eee716791cfc67c0cf29e1b
2021-05-23 01:19:33 +03:00
MarcoFalke
716d0cd696
Merge #13047: [trivial] Tidy blocktools.py
4d355bfb2b [tests] tidy up blocktools.py (John Newbery)
cab8be5adf [tests] Fix flake8 warnings in blocktools.py (John Newbery)
b184127db2 [doc][trivial] no retargeting in regtest mode (Jesse Cohen)

Pull request description:

  Tidies up the blocktools.py module:

  - fixes flake8 warnings
  - changes function-level comments to docstrings.

  Takes in @skeees's commit b184127db2

Tree-SHA512: 0f4c59ac8ccc9057492ec1996381e73380d65e85240f2ba9607174c0743d3a1853c4ed35a9e1bc704b2b6d6d823ac77aa7e81bd150cf5033de79293c24b791b0
2021-05-23 01:19:33 +03:00
MarcoFalke
add77dd7b1
Merge #12917: qa: Windows fixups for functional tests
fab9095d40 qa: Windows fixups for functional tests (MarcoFalke)

Pull request description:

  Just two minor fixups to have less errors when the tests run on native windows.
  * Strip whitespace from lines when reading from a notification file
  * Instead of clumsily creating a file with weird permissions, just create a folder for the same effect in `mempool_persist.py`

Tree-SHA512: 48a8b439f14ab9b44c5cd228cd03105e8613e703e3c2951cdf724931bc95172a9ad9bfe69fc23e73dd91b058c1352263c0ac6e8de2ceb0ebf804c8ff52bba394
2021-05-23 01:19:32 +03:00
Wladimir J. van der Laan
e0eea2db3c
Merge #12856: Tests: Add Metaclass for BitcoinTestFramework
c9cce0a Tests: Add Metaclass for BitcoinTestFramework (Will Ayd)

Pull request description:

  BitcoinTestFramework instructs developers in its docstring to override
  `set_test_params` and `run_test` in subclasses while being sure NOT to
  override `__init__` and `main` . This change adds a metaclass to ensure
  that developers adhere to that protocol, raising a ``TypeError`` in
  instances where they have not.

  closes #12835

Tree-SHA512: 5a47a7ead1f18361138cad4374747c4a8f29d25506f7b2c2a8c1c966a0b65e5ccf7317f9a078df8680fdab5d3fb71fee46a159c9f381878a3683c1e9f874abbe
2021-05-23 01:19:32 +03:00
Wladimir J. van der Laan
213e509f30
Merge #12766: [Tests] Tidy up REST interface functional tests
55efc1f [tests] simplify binary and hex response parsing in interface_rest.py (Roman Zeyde)
ade5964 [tests] only use 2 nodes in interface_rest.py (John Newbery)
ad00fbe [tests] refactor interface_rest.py to avoid code repetition (John Newbery)
7a3181a [tests] Make json request building more consistent in interface_rest.py (John Newbery)
3fd4490 [tests] improve logging and documentation in interface_rest.py (John Newbery)
abf190e [tests] fix flake8 warnings in interface_rest.py test (John Newbery)

Pull request description:

  Following the comment at https://github.com/bitcoin/bitcoin/pull/12717#pullrequestreview-106189117.

Tree-SHA512: b55560f0d8f3069584f5a2398285483a0a23514b2b2bd2c1ced2db1cb30dc24f60f720d0fa4de30259f7918d3178d94680ae9321649544d1d04d687a2e672559
2021-05-23 01:19:32 +03:00
MarcoFalke
778d749e16
Merge #12853: qa: Match full plain text by default
faace13868 qa: Match full plain text by default (MarcoFalke)

Pull request description:

  Instead of escaping all full plain text error strings, just compare their strings by default.

Tree-SHA512: 42e28f55105eb947ac6af6ce4056f0ec0f701d85f1c2a38b35ab777bbdf2296bdb79639c345621b8adc03a98b28c7630ded9a67b8b04a48e2c3a49d598ecdcd7
2021-05-23 01:19:32 +03:00
MarcoFalke
31e0fb550f
Merge #14819: Bugfix: test/functional/mempool_accept: Ensure oversize transaction is actually oversize
29aeed1734 Bugfix: test/functional/mempool_accept: Ensure oversize transaction is actually oversize (Luke Dashjr)

Pull request description:

  Simply integer dividing results in an acceptable size if the limit isn't an exact multiple of the input size.
  Use math.ceil to ensure the transaction is always oversize.

  (This issue can be triggered by changing the address style used.)

Tree-SHA512: e45062b0e8a3e9cb08e9dac5275b68d86e4377b460f1b3b995944090a055b0542a6986826312ec0e223369838094e42e20d8614b5c2bab9975b9a6f749295b21
2021-05-23 01:19:32 +03:00
Wladimir J. van der Laan
50607de7b2
Merge #11742: rpc: Add testmempoolaccept
b55555d rpc: Add testmempoolaccept (MarcoFalke)

Pull request description:

  To check if a single raw transaction makes it into the current transaction pool, one had to call `sendrawtransaction`. However, on success, this adds the transaction to the mempool with no easy way to undo.

  The call `testmempoolaccept` is introduced to provide a way to solely check the result without changing the mempool state.

Tree-SHA512: 5afd9311190135cee8fc1f229c7d39bf893f1028f29e28d34f70df820198ff97b4bf86b41cbbd6e6c36a5c30073cefa92d541c74a4939c7a2a6fa283dfd41b63
2021-05-23 01:19:31 +03:00
PastaPastaPasta
b76e7fec1f
Merge pull request #4164 from kittywhiskers/auxprs
Merge #19660, #19373, #19841, #13862, #13866, #17280, #17682 and partial #19326, #14978: Auxiliary Backports
2021-05-21 14:25:27 -05:00
Kittywhiskers Van Gogh
96eaef33ee Merge #13862: drop boost::interprocess::file_lock 2021-05-20 10:15:17 +05:30
Kittywhiskers Van Gogh
401098283e Merge #17812: asmap feature refinements and functional tests 2021-05-20 00:05:12 +05:30
UdjinM6
5cdd67ed53
tests: Use wait_for_chainlocked_block_all_nodes in more places (#4139) 2021-05-11 18:55:40 +02:00
dustinface
5285bd801c
Merge pull request #4138 from UdjinM6/make_shellcheck_0.7.2_happy
Backport 13066, 13448 and fix `commit-script-check.sh` to make shellcheck 0.7.2 happy
2021-05-11 18:54:55 +02:00
UdjinM6
90d7e1f370
instantsend: Partially revert 3987, add more tests for CL vs IS conflicts (#4146)
* tests: Check that CLs override ISes which invalidated non-CLed blocks earlier

* partial revert 3987: Do not mark blocks which conflict with ISes as "conflicting"
2021-05-11 18:50:14 +02:00
UdjinM6
7616b04cb2
Rename bit 6 from "v17" to "dip0020" (#4142) 2021-05-07 18:36:30 +02:00
UdjinM6
f488d938f9
Make shellcheck 0.7.2 happy
Fixes `SC2268: Avoid x-prefix in comparisons as it no longer serves a purpose.`
2021-05-05 14:12:04 +03:00
dustinface
9feb9250ce
rpc|llmq|test: Implement verifychainlock (#4119)
* llmq: Make CLSIG_REQUESTID_PREFIX available outside of quorums_chainlocks.cpp

* rpc: Implement `verifychainlock`

* test: Add rpc_verifychainlock.py

* rpc: Fix help text

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-26 13:51:15 +02: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
c5b919d084
Update copyright (#4115)
* run: `python3 contrib/devtools/copyright_header.py update .`

* bump copyright year
2021-04-20 22:33:02 +03:00
PastaPastaPasta
d70d987be2
refactor: remove some validationinterface includes, resolve circular depends (#4116) 2021-04-20 22:32:27 +03:00
dustinface
cea353f4b8
Merge pull request #4099 from PastaPastaPasta/backports-0.17-pr28
Backports 0.17 pr28
2021-04-19 17:20:00 +02:00
MarcoFalke
f547d8f645
Merge #13198: [qa] Avoid printing to console during cache creation
08ebdba82a [qa] Avoid printing to console during cache creation (Suhas Daftuar)

Pull request description:

Tree-SHA512: 151b73ab6989a44a5c3d4707ff2f756a360bc507249b645e008e08880ac1c51e83420c1d37b49b6b97089116550023bba64ff1f10437809f1c49980722d563b8
2021-04-18 00:37:04 -04:00
Wladimir J. van der Laan
90bc40d297
Merge #13004: Print to console by default when not run with -daemon
6a3b0d3 Print to console by default when not run with -daemon (Evan Klitzke)

Pull request description:

  Cherry-picked ef6fa1c38e1bd115d1cce155907023d79da379d8 from the "up for grabs" PR: "Smarter default behavior for -printtoconsole" (#12689).

  See previous review in #12689.

Tree-SHA512: 8923a89b9c8973286d53e960d3c464b1cd026cd5a5911ba62f9f972c83684417dc4004101815dfe987fc1e1baaec1fdd90748a0866bb5548e974d77b3135d43b
2021-04-18 00:37:04 -04:00
PastaPastaPasta
cc8880ec27
llmq/rpc: Adjust verify islock, don't err when transaction isn't known locally (#4106)
* llmq/rpc: Adjust verify islock, don't err when transaction isn't known locally

* combine two ifs

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

* tests: Verify islocks for unknown txes

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-16 17:03:41 +02: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
01dd958429
rpc: Tweak getaddressbalance to also show spendable and immature balances (#4098)
* rpc: Tweak getaddressbalance to also show spendable and immature balances

* tests: Check `balance_immature` and `balance_spendable`
2021-04-15 19:30:14 +02:00
UdjinM6
21372a238a
Bump CI test timeout (#4090)
Some of our tests are too heavy for slow gitlab shared runners
2021-04-10 16:37:29 -04:00
UdjinM6
4110aabf71
Fix command line help strings (#4088)
* s/bitcoin-tx/dash-tx/

* Fix regtestLLMQ

* Make `-socketevents` help string OS-independent
2021-04-10 16:36:31 -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
5db88d27cb Merge #14552: wallet: detecting duplicate wallet by comparing the db filename.
591203149f1700f594f781862e88cbbfe83d8d37 wallet: Create IsDatabaseLoaded function (Chun Kuan Lee)
15c93f075a881deb3ad7b1dd8a4516a9b06e5e11 wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. (Chun Kuan Lee)
c456fbd8dfcc748e5ec9feaa57ec0f2900f99cde Refactor: Move m_db pointers into BerkeleyDatabase (Russell Yanofsky)

Pull request description:

  Fix #14538

  Fix crash attempting to load the same wallet with different path strings that resolve to the same absolute path. The primary check which prevents loading the same wallet twice is:

  6b8d0a2164/src/wallet/db.cpp (L44)

  But this check is skipped if both wallet paths resolve to the same absolute path, due to caching here:

  6b8d0a2164/src/wallet/db.cpp (L467)

  Meanwhile a secondary check for duplicate wallets is not reliable because it based on a literal comparison, instead of comparison using absolute paths:

  6b8d0a2164/src/wallet/wallet.cpp (L3853)

  This PR fixes the latter check to compare the absolute path of a new wallet being loaded to absolute paths of wallets already loaded, so there should no longer be any way to load the same wallet more than once.

Tree-SHA512: 2fa01811c160b57be3b76c6b4983556a04bbce71a3f8202429987ec020664a062e897deedcd9248bc04e9baaa2fc7b464e2595dcaeff2af0818387bf1fcdbf6f
2021-04-05 03:31:50 +02: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
Wladimir J. van der Laan
86357cc55f Merge #14320: [bugfix] wallet: Fix duplicate fileid detection
4ea77320c5f0b275876be41ff530bb328ba0cb87 tests: add test case for loading copied wallet twice (Chun Kuan Lee)
2d796faf62095e83f74337c26e7e1a8c3957cf3c wallet: Fix duplicate fileid (Chun Kuan Lee)

Pull request description:

  The implementation in current master can not detect if the file ID is duplicate with flushed `BerkeleyEnvironment`. This PR would store the file ID in a global variable `g_fileids` and release it when the `BerkeleyDatabase` close. So it won't have to rely on a `Db*`.

  Fix #14304

Tree-SHA512: 0632254b696bb4c671b5e2e5781e9012df54ba3c6ab0f919d9f6d31f374d3b0f8bd968b90b537884ac8c3d2906afdd58c2ce258666263464c7dbd636960b0e8f
2021-04-05 03:31:50 +02:00
Wladimir J. van der Laan
5179599526 Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down
c1dde3a949b36ce9c2155777b3fa1372e7ed97d8 No longer shutdown after encrypting the wallet (Andrew Chow)
d7637c5a3f1d62922594cdfb6272e30dacf60ce9 After encrypting the wallet, reload the database environment (Andrew Chow)
5d296ac810755dc47f105eb95b52b7e2bcb8aea8 Add function to close all Db's and reload the databae environment (Andrew Chow)
a769461d5e37ddcb771ae836254fdc69177a28c4 Move BerkeleyEnvironment deletion from internal method to callsite (Andrew Chow)

Pull request description:

  This is the replacement for #11678 which implements @ryanofsky's [suggestion](https://github.com/bitcoin/bitcoin/pull/11678#pullrequestreview-76464511).

  Shutting down the software was to prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted [here](https://bitcointalk.org/index.php?topic=51474.msg616068#msg616068). This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation.

  To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote [this script](https://gist.github.com/achow101/7f7143e6c3d3fdc034d3470e72823e9d) to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine).

  As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011.

  cc @ryanofsky

Tree-SHA512: 34b894283b0677a873d06dee46dff8424dec85a2973009ac9b84bcf3d22d05f227c494168c395219d9aee3178e420cf70d4b3eeacc9785aa86b6015d25758e75
2021-04-05 03:31:50 +02:00
Jonas Schnelli
75d375acb7 Merge #13111: Add unloadwallet RPC
fe65bdec2 bugfix: Delete walletView in WalletFrame::removeWallet (João Barbosa)
0b82bac76 bugfix: Remove dangling wallet env instance (João Barbosa)
0ee77b207 ui: Support wallets unloaded dynamically (João Barbosa)
9f9b50d5f doc: Add release notes for unloadwallet RPC (João Barbosa)
ccbf7ae74 test: Wallet methods are disabled when no wallet is loaded (João Barbosa)
4940a20a4 test: Add functional tests for unloadwallet RPC (João Barbosa)
6608c369b rpc: Add unloadwallet RPC (João Barbosa)
537efe19e rpc: Extract GetWalletNameFromJSONRPCRequest from GetWalletForJSONRPCRequest (João Barbosa)

Pull request description:

  This patch adds wallet unload feature via RPC. It also adds UI support for unloaded wallets.

Tree-SHA512: 7c7f9f32f7a2266d2df574aa6b95f993c3dc82736f93304562122beb8756fb28cd22d03866b48f493c747441f22d30e196b098dec435cc25e035633f090351ea
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
dustinface
a3fa940b4d
test: Use reset_probe_timeouts and drop its sync_all call (#4063)
* test: Make use of reset_probe_timeouts in feature_llmq_simplepose.py

* test: Drop sync_all in reset_probe_timeouts

Seems like that not required here
2021-03-29 14:04:35 -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
df0bf93cb7
llmq|rpc|test: Fix previous active set checks in RPC commands (#4048)
* llmq: Introduce signOffset in CSigningManager::VerifyRecoveredSig

* rpc|test: Fix `signHeight + dkgInterval` check in verifyislock

* rpc|test: Fix `signHeight + dkgInterval` check in `quorum verify`

* test: Test `signHeight + dkgInterval` checks

In `quorum verify` and `verifyislock` RPC commands
2021-03-25 12:30:00 -04:00
UdjinM6
6bcc1bf0a3
backport bitcoin#13190: Have gArgs handle printing help 2021-03-19 18:00:24 +03:00
dustinface
fecdbefe5b
test: Make some tests executable (#4044) 2021-03-17 19:43:54 -04: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
dustinface
4feb38b6ab
llmq|init|test: Add "mode" to -llmq-qvvec-sync parameter (#4030)
* llmq|init|test: Add "mode" to -llmq-qvvec-sync parameter

This changes the paramter from `-llmq-qvvec-sync=<quorum_name>` to `-llmq-qvvec-sync=<quorum_name:mode>`

With the following definitions:

- `quorum_name`: Internal name of the quorum type
- `mode=0` - Sync always from all quorums of the type defined by `quorum_name`
- `mode=1` - Sync only if member of any from all other quorum of the type defined by `quorum_name`

`-llmq-qvvec-sync=llmq_100_67:0` To always request qvvec's from all `LLMQ_100_67`.
`-llmq-qvvec-sync=llmq_100_67:1` Only request if type member.

This means, if platform enables this on all MNs with `mode=0` we will
have all nodes asking new quorum for their verification vector instead
of only `24*100` at max.

* llmq: Adjust GetQuorumRecoveryStartOffset to use all MNs

* Turn `QvvecSyncMode` into `enum class`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-16 18:50:41 -04:00
UdjinM6
95e8492f31
llmq: Implement Intra-Quorum Relay connections for qrecsig-s (#4020)
* llmq: Implement Intra-Quorum Relay connections for qrecsig-s

Avoid relaying recsigs to non-masternodes.

* test: Simplify loop

* test: Assert connections are equal to llmq_size instead of static number

* test: Drop redundant brackets

* test: Fix typo

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-03-14 22:49:38 -04:00
PastaPastaPasta
6da3d5cad7
instantsend: Implement Spork 2 Mempool Signing signalling (#4024)
* instantsend: refactor input locking into it's own method

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

* instantsend: introduce spork 24 `SPORK_24_INSTANTSEND_SIGNING_ENABLED`

This spork tells masternodes to refuse to lock transactions in mempool. Only transactions included in a block should be retroactively signed.

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

add spork defenition

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

* instantsend: refactor `sed -i 's/allowReSigning/fRetroactive/g' src/llmq/*`

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

* instantsend: adjust comments

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

* instantsend/tests: implement Spork 24 support in tests, and test it's usage

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

* fix feature_llmq_is_retroactive.py

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

* drop Spork 24 and use Spork 2 value 1 as being no mempool signing

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

* fix spork check

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

* Fix tests

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Change comment

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* IsInstantSendSigningEnabled -> IsInstantSendMempoolSigningEnabled

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-03-08 22:51:39 +03: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
f5e74c8a10
instantsend: Mark blocks as conflicting when there is a CL vs IS conflict (#3987)
* instantsend: Mark a block with IS-locks which conflict with txes in a CL-ed block as conflicting and not as invalid

* tests: Tweak feature_llmq_is_cl_conflicts.py to test CL overriding a block with conflicting IS-locks
2021-02-14 16:09:21 -06:00
UdjinM6
67145ccb57
Merge pull request #3977 from PastaPastaPasta/backports-0.17-pr26
Backports 0.17 pr26
2021-02-08 18:34:45 +03:00
UdjinM6
f22d5e2aaa
tests: Apply --timeoutscale option to rpc timeouts (#3982) 2021-02-08 14:39:05 +01:00
UdjinM6
e029f24c1c Fix some circular dependencies, update EXPECTED_CIRCULAR_DEPENDENCIES to make linter happy 2021-02-04 14:58:20 -06:00
MarcoFalke
e6bbb2f2b3 Merge #13924: tests: Simplify comparison in rpc_blockchain.py
1f87c372b5 Simplify comparison in rpc_blockchain.py. (Daniel Kraft)

Pull request description:

  The test for `gettxoutsetinfo` in `rpc_blockchain.py` verifies that the result is the same as before after invalidating and reconsidering a block.  The comparison has to exclude the `disk_size` field, though, as it is not deterministic.

  Instead of comparing all the other fields for equality, this change explicitly removes the `disk_size` field and then compares the full objects.  This makes the intent more explicit (compare everything except for `disk_size`, not compare just a given list of fields) and also the code simpler.

Tree-SHA512: 3c376a8836b62988fb2f0117c9ca65de64a33bf3cd4980a123de30bf5e7b7a48eda477b25e03d672ff076e205c698e83432469156caa0f0f3ebbb0480f0dd77d
2021-02-04 14:58:13 -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
UdjinM6
4c1a04a254
llmq: Avoid writing commitments to evodb and altering caches when all we want is to check block candidate validity (#3980)
* llmq: Avoid writing commitments to evodb and altering caches when all we want is to check block candidate validity

* tests: call `getblocktemplate` to trigger `CreateNewBlock` before quorum commitment is mined
2021-02-03 22:01:26 -05:00
dustinface
bbf8eac53f
test: Wait for recovered sig in rpc_verifyislock.py (#3975)
Should fix failures like https://gitlab.com/dashpay/dash/-/jobs/997361410.

Looks like the reason for the failures is queuing recovered sigs here for processing 2493d851a7/src/llmq/quorums_instantsend.cpp (L876).
2021-02-03 11:09:08 -05:00
UdjinM6
2493d851a7
tests: fix feature_pruning.py (#3967)
* tests: postpone dip3 and dip8 activation in feature_pruning.py

* tests: Mine one block before restart to avoid automatic recovery from forks
2021-02-01 11:17:29 -05:00
UdjinM6
7188004905
Fix two issues with ResetBlockFailureFlags, add tests (#3965)
* Merge #13199: Bugfix: ensure consistency of m_failed_blocks after reconsiderblock

11fa6bb66e Bugfix: ensure consistency of m_failed_blocks after reconsiderblock (Suhas Daftuar)

Pull request description:

  This was introduced in 015a5258ad and could cause a node to crash (due to assertion failure) when using the `reconsiderblock` rpc.

Tree-SHA512: 820dcd761bf983e36f5d0f16777ed75c833daaf62a6b3a4dbd17f6caaf9287223e3a202d06540ac62f8ba72926b73b0873bb76c6273ddcb19d9408f4c1cd325e

* bugfix: Mark all nearest BLOCK_FAILED_CHILD descendants (if any) as BLOCK_FAILED_VALID while removing the invalidity flag from all ancestors in ResetBlockFailureFlags

Fixes `Assertion failed: ((pindex->nStatus & BLOCK_FAILED_MASK) == 0), function CheckBlockIndex`

* tests: Make sure ResetBlockFailureFlags does the job correctly

* Wait for the expected block height, check the final chain tip hash

Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2021-02-01 11:15:46 -05:00
dustinface
d6c6174958
llmq|init|test: Implement DKG data recovery / quorum verification vector sync (#3964)
* llmq: Implement automated DKG recovery threads

* llmq: Implement quorum verification vector sync

* init: Validiate quorum data recovery related command line parameter

* test: Add quorum_data_request_timeout_seconds in DashTestFramework

* test: Test quorum data recovery in feature_llmq_data_recovery.py

* test: Add feature_llmq_data_recovery.py to BASE_SCRIPTS

* test: Fix quorum_data_request_expiration_timeout in wait_for_quorum_data

* test: Always test the existence of secretKeyShare in test_mn_quorum_data

With this change it also validates that "secretKeyShare" is not in `quorum_info` if its not expected to be in there. Before this was basically just not tested.

* llmq|test: Use bool as argument type for -llmq-data-recovery

* llmq: Always set nTimeLastSuccess to 0

* test: Set -llmq-data-recovery=0 in p2p_quorum_data.py

* test: Simplify test_mns

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

* refactor: pass CQuorumCPtr to StartQuorumDataRecoveryThread

* test: Fix thread name in comment

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-02-01 17:10:19 +01:00
dustinface
21cfb4c934
llmq|rpc|test|version: Implement P2P messages QGETDATA <-> QDATA (#3953)
* version: Bump PROTOCOL_VERSION and MIN_MASTERNODE_PROTO_VERSION

* version: Introduce LLMQ_DATA_MESSAGES_VERSION for QGETDATA/QDATA support

* test: Bump MY_VERSION to 70219 (LLMQ_DATA_MESSAGES_VERSION)

* llmq: Introduce CQuorumDataRequest as wrapper for QGETDATA requests

* llmq: Implement CQuorum::{SetVerificationVector, SetSecretKeyShare}

* llmq|net|protocol: Implement QGETDATA/QDATA P2P messages

* llmq: Restrict processing QGETDATA/QDATA to masternodes only

* llmq: Implement request limiting for QGETDATA/QDATA

* llmq: Implement CQuorumManger::RequestQuorumData

* rpc: Implement "quorum getdata" as wrapper around QGETDATA

Allows to trigger sending QGETDATA messages to connected peers by RPC.

* test: Handle QGETDATA/QDATA messages in mininode

* test: Add data structures to support QGETDATA/QDATA

* test: Add some helper in test_framework.py

* test: Implement tests for QGETDATA/QDATA in p2p_quorum_data.py

* test: Add p2p_quorum_data.py to BASE_SCRIPTS

* llmq|test: Add QWATCH support for QGETDATA/QDATA

* llmq: Store CQuorumPtr in cache, not CQuorumCPtr

* llmq: Fix cache usage after recent changes

* Use uacomment to create/find specific p2ps

* No need to use network adjusted time here, GetTime should be enough

* rpc: check proTxHash

* minor tweaks

* test: Adjustments after 4e27d6513e

* llmq: Rename and improve error lambda in CQuorumManager::ProcessMessage

* llmq: Process QDATA if -watchquorums is enabled

* test: Handle qwatch messages in mininode

* test: Add test for -watchquorums support

* test: Just some empty lines

* test: Properly stop the p2p network thread at the end of the test

* rpc: Adjust "quorum getdata" parameter descriptions

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* rpc: Fix optionality of proTxHash in "quorum getdata" command

* test: Test optionality of proTxHash for "quorum getdata" command

* test: Be more specific about imports in p2p_quorum_data.py

* llmq|rpc: Add some comments about the request.GetDataMask checks

* test: Some more empty lines

* rpc: One more parameter description

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* test: Unify assert statements / drop parentheses for all of them

* fix typo

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

* adjust some line wrapping to 80 chars

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

* tests: Seperate out into dif atomic methods, add logging

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

* test: Avoid restarting masternodes, just let available requests expire

Just takes a lot time and isn't required imo.

* test: Drop redundant code/tests after separation

This was introduced in 9e224ec2f2

* test: Merge three tests

"test_mnauth_restriction", "test_invalid_messages" and "test_invalid_unexpected_qdata" with the resulting name "test_basics" because i don't feel like DKG recovery thing should be part of a test called "test_invalid_messages" and giving it an own test probably wouldn't make a lot sense because it would still depend on "test_invalid_messages". I also think there is no need for a separated "test_invalid_unexpected_qdata".

* test: Rename test_ratelimiting_banscore -> test_request_limit

* test: Apply python style

* test: Wrap all at 120 characters

Thats the default "draw annoying warnings" setting for PyCharm (and IMO a reasonable line length).

* test: Move some variables

* test: Optimize for speed

* tests: use wait_until in get_mininode_id

* test: Don't use `!=` to check for `None`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
2021-01-28 17:33:18 -05:00
UdjinM6
783f07e9f7
tests: Add uacomment in P2PConnection and use it to create (correct network specific) strSubVer (#3969) 2021-01-25 19:35:17 +01:00
UdjinM6
48bf736525
wallet: Upgrade path for non-HD wallets to HD (#3933)
* Check mnemonic passphrase size in SetMnemonic instead of CreateWalletFromFile

* Move processing of cmd-line options and recovery via hdseed out of GenerateNewHDChain

* Implement GenerateNewHDChainEncrypted and tweak EncryptHDChain to be able to generate new encrypted HD chains in an already encrypted wallet

* rpc: Implement upgradetohd rpc

* Address review comments

* tweak rpc response

* tests: Test various non-HD to HD wallet upgrade paths

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Fix suggestions

* tests: Check upgradetohd return value

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-24 22:03:33 -05:00
dustinface
ce3bcab3ab
rpc|test: Introduce "mnauth" RPC command to override masternode authentications (#3930)
* rpc: Introduce "mnauth" RPC command to fake masternode authentications

* test: Test "mnauth" RPC command

* test: Add rpc_mnauth.py to BASE_SCRIPTS

* Update src/rpc/misc.cpp

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

* Update test/functional/rpc_mnauth.py

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-01-24 21:50:16 -05:00
Kolby Moroz Liebl
e197f976e1
backport bitcoin#16509 and add devnet test (#3946)
* Merge #16509: test: Adapt test framework for chains other than "regtest"

faf36838bdba7393960fce6ad0c56dc1f93f5870 test: Avoid hardcoding the chain name in combine_logs (MarcoFalke)
fa8a1d7ba30040f8c74f93fc41a61276c255a6a6 test: Adapt test framework for chains other than "regtest" (MarcoFalke)
68f546635d5de2ccfedadeabc7bc79e12e5eca6a test: Fix “local variable 'e' is assigned to but never used” (Ben Woosley)

Pull request description:

  This is required for various work in progress:

  * testchains #8994
  * signet #16411
  * some of my locally written tests

  While it will be unused in the master branch as of now, it will make all of those pull requests shorter. Thus review for non-regtest tests can focus on the actual changes and not some test framework changes.

ACKs for top commit:
  jonatack:
    ACK faf36838bdba7393960fce6ad0c56dc1f93f5870, ran tests and reviewed the code.

Tree-SHA512: 35add66c12cab68f2fac8f7c7d47c604d3f24eae9336ff78f83e2c92b3dc08a25e7f4217199bac5393dd3fb72f945bba9c001d6fbb8efd298c88858075fcb3d6

* Add devnet support for tests

* test: make sure devnet can connect to each other and start

* Partial merge bitcoin/bitcoin#16681: Tests: Use self.chain instead of 'regtest' in almost all current tests, revert one TODO while at it

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Co-authored-by: Jorge Timón <jtimon@jtimon.cc>
2021-01-22 09:58:07 -05:00
UdjinM6
62c38282d8
blockchain: Implement auto-recovery from hardforks (#3926)
* Implement auto-recovery from hardforks

This should help users who fail to update their nodes/wallets in time when there is a hardfork.

* tests: tweak feature_llmq_chainlocks.py to check new behaviour

* tests: tidy up feature_llmq_chainlocks.py a bit
2021-01-21 11:18:25 -05: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
482ba4f5ae
Always mark conflicting blocks with BLOCK_CONFLICT_CHAINLOCK flag (#3924)
* More accurate handling of the BLOCK_CONFLICT_CHAINLOCK flag

* Update test/functional/feature_llmq_chainlocks.py

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

* tests: make sure that previous tip on the reorged node is marked conflicting after chainlock

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-16 14:47:13 -05:00
dustinface
4a6eee2511
test: Check for the actual llmq_test session, not just for any (#3934) 2021-01-15 21:59:42 -05:00
dustinface
59991bec25
test/refactor: Fix typo, remove_mastermode -> remove_masternode (#3931) 2021-01-14 14:00:57 -06:00
dustinface
cc8a1bc19c
llmq|rpc|test: Add optional "submit" parameter to "quorum sign" (#3917)
* llmq: Split CSigShare creation/processing in CSigSharesManager

* rpc: Add "submit" parameter to "quorum sign"

* test: Add CSigShare and msg_qsigshare to messages.py

* test: Test the optional "submit" parameter of "quorum sign"
2021-01-14 20:53:26 +01:00
dustinface
a3a391dd32
rpc|test: Improve platform restrictions, add new commands to the whitelist (#3918)
* rpc: Rename platformAllowedCommands => mapPlatformRestrictions

* rpc: Use std::multimap instead of std::map for mapPlatformRestrictions

* rpc|init: Move restrictions to CRPCTable and initialize them in seperate

This is to allow restrictions based on the currently active network.

* rpc: Allow multiple parameter of type UniValue for mapPlatformRestrictions

* rpc: Add "quorum {sign,verify}" to the platform-user whitelist

* test: Add "quorum {sign, verify}" tests, test some invalid combinations

* rpc|test: Add verifyislock to platform-user whitelist
2021-01-14 13:39:34 -06:00
tomthoros
4ce3635d99
Consensus: DIP-0020: Dash opcode updates. Remaining dip0020 opcodes (#3893)
* DIP-0020: Dash opcode updates - enable AND, OR, XOR

* DIP-0020: Dash opcode updates - enable DIV, MOD

* DIP-0020: Dash opcode updates - enable BIN2NUM, NUM2BIN

* DIP-0020: Dash opcode updates - enable CHECKDATASIG, CHECKDATASIGVERIFY (no tests)

* DIP-0020: Dash opcode updates - fix whitespace

* DIP-0020: Dash opcode updates - add checkdatasig and datacheckdatasigverify json tests

* More AND_OR_XOR tests

* DIP-0020: Dash opcode updates - move opcodes enabled tests around. Add unit tests back

* DIP-0020: Dash opcode updates - sort BITCOIN_TESTS aplhabetically

* DIP-0020: Dash opcode updates - formatting

* DIP-0020: Dash opcode updates - formatting

* DIP-0020: Dash opcode updates - formatting references alignment

* DIP-0020: Dash opcode updates - formatting references alignment

* Update src/script/interpreter.h

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/script/interpreter.h

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/test/script_tests.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-13 14:45:04 -06:00
dustinface
0f62d55af6
llmq|rpc|test: Fix "quorumHash" parameter of "quorum sign" (#3914)
* llmq: Add an optional quorum hash to CSigningManager::AsyncSignIfMember

Allows to select the quorum to sign by its hash.

* rpc: Fix quorum selection of "quorum sign"

* test: Test the optional "quorumHash" parameter of "quorum sign"

* llmq: Move quorum checks up to avoid calling WriteVoteForId if they fail
2021-01-11 11:17:41 -06:00
UdjinM6
f3e8401da5
rpc: Introduce verifyislock (#3906)
* Introduce `verifyislock` rpc

* Update test/functional/rpc_verifyislock.py

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-01-11 11:13:50 -06: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
UdjinM6
074318a9ba
rpc: Introduce quorum verify (#3904)
* rpc: Introduce `quorum verify`

* test: Test both "quorum not found" paths

* rpc: Check both "quorum not found" failures in one place

* rpc: Adjust description of "quorum verify"

* auto -> int

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-10 21:21:16 -06:00
UdjinM6
7b3bac65eb
tests: fix random feature_dip4_coinbasemerkleroots.py failures (#3916) 2021-01-08 13:56:32 -06:00
UdjinM6
51027eed43
tests: Test all rpc commands in rpc_platform_filter.py (#3913)
* tests: Test all rpc commands in rpc_platform_filter.py

* bugfix: test "debug 1" instead of "stop" to avoid interference with the regular test shutdown process

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-08 13:43:59 -06:00
PastaPastaPasta
9aaa23072c
Merge pull request #3886 from xdustinface/backport-11536
backport: Deprecate accounts
2020-12-30 13:38:17 -06:00
UdjinM6
687aece098
Harden DIP0008 activation (#3889)
* Harden DIP0008 activation

* Update src/llmq/quorums_instantsend.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update test/functional/test_framework/test_framework.py

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-28 12:21:01 +01:00
thephez
4f077caf3b
rpc: remove duplicated type field from gobject list-prepared (#3881)
* rpc: remove duplicated type field from gobject list-prepared

* Remove one more "type"
2020-12-23 17:27:07 -06:00
UdjinM6
3e65238a74
rpc: masternode winners results should also include operator addresses (#3862)
* rpc: `masternode winners` results should also include operator addresses

* Add tests

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-12-23 17:24:06 -06:00
Wladimir J. van der Laan
96d306324f Merge #14441: [wallet] Backport(0.17): Restore ability to list incoming transactions by label
89306ab0df93bfdf5630910bc20b1eccb7379172 [wallet] Restore ability to list incoming transactions by label (Russell Yanofsky)

Pull request description:

  Backport of PR #14411 to v0.17.

  This change partially reverts #13075 and #14023.

  Fixes #14382

Tree-SHA512: 1f8300e1a79e826cd706561265b8788deef505fa510be1a76ed9a62e5fca37cf6a741423ac0e5de2a36d6e8b9f25f141885455aacacbbf6474814e6eae406a27
2020-12-22 17:58:12 +01:00
Pieter Wuille
341b5a9714 Merge #13566: Fix get balance
702ae1e21a [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts. (John Newbery)
cf15761f6d [wallet] GetBalance can take a min_depth argument. (John Newbery)
0f3d6e9ab7 [wallet] factor out GetAvailableWatchOnlyBalance() (John Newbery)
7110c830f8 [wallet] deduplicate GetAvailableCredit logic (John Newbery)
ef7bc8893c [wallet] Factor out GetWatchOnlyBalance() (John Newbery)
4279da4785 [wallet] GetBalance can take an isminefilter filter. (John Newbery)

Pull request description:

  #12953 inadvertently removed the functionality to call `getbalance "*" <int> <bool>` to get the wallet's balance with either minconfs or include_watchonly.

  This restores that functionality (when `-deprecatedrpc=accounts`), and also makes it possible to call ``getbalance minconf=<int> include_watchonly=<bool>` when accounts are not being used.

Tree-SHA512: 67e84de9291ed6d34b23c626f4dc5988ba0ae6c99708d02b87dd3aaad3f4b6baa6202a66cc2dadd30dd993a39de8036ee920fcaa8cbb1c5dfe606e6fac183344
2020-12-22 17:58:12 +01:00
Pieter Wuille
b84b7da8c3 Merge #13498: [wallet] Fixups from account API deprecation
df10f07db1 [wallet] Don't use accounts when checking balance in sendmany (John Newbery)
e209184101 [wallet] deprecate sendfrom RPC method. (John Newbery)

Pull request description:

  A couple of fixups from the accounts API deprecation PR (#12953):

  - properly deprecate `sendfrom`
  - don't use accounts when calculating balance in `sendmany` (unless the `-deprecatedrpc=accounts` flag is being used)

Tree-SHA512: 1befde055067438c4c3391bbff1aaed0e6249efd708c567db3f1faad40a0f28e64f95e5bad0679ae826d24a0239e4bc8a1c392dc93e2e7502343a7f6b1d1845c
2020-12-22 17:58:12 +01:00
MarcoFalke
856c18c861 Merge #13130: [tests] Fix race in rpc_deprecated.py
a95bf6422a [tests] Fix race in rpc_deprecated.py (John Newbery)

Pull request description:

  Fixes a block generation race introduced in 3576ab1261.

Tree-SHA512: 044d7cff5087d0e5e950fa80d20dec6427416697820e8748bc30f4d4e6f7ff0753a44eed398432f8c33ed79948a42fb65f9f5926aa6fbd14224e8bf6b12a54ed
2020-12-22 17:58:11 +01:00
Wladimir J. van der Laan
8e52b33d3e Merge bitcoin#13060: [wallet] [rpc] Remove getlabeladdress RPC
67e0e04140b3dfac12d628cee391d40b5fac5cfa [wallet] [docs] Update release notes for removing `getlabeladdress` (John Newbery)
81608178cff793ee205a4f70481c76d34c5448a4 [wallet] [rpc] Remove getlabeladdress RPC (John Newbery)

Pull request description:

  labels are associated with addresses (rather than addresses being
  associated with labels, as was the case with accounts). The
  getlabeladdress does not make sense in this model, so remove it.

  getaccountaddress is still supported for one release as the accounts
  API is deprecated.

Tree-SHA512: 7f45d0456248ebcc4e54dd34e2578a09a8ea8e4fceda75238ccea9d731dc99a3f3c0519b18a9739de17d2e6e59c9c2259ba67c9ae2e3cb2a40ddb14b9193fe29
2020-12-22 17:58:11 +01:00
MarcoFalke
42a98b0bc8 Merge bitcoin#13075: [tests] Remove 'account' API from wallet functional tests
5d536619ab [tests] Remove 'account' API from wallet functional tests (John Newbery)

Pull request description:

  Next step in #12952. Removes all usage of the 'account' API from the wallet functional tests, except:

  - rpc_deprecated.py (which specifically tests the `-deprecatedrpc=accounts` command line argument is working properly).
  - `wallet_labels.py` (which tests that both the 'label' and 'account' APIs work in V0.17).

  'account' API usage for both of those tests can be removed once V0.17 has been branched.

  Also excluded is:

  - `wallet_importprunedfunds.py` (which fails due to a bitcoind OOM error)

Tree-SHA512: 6701b32f83d2d47597ba093ded665d7aa630f7a9c759ff15e3e33a3e3bc7600e8d29cf4e72aed5f8f9f6769cc9b614c681951720eab1ed2473f5f8dec57e7a6f
2020-12-22 17:58:11 +01:00
Wladimir J. van der Laan
95cfaeea17 Merge bitcoin#12953: Deprecate accounts
cead28b [docs] Add release notes for deprecated 'account' API (John Newbery)
72c9575 [wallet] [tests] Add tests for accounts/labels APIs (John Newbery)
109e05d [wallet] [rpc] Deprecate wallet 'account' API (John Newbery)
3576ab1 [wallet] [rpc] Deprecate account RPC methods (John Newbery)
3db1ba0 [tests] Set -deprecatedrpc=accounts in tests (John Newbery)
4e671f0 [tests] Rename rpc_listtransactions.py to wallet_listtransactions.py (John Newbery)
a28b907 [wallet] [rpc] Remove duplicate entries in rpcwallet.cpp's CRPCCommand table (John Newbery)

Pull request description:

  Deprecate all accounts functionality and make it only accessible by using `-deprecatedrpc=accounts`.

  Accounts specific RPCs, account arguments, and account related results all require the `-deprecatedrpc=accunts` startup option now in order to see account things.

  Several wallet functional tests use the accounts system. Those tests are unchanged, except to start the nodes with `-deprecatedrpc=accounts`. We can slowly migrate those tests to use the 'label' API instead of the 'account' API before accounts are fully removed.

Tree-SHA512: 89f4ae2fe6de4a1422f1817b0997ae22d63ab5a1a558362ce923a3871f3e42963405d6573c69c27f1764679cdee5b51bf52202cc407f1361bfd8066d652f3f37
2020-12-22 17:53:03 +01:00
Wladimir J. van der Laan
5de3ab5d6a Merge bitcoin#12892 - [wallet] [rpc] introduce 'label' API for wallet
Add label API to wallet RPC.

This is one step towards #3816 ("Remove bolt-on account system") although it doesn't
actually remove anything yet.

These initially mirror the account functions, with the following differences:

- These functions aren't DEPRECATED in the help
- Help mentions 'label' instead of accounts. In the language used, labels are
  associated with addresses, instead of addresses associated with labels. (unlike
  with accounts.)
- Labels have no balance
  - No balances in `listlabels`
  - `listlabels` has no minconf or watchonly argument
- Like in the GUI, labels can be set on any address, not just receiving addreses
- Unlike accounts, labels can be deleted.
  Being unable to delete them is a common annoyance (see #1231).
  Currently only by reassigning all addresses using `setlabel`, but an explicit
  call `deletelabel` which assigns all address to the default label may make
  sense.

Thanks to Pierre Rochard for test fixes.
2020-12-22 17:53:03 +01:00
Russell Yanofsky
1914effbbb Merge bitcoin#11536: Rename account to label where appropriate
d2527bd Rename wallet_accounts.py test (Russell Yanofsky)
045eeb8 Rename account to label where appropriate (Russell Yanofsky)

Pull request description:

  Rename account to label where appropriate

  This change only updates strings and adds RPC aliases, but should simplify the implementation of address labels in #7729, by getting renaming out of the way and letting that change focus on semantics.

  The difference between accounts and labels is that labels apply only to addresses, while accounts apply to both addresses and transactions (transactions have "from" and "to" accounts). The code associating accounts with transactions is clumsy and unreliable so we would like get rid of it.

  ---

  There is a rebased version of #7729 atop this PR at https://github.com/ryanofsky/bitcoin/commits/pr/label, see #7729 (comment).

Tree-SHA512: b3f934e612922d6290f50137f8ba71ddfaea4485713c7d97e89400a8b73b09b254f9186dffa462c77f5847721f5af9852b5572ade5443d8ee95dd150b3edb7ff
2020-12-22 17:53:03 +01:00
PastaPastaPasta
1c8f475a7f
Merge pull request #3882 from PastaPastaPasta/backports-0.17-pr25
Backports 0.17 pr25
2020-12-19 00:35:31 -06:00
UdjinM6
71c49d743d
Redo "Drop redundant CPartialMerkleTree and CMerkleBlock" correctly
But this time keep our versions and add missing parts instead
2020-12-18 12:55:45 -06:00
xdustinface
724e8aed19
More of bitcoin#13645 in interface_zmq_dash.py 2020-12-18 12:55:45 -06:00
xdustinface
a53aabdb5e
test: Fix test data in bitcoin-util-test.json 2020-12-18 12:55:45 -06:00
Wladimir J. van der Laan
e6089da994
Merge #13823: qa: quote path in authproxy for external multiwallets
fa67505e1ea007bdc081bc7425fb83d5455d8308 qa: Quote wallet name for rpc path (MarcoFalke)

Pull request description:

  When using external multiwallets they are specified by their full path which might contain non-ascii characters (e.g. umlauts or emojis).

  Fix this by url-quoting the path.

Tree-SHA512: 7cc66514579d9f602f88a6817c5ab43a44c6d3711df452dc904173f0bc34e2c0b2c34877497f06b61f6720c532fa183053f54622dc454e316c89cee7eaa72463
2020-12-18 12:55:45 -06:00
pasta
8fa51dce7d
attempt to fix test failure
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-18 12:55:45 -06:00
Wladimir J. van der Laan
44c7301288
Merge #13603: bitcoin-tx: Stricter check for valid integers
57889e688dd0987a1e087cd48d216a413127601e bitcoin-tx: Stricter check for valid integers (Daniel Kraft)

Pull request description:

  Just calling `atoi` to convert strings to integers does not check for valid integers very thoroughly; in particular, it just ignores everything starting from the first non-numeral character.  Even a string like "foo" is fine and silently returns 0.

  This meant that `bitcoin-tx` would not fail if such a string was passed in various places where an integer is expected (like the `locktime` or an input/output index); this means that it would, for instance, silently accept a typo and interpret it in an unexpected way.

  In this change, we use `ParseInt64` for parsing strings to integers, which actually verifies that the full string is valid as number.  New tests in the `bitcoin-util-test` cover the new error paths.

  This fixes #13599.

Tree-SHA512: 146a0af275e9f57784e5d0582d3defbac35551b54b6b7232f8a0b20db04aa611125e52aa4512ef2f8ed2cafc2a12fe586f9d10ed66d641cff090288f279b1988
2020-12-18 12:55:45 -06:00
MarcoFalke
0a255fec40
Merge #13645: [tests] skip rpc_zmq functional test as necessary
a0b604c166 [tests] skip rpc_zmq functional test when python3 zmq lib is not present (James O'Beirne)

Pull request description:

  As noted in https://github.com/bitcoin/bitcoin/pull/13570/files#r201715904, the `rpc_zmq` functional test should be skipped when the `zmq` python3 package is not installed. This is breaking https://bitcoinperf.com benchmarks at the moment.

Tree-SHA512: ab519ae717f4b7a282640cf0389651723fdc108990aeb9852e8b9e96d61fa1ded2461717ae31558b37ff8401a5b1ccc41f4e858e402b8c3d98563d962599767a
2020-12-18 12:55:45 -06:00
Wladimir J. van der Laan
0da4f596bb
Merge #13452: rpc: have verifytxoutproof check the number of txns in proof structure
d280617bf569f84457eaea546541dc74c67cd1e4 [qa] Add a test for merkle proof malleation (Suhas Daftuar)
ed82f1700006830b6fe34572b66245c1487ccd29 have verifytxoutproof check the number of txns in proof structure (Gregory Sanders)

Pull request description:

  Recent publication of a weakness in Bitcoin's merkle tree construction demonstrates many SPV applications vulnerable to an expensive to pull off yet still plausible attack: https://bitslog.wordpress.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/

  This change would at least allow `verifytxoutproof` to properly validate that the proof matches a known block, with known number of transactions any time after the full block is processed. This should neuter the attack entirely.

  The negative is that a header-only processed block/future syncing mode would cause this to fail until the node has imported the data required.

  related: #13451

  `importprunedfunds` needs this check as well. Can expand it to cover this if people like the idea.

Tree-SHA512: 0682ec2b622a38b29f3f635323e0a8b6fc071e8a6fd134c954579926ee7b516e642966bafa667016744ce49c16e19b24dbc8801f982a36ad0a6a4aff6d93f82b
2020-12-18 12:55:45 -06:00
Wladimir J. van der Laan
be4345ce12
Merge #13510: Scripts and tools: Obsolete #!/bin/bash shebang
000000035b20402dea3e8168165cd4eefdc97539 Obsolete #!/bin/bash shebang (DesWurstes)

Pull request description:

  > `#!/bin/bash` assumes it is always installed to `/bin/` which can cause issues
  > `#!/usr/bin/env bash` searches the user's `PATH` to find the `bash` binary

  Details: https://github.com/dylanaraps/pure-bash-bible#obsolete-syntax

  I'm open to comments: Should I also fix `#!/bin/sh`?

Tree-SHA512: b47bb4828116aa119f1899c68fee081270d51a898535490b9c616bf0f3660ad953f29c361eafc759bc64cdd54ee6eeecb2d79e9fdb5291a996a515c719805476
2020-12-18 12:55:45 -06:00
dustinface
122078b9ec
backport: bitcoin#10583 - [RPC] Split part of validateaddress into getaddressinfo (#3880)
* [rpc] split wallet and non-wallet parts of DescribeAddressVisitor

* [rpc] Move DescribeAddressVisitor to rpc/util

* Create getaddressinfo RPC and deprecate parts of validateaddress

Moves the parts of validateaddress which require the wallet into getaddressinfo
which is part of the wallet RPCs. Mark those parts of validateaddress which
require the wallet as deprecated.

Validateaddress will  call getaddressinfo
for the data that both share for right now.

Moves IsMine functions to libbitcoin_common and then links libbitcoin_wallet
before libbitcoin_common in order to prevent linker errors since IsMine is no
longer used in libbitcoin_server.

* scripted-diff: validateaddress to getaddressinfo in tests

Change all instances of validateaddress to getaddressinfo since it seems that
no test actually uses validateaddress for actually validating addresses.

-BEGIN VERIFY SCRIPT-
find ./test/functional -path '*py' -not -path ./test/functional/wallet_disable.py -not -path ./test/functional/rpc_deprecated.py -not -path ./test/functional/wallet_address_types.py -exec sed -i'' -e 's/validateaddress/getaddressinfo/g' {} \;
-END VERIFY SCRIPT-

* wallet: Add missing description of "hdchainid"

* Update src/wallet/rpcwallet.cpp

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

Co-authored-by: John Newbery <john@johnnewbery.com>
Co-authored-by: Andrew Chow <achow101-github@achow101.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-17 13:46:20 +01:00
UdjinM6
50d893a575 More of 12076 2020-12-16 10:15:23 -06:00
UdjinM6
41b65728ff More of 12747: fix typos 2020-12-16 10:14:58 -06:00
MarcoFalke
ea33d327a8
Merge #13512: [qa] mininode: Expose connection state through is_connected
fa1eac9cdb [qa] mininode: Expose connection state through is_connected (MarcoFalke)

Pull request description:

  This gets rid of some non-type safe string comparisons and access to members that are implementation details of `class P2PConnection(asyncore.dispatcher)`. Such refactoring is required to replace the deprecated asyncore with something more sane.

  Changes:
  * Get rid of non-enum member `state` and replace is with bool `connected`
  * Get rid of confusing argument `pushbuf` and literally just push to the buffer at the call site

Tree-SHA512: 09074c7e5ed251a2e0509ef205ab82f89887c1e1fa1cc6efc1db60d196eb2403788a4987df8809fd06d80ef652e614c5d3c3fdef70096fc5815102243388288d
2020-12-15 23:28:08 -06:00
Jonas Schnelli
858a64f23d
Merge #13058: [wallet] createwallet RPC - create new wallet at runtime
f7e153e95 [wallets] [docs] Add release notes for createwallet RPC. (John Newbery)
32167e830 [wallet] [tests] Add tests for `createwallet` RPC. (John Newbery)
942131774 [wallet] [rpc] Add `createwallet` RPC (John Newbery)

Pull request description:

  Adds a `createwallet` RPC to dynamically create a new wallet at runtime.

  Includes tests and release notes.

Tree-SHA512: e0d89e3ae498234e9db5b827c56804cbab64f18a1875e2b5e676172c110278ea1b9e93a8a61b8dd80e2f2a691490bf229e923e4ccb284a1d3e420b8317815866
2020-12-15 23:18:55 -06:00
MarcoFalke
1d13370973
Merge #12849: Tests: Add logging in loops in p2p_sendhears.py
8dd547d82b Adding logging for loop iteration level in p2p_sendheaders.py (ccdle12)

Pull request description:

  PR for #12453

  New contributor looking at mainly the 'good first issues'.

  From my understanding of the issue:
   * Track the iteration level of loop when test fails in Travis CI

  Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated.

Tree-SHA512: 228524aad54c09979d990a0fc6818e13a11e1ab5e78b606b892e897bba7b1e09bf25447feb631049e45ac017eeb61fbf1c1f11e8bd5103648f976a05099ba9f9
2020-12-15 22:30:55 -06:00
Wladimir J. van der Laan
6d46698979
Merge #12076: qa: Use node.datadir instead of tmpdir in test framework
c8330d4 qa: Use node.datadir instead of tmpdir in test framework (MarcoFalke)

Pull request description:

  Commit c53c9831ee introduced the utility function `get_datadir_path`, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir.

  This commit replaces datadir path creation with the `datadir` member of `TestNode`, which itself uses `get_datadir_path`.

Tree-SHA512: c75707ab7149d732a6d56152a5813138a33459d3d07577b60b89f2a207c83b7663fac5f203593677c9892d1c23a5eba4bd45c5c4ababf040d720b437240fcddf
2020-12-15 22:06:42 -06:00
MarcoFalke
32e61f1257
Merge #12746: tests: Remove unused argument max_invalid from check_estimates(...)
a004eb1dae tests: Remove unused argument max_invalid from check_estimates(...) (practicalswift)

Pull request description:

  Remove unused argument `max_invalid` from `check_estimates(...)`.

  _Note to reviewers:_ Let me know if `check_estimates(...)` is incomplete and should be fixed instead.

Tree-SHA512: 93d250184f63baa18212d13960e35ce31ebec574dbbb1af8c40f8f3aa92264b4d03878cb33b7e4e6341e0ef28fa4c1c61ad78e8f3eb0ebd78b8ced45964f362a
2020-12-15 21:44:23 -06:00
MarcoFalke
4f77eff89c
Merge #12252: Require all tests to follow naming convention
125f4a4909 [tests] Require all tests to follow naming convention (Anthony Towns)

Pull request description:

  Based on top of #11774

Tree-SHA512: 1eb156b5a97b30c203b7b0ad3d2055b391ef825e2e57805c7745b5259a9b1caaa115768ec225452f12f354e550f83e071f9c6fee2c36698b4679191895aab8de
2020-12-15 20:21:00 -06:00
Wladimir J. van der Laan
2564c17330
Merge #12567: util: Print timestamp strings in logs using ISO 8601 formatting
a7324bd79 Format timestamps using ISO 8601 formatting (e.g. "2018-02-28T12:34:56Z") (practicalswift)

Pull request description:

  Print timestamp strings in logs using [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatting (e.g. `2018-02-28T12:34:56Z`):
  * `Z` is the zone designator for the zero [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) offset.
  * `T` is the delimiter used to separate date and time.

  This makes it clear for the end-user that the date/time logged is specified in UTC and not in the local time zone.

  Before this patch:

  ```
  2018-02-28 12:34:56 New outbound peer connected: version: 70015, blocks=1286123, peer=0
  ```

  After this patch:

  ```
  2018-02-28T12:34:56Z New outbound peer connected: version: 70015, blocks=1286123, peer=0
  ```

Tree-SHA512: 52b53c3d3d11ddf4af521a3b5f90a79f6e6539ee5955ec56a5aa2c6a5cf29cecf166d8cb43277c62553c3325a31bcea83691acbb4e86429c523f8aff8d7b210a
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 20:16:10 -06:00
Wladimir J. van der Laan
666f6459cf
Merge #12240: [rpc] Introduced a new fees structure that aggregates all sub-field fee types denominated in BTC
7de1de7 Add new fee structure with all sub-fields denominated in BTC (mryandao)

Pull request description:

  the denomination for `fee` is current in btc while the other such as `decendentFee` and `ancestorFee` are in satoshis.

Tree-SHA512: e428f6dca1d339f89ab73e38ce5903f5465c46b159069d9bcc3f8b1140fe6657fa49a11abe0088e9f7ba9999f64af72a349a4735bf5eaa61b8e4a185b23543f3
2020-12-15 20:16:10 -06:00
PastaPastaPasta
1c6236dcbe
Merge pull request #3870 from PastaPastaPasta/backports-0.17-pr23
Backports 0.17 pr23
2020-12-15 19:05:58 -06:00
pasta
063f7655d0
signrawtransactionwithwallet in feature_dip0020_activation.py
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 17:00:05 -06:00
MarcoFalke
3cfe3f6db1
Merge #12720: qa: Avoiding 'file' function name from python2
0dbb32b2cb Avoiding 'file' function name from python2 with more descriptive variable naming (Jeff Rade)

Pull request description:

  @jnewbery Here is PR from review in [#12437](https://github.com/bitcoin/bitcoin/pull/12437)

Tree-SHA512: c61980f4d3170842627cd970e1f6eebaf303843dc5e95a9dcfe3ded08152be533774cb75f56a83af8452b6bcac17c0172cf20e39edf9acefb4a4c255fe893a3b
2020-12-15 17:00:05 -06:00
UdjinM6
db5d906765
tests: Rework feature_new_quorum_type_activation.py using -vbparams (#3873) 2020-12-15 14:45:14 -06:00
Wladimir J. van der Laan
c7a5be4d6b
Merge #12643: [qa] util: Remove unused sync_chain
fa1436c42 [qa] util: Remove unused sync_chain (MarcoFalke)

Pull request description:

  The util function `sync_blocks` already checks for equal chains, so we can remove the unused `sync_chain`.

  Also cleaned up the errors that are printed in case of timeout:

  ```
  AssertionError: Block sync timed out:
    '72a3a3e9dcfd0a09204c3447af0f481d19641eeadbe6a91b8e680ed614bc7712'
    '5032af4ae22ae7a21afdc9d9f516877309c4dd8ef2ecadb9354be7088439b4a6'
    '5032af4ae22ae7a21afdc9d9f516877309c4dd8ef2ecadb9354be7088439b4a6'
  ```
  and
  ```
  AssertionError: Mempool sync timed out:
    {'c2af943d9b321c36e0f5a153a9d3d8b11bdd46ceb28e38f5fd2c722e3edb3563'}
    set()
    set()
  ```

Tree-SHA512: cb4ad30e3e3773072f59afa2c81cfa27bd8f389a93f02acb919990298627fcfbaa53a3d3944d827cc8a5d009871e42a47ea09e9bb93e85c22e3af6a24a574e5d
2020-12-15 11:06:27 -06:00
pasta
185e4b128c
Merge #12443: qa: Move common args to bitcoin.conf
face722 qa: Move common args to bitcoin.conf (MarcoFalke)

Pull request description:

  Beside removing duplicates of the same args in the code, this actually helps with debugging after a test failure.

  For example, `bitcoin-qt` has `server` turned off, so you'd have to turn it on every time, if you wanted to debug a temporary test datadir created by the test framework.
  Also, `keypool` would fill up if you forget to specify `-keypool=1`.

Tree-SHA512: 996bec8738dc0fce7297ab1fc5b4fbe3aa31b9b6241f8c4e685db728925363ccaca6145ad1edc6bee2f360e02ac4b9a53fcdff74eb79de90793393742d52b559
2020-12-15 11:06:26 -06:00
pasta
2bda82bdbe
Fix #10579
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:06:25 -06:00
Pieter Wuille
a2f107424b
Merge #10579: [RPC] Split signrawtransaction into wallet and non-wallet RPC command
d60234885b Add test for signrawtransaction (Andrew Chow)
eefff65a4b scripted-diff: change signrawtransaction to signrawtransactionwithwallet in tests (Andrew Chow)
1e79c055cd Split signrawtransaction into wallet and non-wallet (Andrew Chow)

Pull request description:

  This PR is part of #10570. It also builds on top of #10571.

  This PR splits `signrawtransaction` into two commands, `signrawtransactionwithkey` and `signrawtransactionwithwallet`. `signrawtransactionwithkey` requires private keys to be passed in and does not use the wallet for any signing. `signrawtransactionwithwallet` uses the wallet to sign a raw transaction and does not have any parameters to take private keys.

  The `signrawtransaction` RPC has been marked as deprecated and will call the appropriate RPC command based upon the parameters given. A test was added to check this behavior is still consistent with the original behavior.

  All tests that used `signrawtransaction` have been updated to use one of the two new RPCs. Most uses were changed to `signrawtransactionwithwallet`. These were changed via a scripted diff.

Tree-SHA512: d0adf5b4cd7077639c504ec07bee262a3b94658d34db0a5c86a263b6393f7aa62f45129eafe29a7c861aa58440dd19348ee0c8b685e8a62d6f4adae8ec8f8cb3
2020-12-15 11:06:25 -06:00
pasta
335303ad26
Fix #12436
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:06:24 -06:00
Wladimir J. van der Laan
6f37eab266
Merge #12436: [rpc] Adds a functional test to validate the transaction version number in the RPC output
09b30db Asserts that the tx version number is a signed 32-bit integer. (251)

Pull request description:

  This PR attempts to resolve #11561 by addressing the feedback from @MarcoFalke; and @gmaxwell in #12430.

  Commit 30e9d24 adds a functional test to `rpc_rawtransaction.py` to assert that the transaction version number in the RPC output is a signed 32-bit integer.

  The functional test uses the raw transaction data from Mainnet transaction `c659729a7fea5071361c2c1a68551ca2bf77679b27086cc415adeeb03852e369`.

Tree-SHA512: d78f3120b9aa04537561ab5584769a838b25e162c5caa6e1543256fb27538aa4c708c939fb5ba93ccb3fa676c2d92ce8eb9cc78869f80ac96be64a7bec7bebd0
2020-12-15 11:06:19 -06:00
UdjinM6
b559a8f904
Backporting Statoshi and bitcoin#16728 (#2515)
* Backport Statoshi

This backports some of https://github.com/jlopp/statoshi.

Missing stuff: README.md and client name changes, segwit and fee estimation stats.

Fix RejectCodeToString

Fix copy-paste mistake s/InvalidBlockFound/InvalidChainFound/

* Merge #16728: move-only: move coins statistics utils out of RPC

8a3b2eb17572ca2131778d52cc25ec359470a90f move-only: move coins statistics utils out of RPC (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal

  ---

  In the short-term, this move-only commit will help with fuzzing (https://github.com/bitcoin/bitcoin/pull/15606#issuecomment-524482297). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots.

  Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it.

ACKs for top commit:
  MarcoFalke:
    ACK 8a3b2eb17572ca2131778d52cc25ec359470a90f, checked --color-moved=dimmed-zebra

Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74

* Fix 16728

* Modernize StatsdClient

- Reuse some functionality from netbase
- Switch from GetRand to FastRandomContext
- Drop `using namespace std` and add `// namespace statsd`

* Introduce PeriodicStats and make StatsdClient configurable via -stats<smth> (enabled/host/port/ns/period)

* Move/rename tip stats from CheckBlock to ConnectBlock

* Add new false positives to lint-format-strings.py

* Add snprintf in statsd_client to the list of known violations in lint-locale-dependence.sh

* Fix incorrect include guard

* Use bracket syntax includes

* Replace magic numbers with defaults

* Move connection stats calculation into its own function

And bail out early if stats are disabled

* assert in PeriodicStats

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-15 10:22:23 -06:00
UdjinM6
0a8664fd33
rpc: Add masternode payments (#3863)
* rpc: Implement `masternode payments`

Returns an array of deterministic masternodes and their payments for a specific block

* tests: Add rpc_masternode.py

* Apply review suggestions

* Add amounts calculated per masternode and per block

* Tweak help string

* Update src/rpc/masternode.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* rpc: Check against vector size instead of decrementing a counter

* rpc: Use `std::vector::begin()` instead of `std::begin(std::vector)`

* Drop set_dash_dip8_activation in rpc_masternode.py

* Apply suggestions from code review

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-14 20:15:09 -06:00
UdjinM6
b95cf017c3
tests: Enable InstantSend and ChainLocks by default (#3853)
* tests: Enable ChainLocks by default

* tests: Enable InstantSend (including filtering) by default
2020-12-12 00:57:39 -06:00
tomthoros
5a026be52c
Consensus: DIP-0020: Dash opcode updates - OP_CAT and OP_SPLIT. (#3824)
* DIP-0020: Dash opcode updates - enable OP_CAT and OP_SPLIT (renamed from OP_SUBSTR)

* DIP-0020: Dash opcode updates - DEPLOYMENT_V17 activates dip0020 opcodes

* Add/tweak MAX_SCRIPT_ELEMENT_SIZE tests for OP_CAT and OP_SPLIT

* Check nDefaultMaxNumSize in OP_SPLIT tests

* Purify DISABLED_OPCODE tests for OP_CAT and OP_SPLIT, fix DoTest to actually preserve the DIP0020 flag

* Fix `warning: '&' within '|' [-Wbitwise-op-parentheses]`

* Rework/simplify feature_dip0020_activation.py

* DIP-0020: Remove functionally redundant tests.

* Fix file permissions for feature_dip0020_activation.py

* DIP-0020: fix typo

* Update src/test/script_tests.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update test/functional/feature_dip0020_activation.py

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* DIP-0020: improve comments

* DIP-0020: dont use negative booleans

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-12-11 22:17:10 +00:00
UdjinM6
cf64339517
consenus: Implement LLMQ_100_67 quorums (#3844)
* Add LLMQ_100_67 quorums

* Re-use DEPLOYMENT_V17 bit to activate LLMQ_100_67 quorums

* Add LLMQ_TEST_NEW quorum and test its activation

* Tweak mine_quorum to work correctly with multiple quorum types

And to avoid a potentialy endless "while" loop

* llmq: Rename IsQuorumTypeEnabledAtBlock -> IsQuorumTypeEnabled

* chainparams|test: Rename llmq_test_new -> llmq_test_v17

* chainparams|consensus|llmq: Rename LLMQ_TEST_NEW -> LLMQ_TEST_V17

* Tweak few strings and the name of the test

* llmq: Make GetEnabledQuorumTypes return a vector of LLMQTypes, introduce GetLLMQParams

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

* Tweak minSize

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* Exclude LLMQ_100_67 from Concentrated Recovery

* Update test/functional/feature_new_quorum_type_activation.py

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: pasta <pasta@dashboost.org>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-10 00:08:05 +01:00
UdjinM6
88d54054f9
zmq: Send islock notifications for txes received after their islocks were received (#3852)
* Send islock notifications for txes received after their islocks were received

Also drop UpdateWalletTransaction - its name makes no sense and it's only used once.

* tests: early islocks should trigger notifications once a corresponding tx is received

* Tweak tests

- fail if an unexpected islock is received
- drop unused variable

* llmq: Drop `c_str()` in two log statements

* test: Move create_islock to DashTestFramework in test_framework.py

Just because it's used the same way in two files

* test: Simplify send tx in zmq test

* format

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2020-12-09 19:52:11 +00:00
UdjinM6
adee9504a6
tests: Fix a couple of rare mnsync issues (#3847)
* tests: Bump mocktime in smaller intervals while (not) signaling

This is needed to avoid triggering `CMasternodeSync::Reset()`.

* tests: force faucet node to finish mnsync in prepare_datadirs

* test: Drop redundant force_finish_mnsync in interface_zmq_dash.py

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2020-12-05 23:39:38 +00:00
UdjinM6
18c4ad1468
tests: Tweak sporks.py to work with any defaults (#3842) 2020-12-01 17:48:35 +00:00
dustinface
3a02c6d74c
rpc|governance|test: Store prepared governance objects and implement "gobject list-prepared" (#3811)
* governance: Add CGovernanceObject::ToJson()

* rpc: Save governance objects before tx commit in gobject_prepare

* rpc: Add "gobject list-prepared"

* test: Implement tests for "gobject list-prepared"

* test: Add "feature_governance_objects.py" to BASE_SCRIPTS in test_runner

* rpc: Rename parameter: limit => count

* rpc: Rephrase "Maximal" => "Maximum"

* rpc|test: Set default count of "gobject list-prepared" to 10

* rpc: Align behaviour/message or count parameter with existing commands

* rpc|test: Reverse order of "gobject list-prepared" output
2020-12-01 03:55:29 +00:00
PastaPastaPasta
a70ea0cafd
tests: adjust some comments in interface_zmq_dash.py (#3839)
Signed-off-by: pasta <pasta@dashboost.org>
2020-11-30 17:01:31 +00:00
UdjinM6
46eddc8e03
tests: Make sure txes are actually included in blocks we mine in feature_llmq_is_retroactive.py (#3833) 2020-11-28 19:19:59 +00:00
UdjinM6
02d083616d
tests: Few trivial tweaks/cleanups (#3834)
* Convert comments into log output in feature_llmq_dkgerrors.py

* Remove llmq folder in wallet_backup.py

* There is no `-blockmaxweight` option in Dash
2020-11-28 19:18:01 +00:00
UdjinM6
071ec6c4fc
tests: Let mine_quorum handle expected connections count based on spork21 state (#3832) 2020-11-28 19:16:31 +00:00
UdjinM6
b2cc7a8c96
rpc: Add submit option to protx register(_fund) RPC commands (#3830)
Setting `submit` to `false` will force these RPCs to return raw tx hex instead of sending it to the network.
2020-11-28 19:14:29 +00:00
dustinface
90f7d7ff2a
test: Implement tests for all dash related ZMQ notifications (#3804)
* test: Add more C++ representing classes in message.py

* test: Add interface_zmq_dash.py

* test: Add interface_zmq_dash.py to BASE_SCRIPTS in test_runner.py

* test: Adjust hashrecoveredsig parsing

* Force node0 to finish syncing

* Avoid `uint256_to_string(uint256_from_str())`

* Be more specific in imports

* Plural for "publisher" when makes sense

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-11-27 17:55:28 +03:00
PastaPastaPasta
e72164e719
rpc: implement whitelist for commands needed by Dash Platform (#3738)
* implement whitelist for commands needed by Dash Platform

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

* Add test for platform command filtering

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

* Use less if statements

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

* make defaultPlatformUser const

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

* test: Make rpc_platform_filter.py executable

* test: Refactor tests in rpc_platform_filter.py

* minor modifications to rpc_platform_filter.py

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

* test: Expand test cases in rpc_platform_filter.py

* rpc: Use std::map instead of std::vector for platformAllowedCommands

* rpc: Improve readability and be more specific about the reject reason

* rpc: Fix comment

* rpc|httprpc: Rename RPC_PROTECTED_COMMAND to RPC_PLATFORM_RESTRICTION

* minor modifications to server.cpp

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

* add help text

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2020-11-24 02:39:50 +01:00
UdjinM6
ac6878ffa2
tests: Fix feature_llmq_simplepose.py and feature_llmq_signing.py (#3781)
* tests: Use lower mocktime bump value to reset masternode probes in feature_llmq_simplepose.py

Bumping `50 * 60 + 1` should be enough, see https://github.com/dashpay/dash/blob/master/src/llmq/quorums_utils.cpp#L218-L222. Bumping `60 * 60 + 1` interferes with mnsync reset, see https://github.com/dashpay/dash/blob/master/src/masternode/masternode-sync.cpp#L112-L119.

* Fix expected connection count in llmq-signing.py and llmq-simplepose.py

* Sleep a couple of seconds to let mn sync tick to happen

* Move helper functions out of run_test

* Let helper functions return expect_contribution_to_fail

* No need to check for "punished" state in test_banning

* Split mninfos in test_banning and mine_quorum into "online" and "valid" sets

Needed for wait_for_masternode_probes in mine_quorum. Also, refactor and fix test_banning while at it.
2020-11-19 14:42:35 +03:00
dustinface
e7c91558d3
test: Add and use uint256_to_string + improve some hash/string conversions (#3800)
* test: Introduce uint256_to_string

* test: Use uint256_to_string in some places

* Avoid converting back and forth, reuse known string represntations of hashes for blocks and txes instead of converting sha256

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-11-17 20:40:15 +01:00
MarcoFalke
16a4608347
Merge #13082: Tests: don't test against min relay fee information in mining_prioritisetransaction.py
bd9d67b752 Don't test against min relay fee information in mining_prioritisetransaction.py (Kristaps Kaupe)

Pull request description:

  Follow-up on #13032.

  As advised by @MarcoFalke.

Tree-SHA512: a690ff2e6499b0b4ee6a952c849e363738b9a5ae553266e1780fc7910a6b01e240d71b434fe87da53dc43f6e26cec23a900ec16aab64bb8f6765c26d7aa37c56
2020-11-17 14:34:34 -05:00
Wladimir J. van der Laan
1f9bf1c7cc
Merge #13032: Output values for "min relay fee not met" error
1accfbc Output values for "min relay fee not met" error (Kristaps Kaupe)

Pull request description:

  It is already done this way for "mempool min fee not met" error.

Tree-SHA512: 829db78ecc066cf93b8e93ff1aeb4e7b98883cf45f341d5be6e6b4dff4135f3f54fa49b3a6f12eb43f676a9ba54f981143c9887f786881e584370434a9566cfd
2020-11-17 14:34:34 -05:00
Wladimir J. van der Laan
90038da3d9
Merge #13022: [qa] Attach node index to test_node AssertionError and print messages
80a5e59 [qa] Attach node index to test_node AssertionError and print messages (James O'Beirne)

Pull request description:

  In the midst of fighting with https://github.com/bitcoin/bitcoin/pull/12873 it became apparent that there're a number of assertions and print statements which are emitted by test nodes but don't identify the node in question. This change makes debugging a bit easier by adding identifying information to non-logger test_node-related error messages.

Tree-SHA512: 7cc86f2c81f4b3fdba15ec9a2d21a84c4b083629e845e82288087c3affbbdc5c68e74067621856cc97fe84fbc8cb4f5ca4977a51ef381e5d74515df8eb001239

fix 13022

Signed-off-by: pasta <pasta@dashboost.org>
2020-11-17 14:34:34 -05:00
Wladimir J. van der Laan
ca0cdbfbe8
Merge #13030: [bugfix] [wallet] Fix zapwallettxes/multiwallet interaction.
1f83839 [wallet] [tests] Test disallowed multiwallet params (John Newbery)
3476e3c [wallet] Fix zapwallettxes/multiwallet interaction. (John Newbery)

Pull request description:

  `-zapwallettxes` should be disallowed when starting bitcoin in multiwallet mode.

  There's code in `WalletInit::ParameterInteraction()` to disallow `-zapwallettxes` when running in multiwallet mode. This code functioned as expected when passing the parameter `-zapwallettxes=1`, but not when passing the parameter `-zapwallettxes` (ie without the value specified). Fix that and add a test.

  The new test in the
  _[wallet] [tests] Test disallowed multiwallet params_ commit reproduces the bug and should fail against master.

  Fixes #12505

Tree-SHA512: 6cd921717e9c7d2773ca84c946c310c2adec8430e37cbecdb33a620f510db3058a72bd328411812ba415111bc52a3367b332c9d15a37a92ccfd7ae785d2f32ab
2020-11-17 14:32:37 -05:00
MarcoFalke
2161985a63
Merge #12947: Wallet hd functional test speedup and clarification
6cba60ace2 speed up wallet_hd.py and clarify/augment checks (Gregory Sanders)

Pull request description:

  With `keypool=0` I see no reason to do 300 addresses and sends.

  (with --enable-debug)

  Before patch:
  real	1m10.412s
  user	0m49.772s
  sys	0m3.988s

  After:
  real	0m11.566s
  user	0m3.344s
  sys	0m4.648s

  Also added check, since I failed to understand that on startup the wallet already knows about funds by rescanning blocks newer than oldest key birthdate.

Tree-SHA512: cf90f7fe6a437b8b7b1f0707464b9c06085233167826f1a12c3871684664d4d572e13f03e13a718e4537cac39713271c4ac3d9b983e10080b50647caf3cbe82d
2020-11-09 17:46:33 -05:00
dustinface
bd4a2edb03
test: Fix default value of COutPoint.n to match C++ (#3802) 2020-11-10 00:59:01 +03:00
dustinface
748d91dd7a
test: Add and use DashTestFramework.get_recovered_sig (#3801)
* test: Introduce DashTestFramework.get_recovered_sig

* test: Use DashTestFramework.get_recovered_sig
2020-11-10 00:58:49 +03:00
MarcoFalke
f9dce09f6c
Merge #12918: test: Assert on correct variable
bf08fc5b6b test: Assert on correct variable (Karl-Johan Alm)

Pull request description:

Tree-SHA512: bdc4a0f94d49ab29234ee429585c6c73e46ff096c46d6053eb15c0a84cdea5490425cd842d051d41e158450945b229239b08002c193fdcc212eb2ca0e63aa653
2020-11-01 01:57:59 -04:00
UdjinM6
f5bbf20879
Allow partial match for expected strings in feature_*index.py` tests 2020-10-26 20:35:28 -04:00
UdjinM6
aafa64d021
Fix feature_txindex.py 2020-10-26 20:35:28 -04:00
pasta
a901879764
additional changes for assert_start_raises_init_error
Signed-off-by: pasta <pasta@dashboost.org>
2020-10-26 20:35:28 -04:00
pasta
641a666ef1
fix linter
Signed-off-by: pasta <pasta@dashboost.org>
2020-10-26 20:35:28 -04:00
MarcoFalke
7de10e4737
Merge #12284: Remove assigned but never used local variables. Enable Travis checking for unused local variables.
ea04bf7862 Enable flake8 warning F841 ("local variable 'foo' is assigned to but never used") (practicalswift)
169f3e8637 Remove assigned but never used local variables (practicalswift)

Pull request description:

  Remove assigned but never used local variables. Enable Travis checking for unused local variables.

Tree-SHA512: d6052ec9044c5d1f03d874ea3c8addd5a156779213ef9200f89d3ae53230f2fd1691aff405c3dae14178e5ef09912c4432e92f606ef4a5220ed9daa140cdee81
2020-10-26 20:35:28 -04:00
MarcoFalke
04b375a95d
Merge #12810: [Tests] Fix a typo at assert_start_raises_init_error() and use specific exception for initialization error
8394300859 [Tests] fix a typo in TestNode.assert_start_raises_init_error() (Roman Zeyde)

Pull request description:

  `self.wait_util_stopped()` should be `self.wait_until_stopped()`.

  Also, use a specific Exception subclass for indicating node failure to start (instead of using `AssetionError` and an `except Exception` clause).

  Following https://travis-ci.org/bitcoin/bitcoin/jobs/359066226#L2726 and depending on #12806 (which fixes the root cause of the Travis test failure).

Tree-SHA512: 7bd5a95586a412472ef9dffdb086789d7275ddaf862724e21cebb3418d0c97e6d89b4d1a58375e42114060d028403d6eab89e3a1e9a833ffe8dadf3439ab1fe2
2020-10-26 20:35:28 -04:00
pasta
4e17167c2d
fix 12718
Signed-off-by: pasta <pasta@dashboost.org>
2020-10-22 11:36:39 -04:00
Wladimir J. van der Laan
7a880f29df
Merge #12718: [Tests] Require exact match in assert_start_raises_init_eror (jnewbery)
fae1374 qa: Allow for partial_match when checking init error (MarcoFalke)
5812273 [Tests] Require exact match in assert_start_raises_init_eror() (John Newbery)
0ec08a6 [Tests] Move assert_start_raises_init_error method to TestNode (John Newbery)

Pull request description:

  Extracted from #12379, because the changes are important on their own.

  This allows for exact testing, since the match can be specified with a strict regex. Internal details (such as exact formatting of the error message) can still be fuzzed away by regex wildcards.

Tree-SHA512: 605d2c9c42362a32d42321b066637577a026d0bb8cfc1c9f5737a4ca6503ffe85457a5122cea6e1101053ccc6c8aa1bbae3602e1fa7d2988bf7d5c275f412f66
Signed-off-by: pasta <pasta@dashboost.org>
2020-10-22 11:36:39 -04:00
PastaPastaPasta
e6986733d8
drop unused import
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-10-14 13:27:35 -04:00
pasta
150f5eb412
fix feature_blocksdir.py test
Signed-off-by: pasta <pasta@dashboost.org>
2020-10-14 13:27:34 -04:00
Wladimir J. van der Laan
79639195ee
Merge #12811: test: Make summary row bold-red if any test failed and show failed tests at end of table
ffb033a test: List any failed tests at the end of test_runner output (Anthony Towns)
f92541f test: Make summary row bold-red if any test failed (Wladimir J. van der Laan)

Pull request description:

  Make the summary row of the test runner bold red if *any* test fails. This helps visibility if something fails.
  (yesteryday I had a snafu where I missed that `feature_blocksdir.py` had failed because it's one of the earlier tests in the list, this intends to avoid that in the future)

  Before:
  ![testfailold](https://user-images.githubusercontent.com/126646/38021100-3fbaf1c6-327c-11e8-8bae-d3ba46e77408.png)

  After:
  ![testfailnew](https://user-images.githubusercontent.com/126646/38021108-43ac7ef8-327c-11e8-8566-e52bcbaf89b8.png)

  If tests pass it still looks the same:

  ![testok](https://user-images.githubusercontent.com/126646/38021115-4a8e9954-327c-11e8-8fe4-34e889384d3e.png)

Tree-SHA512: 057748c693ca1c80840e4e4cdea8aa1baf8996f03d6805975d8e3c07c4ba0087cd8fa83f891d6bf1af0bfbba88b5d46bd5d852df340d755202bd32ae6f1034b5
2020-10-14 13:27:32 -04:00
Wladimir J. van der Laan
365d698d44
Merge #12806: qa: Fix function names in feature_blocksdir
d71bedb qa: Fix function names in feature_blocksdir (MarcoFalke)

Pull request description:

  This fixes the test failure on master:

  ```
  AttributeError: 'BlocksdirTest' object has no attribute 'assert_start_raises_init_error'
  ```

Tree-SHA512: d96a9b707a9b4fb8752b15f28dae02c60c25cbec21dca5f3ee62e2717c6a49951533c24b52ed0d6e99c5a964ef2c3e90fdc58a9104122714ae9874e121955df6
2020-10-14 13:27:32 -04:00