Commit graph

14215 commits

Author SHA1 Message Date
practicalswift fdef8bbf2f tests: Allow for using non-default fuzzing initialization 2019-10-23 11:10:10 +00:00
Wladimir J. van der Laan c34b88620d
Merge #17095: util: Filter control characters out of log messages
d7820a1250 util: Filter control characters out of log messages (Wladimir J. van der Laan)

Pull request description:

  Belts and suspenders: make sure outgoing log messages don't contain potentially suspicious characters, such as terminal control codes.

  This escapes control characters except newline ('\n') in C syntax. It escapes instead of removes them to still allow for troubleshooting issues where they accidentally end up in strings (it is a debug log, after all).

  (more checks could be added such as UTF-8 validity and unicode code-point range checking—this is substantially more involved and would need to keep track of state between characters and even `LogPrint` calls as they could end up split up—but escape codes seem to be the most common attack vector for terminals.)

ACKs for top commit:
  practicalswift:
    ACK d7820a1250 - tested and works as expected :)

Tree-SHA512: 0806265addebdcec1062a6def3e903555e62ba5e93967ce9ee6943d16462a222b3f41135a5bff0a76966ae9e7ed75f211d7785bceda788ae0b0654bf3fd891bf
2019-10-16 16:04:27 +02:00
Wladimir J. van der Laan 5a3dd93594
Merge #17131: rpc: fix -rpcclienttimeout 0 option
b3b26e149c rpc: fix -rpcclienttimeout 0 option (Fabian Jahr)

Pull request description:

  fixes #17117

  I understood the bug as the help string being wrong, rather than that this feature is missing and should be added. Let me know if it should be the other way around.

  It is notable that if 0 is given as an argument, the fallback that is being used is the libevent default of 50 seconds, rather than `DEFAULT_HTTP_CLIENT_TIMEOUT` (900 seconds). This is not intuitive for the user. I could handle this in this PR but I am unsure which would be the better solution then: Actually adding the feature as described in the help string or falling back to `DEFAULT_HTTP_CLIENT_TIMEOUT`? Happy to hear opinions.

ACKs for top commit:
  MarcoFalke:
    unsigned ACK b3b26e149c

Tree-SHA512: 65e526a652c0adcdb4f895e8d78d60c7caa5904c9915b165a3ae95725c87d13af1f916359f80302452a2fcac1a80f4c58cd805ec8c28720fa4b91b3c8baa4155
2019-10-16 16:00:49 +02:00
practicalswift 58d67f1cc0 tests: Add fuzzing harness for descriptor Span-parsing helpers 2019-10-15 22:47:08 +00:00
fanquake eb292af309
Merge #17105: gui: Make RPCConsole::TabTypes an enum class
8019b6b150 gui: Make RPCConsole::TabTypes an enum class (João Barbosa)

Pull request description:

  This change makes the compiler emit a warning/error if a missing enum value is not handled. See also #17134.

ACKs for top commit:
  MarcoFalke:
    unsigned ACK 8019b6b150
  hebasto:
    re-ACK 8019b6b150
  fanquake:
    ACK 8019b6b150

Tree-SHA512: 329161097f4d079f48d5fb33bf3a07e314fbb2ac325cafb08bafa9e76229ecff0f9010fe3c1c15ccd02d4539b5c93839c846b42bfeaffa897a917cea599bf811
2019-10-15 15:53:22 -04:00
MarcoFalke a3af5b5c13
Merge #17138: Remove wallet access to some node arguments
b96ed03962 [wallet] Remove pruning check for -rescan option (John Newbery)
eea462de9c [wallet] Remove package limit config access from wallet (John Newbery)

Pull request description:

  Removes wallet access to `-limitancestorcount`, `-limitdescendantcount` and `-prune`:

  - `-limitancestorcount` and `-limitdescendantcount` are now accessed with a method `getPackageLimits` in the `Chain` interface.
  - `-prune` is not required. It was only used in wallet component initiation to prevent running `-rescan` when pruning was enabled. This check is not required.

  Partially addresses #17137.

ACKs for top commit:
  MarcoFalke:
    Tested ACK b96ed03962
  ryanofsky:
    Code review ACK b96ed03962
  promag:
    Code review ACK b96ed03962.
  ariard:
    ACK b96ed03, check there isn't left anymore wallet access to node arguments.

Tree-SHA512: 90c8e3e083acbd37724f1bccf63dab642cf9ae95cc5e684872a67443ae048b4fdbf57b52ea47c5a1da6489fd277278fe2d9bbe95e17f3d4965a1a0fbdeb815bf
2019-10-15 14:59:43 -04:00
MarcoFalke e180be49d7
Merge #17098: refactor: Feebumper EstimateFeeRate follow-up
66b29848c7 change wallet pointers to references in feebumper (Adam Jonas)
9be6666a4e typo and unneccessary parentheses (Adam Jonas)

Pull request description:

  Picking up some of the suggestions in the comments of #16727 including:
  https://github.com/bitcoin/bitcoin/pull/16727#discussion_r330547321
  https://github.com/bitcoin/bitcoin/pull/16727#discussion_r330549766
  https://github.com/bitcoin/bitcoin/pull/16727#discussion_r333209674

ACKs for top commit:
  promag:
    Code review ACK 66b29848c7.
  MarcoFalke:
    ACK 66b29848c7 (looked at the diff on GitHub)
  fjahr:
    ACK 66b2984 reviewed code

Tree-SHA512: d118f7689970fe39d9f5318dc818f13283cce9194370b3ce4758f298172e4681ae119ddc809f5c0b7602677137ac0d38147b915422ff616531a76a570b766fa2
2019-10-15 14:32:03 -04:00
fanquake 137b7a2af1
Merge #17125: gui: Add toolTip and placeholderText to sign message fields
610d9384de gui: Added label & tooltip for Verify Message labels (dannmat)

Pull request description:

  When using the Verify Message functionality, I found the input boxes to be rather confusing as they had no guidance for their purpose.

  I have added tooltips and labels to aid users when verifying messages in future

ACKs for top commit:
  promag:
    Code review ACK 610d9384de. Nit, commit and title are a little weird. Suggestion: "gui: Add toolTip and placeholderText to sign message fields"
  MarcoFalke:
    ACK 610d9384de (looks good, didn't compile or tested the changes)
  fanquake:
    ACK - 610d9384de

Tree-SHA512: d6a1bc872ad270dce440e96a163ce72cdd4708913d87a0fea749fc8cf2d8163b791cbb96a82030e0cb7d239920ceb0e3f05e0eec113f45a1a8e1309fbd92b4b0
2019-10-15 12:03:12 -04:00
Fabian Jahr b3b26e149c rpc: fix -rpcclienttimeout 0 option 2019-10-15 18:01:59 +02:00
dannmat 610d9384de gui: Added label & tooltip for Verify Message labels 2019-10-15 15:59:23 +01:00
João Barbosa 8019b6b150 gui: Make RPCConsole::TabTypes an enum class 2019-10-15 13:46:34 +01:00
Daki Carnhof d48f664440 tests: Fix fs_tests for unknown locales
Fix by removing "L" as suggested by meeDamian in
https://github.com/bitcoin/bitcoin/issues/14948#issuecomment-522355441

Co-Authored-By: bugs@meedamian.com
2019-10-15 09:21:41 +00:00
Wladimir J. van der Laan d7820a1250 util: Filter control characters out of log messages
Belts and suspenders: make sure outgoing log messages don't contain
potentially suspicious characters, such as terminal control codes.

This escapes control characters except newline ('\n') in C syntax.
It escapes instead of removes them to still allow for troubleshooting
issues where they accidentally end up in strings.
2019-10-15 10:53:17 +02:00
fanquake dcc640811c
Merge #17134: doc: Add switch on enum example to developer notes
c8961c7d9f doc: Add switch on enum example (Hennadii Stepanov)
11e3d5eb1d util: Add AllowShortCaseLabelsOnASingleLine option (Hennadii Stepanov)

Pull request description:

  This PR documents a recurring issue:
  - #15938
  - #17105

ACKs for top commit:
  laanwj:
    Seems like good advice to me. ACK c8961c7d9f
  practicalswift:
    ACK c8961c7d9f
  promag:
    ACK c8961c7d9f, no excuse now, thanks!

Tree-SHA512: 530da5117094ed1bfaa6e447089521bd2c86b0742758dbacec4e4f934dc07b0e24f15a1448c4d58e49905e8fd3797d87bcae5669a346d33ed4c2878a04891699
2019-10-14 18:33:26 -04:00
John Newbery b96ed03962 [wallet] Remove pruning check for -rescan option
Prior to this PR, the wallet would not allow the `-rescan` option at
startup if pruning was enabled. This is unnecessarily restrictive. It
should be possible to rescan if pruning is enabled, as long as no blocks
have actually been pruned yet.

Remove the pruning check from WalletInit::ParameterInteraction(). If any
blocks have been pruned, that will be caught in CreateWalletFromFile().
2019-10-14 13:39:25 -04:00
John Newbery eea462de9c [wallet] Remove package limit config access from wallet
The wallet should not be able to directly access global configuration
from the node. Remove access of "-limitancestorcount" and
"-limitdescendantcount".
2019-10-14 13:32:41 -04:00
MarcoFalke 556820ee57
Merge #17009: tests: Add EvalScript(...) fuzzing harness
7e50abcc29 tests: Add EvalScript(...) fuzzing harness (practicalswift)
bebb637472 tests: Add FuzzedDataProvider fuzzing helper from the Chromium project (practicalswift)

Pull request description:

  Add `EvalScript(...)` fuzzing harness.

  To test this PR:

  We can run `contrib/devtools/test_fuzzing_harnesses.sh` (#17000) during five seconds to quickly verify that the newly added  fuzz harness seem to hit relevant code regions, that the fuzzing throughput seems reasonable, etc.

  `test_fuzzing_harnesses.sh eval 5` runs all fuzzers matching the regexp `eval` giving them five seconds of runtime each.

  ```
  $ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined
  $ make
  $ contrib/devtools/test_fuzzing_harnesses.sh eval 5
  Testing fuzzer eval_script during 5 second(s)
  A subset of reached functions:
          NEW_FUNC[1/24]: 0x557b808742e0 in prevector<28u, unsigned char, unsigned int, int>::indirect_ptr(int) src/./prevector.h:161
          NEW_FUNC[2/24]: 0x557b80875460 in prevector<28u, unsigned char, unsigned int, int>::indirect_ptr(int) const src/./prevector.h:162
          NEW_FUNC[6/9]: 0x557b81acdaa0 in popstack(std::vector<std::vector<unsigned char, std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > >&) src/script/interpreter.cpp:57
          NEW_FUNC[5/16]: 0x557b809f1bf0 in CScriptNum::serialize(long const&) src/./script/script.h:326
          NEW_FUNC[4/6]: 0x557b817c93d0 in CScriptNum::CScriptNum(std::vector<unsigned char, std::allocator<unsigned char> > const&, bool, unsigned long) src/./script/script.h:225
          NEW_FUNC[5/6]: 0x557b817cbb80 in CScriptNum::set_vch(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/./script/script.h:360
          NEW_FUNC[0/11]: 0x557b80a88170 in CHash256::Write(unsigned char const*, unsigned long) src/./hash.h:34
          NEW_FUNC[1/11]: 0x557b80a88270 in CHash256::Finalize(unsigned char*) src/./hash.h:28
          NEW_FUNC[5/11]: 0x557b81affdb0 in CSHA256::CSHA256() src/crypto/sha256.cpp:644
          NEW_FUNC[6/11]: 0x557b81affe80 in (anonymous namespace)::sha256::Initialize(unsigned int*) src/crypto/sha256.cpp:66
          NEW_FUNC[7/11]: 0x557b81b00460 in CSHA256::Write(unsigned char const*, unsigned long) src/crypto/sha256.cpp:649
          NEW_FUNC[8/11]: 0x557b81b009a0 in CSHA256::Finalize(unsigned char*) src/crypto/sha256.cpp:675
          NEW_FUNC[9/11]: 0x557b81b015e0 in CSHA256::Reset() src/crypto/sha256.cpp:692
          NEW_FUNC[10/11]: 0x557b81b01d90 in (anonymous namespace)::sha256::Transform(unsigned int*, unsigned char const*, unsigned long) src/crypto/sha256.cpp:79
          NEW_FUNC[0/1]: 0x557b808cc180 in BaseSignatureChecker::CheckLockTime(CScriptNum const&) const src/./script/interpreter.h:153
          NEW_FUNC[0/2]: 0x557b81ab5640 in CastToBool(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/script/interpreter.cpp:36
          NEW_FUNC[0/1]: 0x557b817c9c30 in CScriptNum::getint() const src/./script/script.h:312
          NEW_FUNC[0/1]: 0x557b81ae1df0 in CScriptNum::operator-=(long const&) src/./script/script.h:298
          NEW_FUNC[0/5]: 0x557b81af5670 in CRIPEMD160::CRIPEMD160() src/crypto/ripemd160.cpp:243
          NEW_FUNC[1/5]: 0x557b81af5740 in (anonymous namespace)::ripemd160::Initialize(unsigned int*) src/crypto/ripemd160.cpp:25
          NEW_FUNC[2/5]: 0x557b81af5b00 in CRIPEMD160::Write(unsigned char const*, unsigned long) src/crypto/ripemd160.cpp:248
          NEW_FUNC[3/5]: 0x557b81af5fa0 in (anonymous namespace)::ripemd160::Transform(unsigned int*, unsigned char const*) src/crypto/ripemd160.cpp:55
          NEW_FUNC[4/5]: 0x557b81af8d60 in CRIPEMD160::Finalize(unsigned char*) src/crypto/ripemd160.cpp:274
          NEW_FUNC[0/16]: 0x557b80857a30 in CScript::operator<<(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/./script/script.h:462
          NEW_FUNC[1/16]: 0x557b80872670 in prevector<28u, unsigned char, unsigned int, int>::insert(prevector<28u, unsigned char, unsigned int, int>::iterator, unsigned char const&) src/./prevector.h:342
          NEW_FUNC[2/16]: 0x557b80872e00 in void prevector<28u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(prevector<28u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >) src/./prevector.h:368
          NEW_FUNC[3/16]: 0x557b80873630 in prevector<28u, unsigned char, unsigned int, int>::capacity() const src/./prevector.h:295
          NEW_FUNC[4/16]: 0x557b80874ed0 in void prevector<28u, unsigned char, unsigned int, int>::fill<prevector<28u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<28u, unsigned char, unsigned int, int>::const_iterator, prevector<28u, unsigned char, unsigned int, int>::const_iterator) src/./prevector.h:204
          NEW_FUNC[5/16]: 0x557b808cc0f0 in BaseSignatureChecker::CheckSig(std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, CScript const&, SigVersion) const src/./script/interpreter.h:148
          NEW_FUNC[6/16]: 0x557b809edb10 in CScript::operator=(CScript&&) src/./script/script.h:390
          NEW_FUNC[7/16]: 0x557b809f8ec0 in void prevector<28u, unsigned char, unsigned int, int>::insert<prevector<28u, unsigned char, unsigned int, int>::const_iterator>(prevector<28u, unsigned char, unsigned int, int>::iterator, prevector<28u, unsigned char, unsigned int, int>::const_iterator, prevector<28u, unsigned char, unsigned int, int>::const_iterator) src/./prevector.h:368
          NEW_FUNC[8/16]: 0x557b809f9260 in prevector<28u, unsigned char, unsigned int, int>::swap(prevector<28u, unsigned char, unsigned int, int>&) src/./prevector.h:451
          NEW_FUNC[9/16]: 0x557b81ab58c0 in CheckSignatureEncoding(std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, ScriptError_t*) src/script/interpreter.cpp:200
          NEW_FUNC[10/16]: 0x557b81ab6f30 in FindAndDelete(CScript&, CScript const&) src/script/interpreter.cpp:254
          NEW_FUNC[11/16]: 0x557b81acdc20 in CheckPubKeyEncoding(std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, SigVersion const&, ScriptError_t*) src/script/interpreter.cpp:217
          NEW_FUNC[12/16]: 0x557b81ad3890 in IsCompressedOrUncompressedPubKey(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/script/interpreter.cpp:63
          NEW_FUNC[13/16]: 0x557b81ad8830 in CScript::GetOp(prevector<28u, unsigned char, unsigned int, int>::const_iterator&, opcodetype&) const src/./script/script.h:505
          NEW_FUNC[14/16]: 0x557b81ae21a0 in prevector<28u, unsigned char, unsigned int, int>::prevector<prevector<28u, unsigned char, unsigned int, int>::const_iterator>(prevector<28u, unsigned char, unsigned int, int>::const_iterator, prevector<28u, unsigned char, unsigned int, int>::const_iterator) src/./prevector.h:246
          NEW_FUNC[0/1]: 0x557b81ae1a40 in CScriptNum::operator+=(long const&) src/./script/script.h:290
          NEW_FUNC[0/5]: 0x557b81af9760 in CSHA1::CSHA1() src/crypto/sha1.cpp:150
          NEW_FUNC[1/5]: 0x557b81af9830 in (anonymous namespace)::sha1::Initialize(unsigned int*) src/crypto/sha1.cpp:32
          NEW_FUNC[2/5]: 0x557b81af9bf0 in CSHA1::Write(unsigned char const*, unsigned long) src/crypto/sha1.cpp:155
          NEW_FUNC[3/5]: 0x557b81afa090 in (anonymous namespace)::sha1::Transform(unsigned int*, unsigned char const*) src/crypto/sha1.cpp:47
          NEW_FUNC[4/5]: 0x557b81afc5e0 in CSHA1::Finalize(unsigned char*) src/crypto/sha1.cpp:181
          NEW_FUNC[0/1]: 0x557b81ada4f0 in CScriptNum::operator-() const src/./script/script.h:278
          NEW_FUNC[0/1]: 0x557b808cc210 in BaseSignatureChecker::CheckSequence(CScriptNum const&) const src/./script/interpreter.h:158
          NEW_FUNC[0/1]: 0x557b81ab5c00 in IsValidSignatureEncoding(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/script/interpreter.cpp:107
  stat::number_of_executed_units: 9728
  stat::average_exec_per_sec:     1621
  stat::new_units_added:          844
  stat::slowest_unit_time_sec:    0
  stat::peak_rss_mb:              326
  Number of unique code paths taken during fuzzing round: 583

  Tested fuzz harnesses seem to work as expected.
  ```

ACKs for top commit:
  MarcoFalke:
    ACK 7e50abcc29

Tree-SHA512: 4874ab28efb4219c24a4cfc9be901a3297d1973f43acadec415c2e1d6843e4e661f90e8f9695849373775a4556884cdcc8862a092246ae0383b844c37c1627d5
2019-10-14 09:28:03 -04:00
Hennadii Stepanov 11e3d5eb1d
util: Add AllowShortCaseLabelsOnASingleLine option 2019-10-14 13:24:54 +03:00
practicalswift 7e50abcc29 tests: Add EvalScript(...) fuzzing harness 2019-10-12 16:42:21 +00:00
MarcoFalke 561a7d3047
Merge #16947: doc: Doxygen-friendly script/descriptor.h comments
15ac916642 doc: Doxygen-friendly descriptor.h comments (Jon Layton)

Pull request description:

  Closes #16942.

  - Make `Descriptor` overview subtext of `Interface for parsed descriptor objects.`
  - Conform to `@param[in, out] argname: Info` in parameter comments. Present in code: feb162d500/src/net_processing.cpp (L1001)
  - Remove redundant argument type, `in` vs `out` mentions
  - Removed unnecessary backticks around `IsSolvable()`, since Doxygen builds a link to the known function's docs
  - Add backticks to refer to `argname`s

  `descriptor.cpp` has more documentation, but Doxygen's output doesn't include anything inside unnamed namespaces for some reason. Tried to access them via searchbar.

Top commit has no ACKs.

Tree-SHA512: 587cc7596de46358a08b0321a7cf08a08785945715dbdce8945d837e1bee0664d1e11b1e47b7be85c4f35262f7ea173fb1f6202efcacc2023e2c6b0bd44133b3
2019-10-11 16:28:03 -04:00
Adam Jonas 66b29848c7 change wallet pointers to references in feebumper 2019-10-10 17:46:59 -04:00
practicalswift bebb637472 tests: Add FuzzedDataProvider fuzzing helper from the Chromium project
Source: https://cs.chromium.org/chromium/src/third_party/libFuzzer/src/utils/FuzzedDataProvider.h?rcl=b9f51dc8c98065df0c8da13c051046f5bab833db
2019-10-10 21:13:33 +00:00
MarcoFalke befdef8aee
Merge #16887: Abstract out some of the descriptor Span-parsing helpers
bb36372b8f test: add unit tests for Span-parsing helpers (Sebastian Falbesoner)
5e69aeec3f Add documenting comments to spanparsing.h (Pieter Wuille)
230d43fdbc Abstract out some of the descriptor Span-parsing helpers (Pieter Wuille)

Pull request description:

  As suggested here: https://github.com/bitcoin/bitcoin/pull/16800#issuecomment-531605482.

  This moves the Span parsing functions out of the descriptor module, making them more easily usable for other parsers (in particular, in preparation for miniscript parsing).

ACKs for top commit:
  MarcoFalke:
    ACK bb36372b8f

Tree-SHA512: b5c5c11a9bc3f0a1c2c4cfa22755654ecfb8d4b69da0dc1fb9f04e1556dc0f6ffd87ad153600963279ac465d587d7971b53d240ced802d12693682411ac73deb
2019-10-10 12:33:03 -04:00
MarcoFalke 59f0687fea
Merge #16786: test: add unit test for wallet watch-only methods involving PubKeys
a57a1d42d5 test: add unit test for wallet watch-only methods involving PubKeys (Sebastian Falbesoner)

Pull request description:

  The motivation for this addition was to unit test the function `wallet.cpp:ExtractPubKey()` (see recent change in commit 798a589aff) which is however static and only indirectly available via the public methods `AddWatchOnly()`, `LoadWatchOnly()` and `RemoveWatchOnly()`. Since the first of those methods also stores the addresses to the disk, the second, simpler one was chosen which only operates in memory.

ACKs for top commit:
  Sjors:
    ACK a57a1d4
  instagibbs:
    reACK a57a1d42d5
  Sjors:
    re-ACK a57a1d4

Tree-SHA512: 92a242204ab533022cd848662997372c41815b1265d07b3d96305697f801db29a5ba5668337faf4bea702bec1451972529afd6665927fb142aaf91700a338b26
2019-10-10 12:12:54 -04:00
Adam Jonas 9be6666a4e typo and unneccessary parentheses 2019-10-10 12:10:15 -04:00
MarcoFalke 2a0164085b
Merge #16689: rpc: add missing fields to wallet rpc help output
f4c8953b00 Add missing fields in TransactionDescriptionString and others (Antoine Riard)
3530108491 MOVEONLY : move RPC wallets helpers to TransactionDescriptionString (Antoine Riard)

Pull request description:

  Knowledge of `walletconflicts` field existence is really nice when you're debugging conflicts. Was added in #3671 but never documented in RPC helps.

  Others were added after a quick skim, we may still have missing ones in wallet rpcs.

ACKs for top commit:
  MarcoFalke:
    re-ACK f4c8953b00 (only change is addressing my nits)
  kristapsk:
    ACK f4c8953b00

Tree-SHA512: 2bea4d8743399fb152f942df7454548b896b2ad5654fd4bf60253afec1a5387ef8797ced97776dc7ba4912291263c08abe7c2b608c6a28f9a0df67be4ebc4635
2019-10-10 10:04:36 -04:00
MarcoFalke 2352aec9fc
Merge #17076: tests: Add fuzzing harness for CheckTransaction(...), IsStandardTx(...) and other CTransaction related functions
5c2987636f tests: Remove TRANSACTION_DESERIALIZE (replaced by transaction fuzzer) (practicalswift)
0a573682f2 tests: Add fuzzing harness for CheckTransaction(...), IsStandardTx(...) and other CTransaction related functions (practicalswift)

Pull request description:

  Add fuzzing harness for `CheckTransaction(...)`, `IsStandardTx(...)` and other `CTransaction` related functions.

  **Testing this PR**

  Run:

  ```
  $ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/transaction
  …
  # And to to quickly verify that the relevant code regions are triggered, that the
  # fuzzing throughput seems reasonable, etc.
  $ contrib/devtools/test_fuzzing_harnesses.sh '^transaction$'
  ```

  `test_fuzzing_harnesses.sh` can be found in PR #17000.

ACKs for top commit:
  MarcoFalke:
    ACK 5c2987636f

Tree-SHA512: 2f422df795c9dca13c98209ca9ce0fe5a0d4a71fb052fa33d599cc9c9f1d637fee27d58d02ed17b956b3e3d40931cbc1367fc99aa2e882473e54d95dee04d6b7
2019-10-10 09:18:34 -04:00
Wladimir J. van der Laan b67ca4ee73
Merge #17085: init: Change fallback locale to C.UTF-8
facb9a1315 init: Change fallback locale to C.UTF-8 (Wladimir J. van der Laan)

Pull request description:

  Much of our code assumes file system UTF-8 support, and this is a more realistic guess for modern systems anyway than the default character set (which would be ASCII only). So change the assumed fallback locale (if no locale is defined by the user or OS) to `C.UTF-8`.

  related: https://github.com/bitcoin/bitcoin/issues/14948#issuecomment-488385462

ACKs for top commit:
  MarcoFalke:
    ACK facb9a1315

Tree-SHA512: 5075f9fe6791572d76ec38c58cd56f04ed8086c06a7d7f446d062dffc313c62466ba81f1a7d6b8c7e95791fcff82e4f76871c3534478fbfe5beb456dd8eea340
2019-10-10 13:09:50 +02:00
Jonas Schnelli 5cb1d938a1
Merge #15756: gui: Add shortcuts for tab tools
091747b46e gui: Add shortcuts for tab tools (João Barbosa)

Pull request description:

  This makes accessing the RPC console very fast/easy. It also improves accessibility.

  <img width="234" alt="Screenshot 2019-10-02 at 01 30 53" src="https://user-images.githubusercontent.com/3534524/66009867-50104300-e4b4-11e9-90b5-6b8dc961a8a1.png">

ACKs for top commit:
  jonasschnelli:
    Tested ACK 091747b46e - this is an improvment. Further solutions to solve the interference between the console and the shortcuts (if possible) can be done upstream (Qt) or with another PR.

Tree-SHA512: 6b8bc07e8a3a75e53c05f0fdb73458d75ef025f950569e885e655de53fdac8b91dcabfb1c6e643b1d23065420fa2701847c00cc1718bc188778640aefb5bcbd8
2019-10-10 09:03:44 +02:00
Jonas Schnelli b265ffe323
Merge #15023: GUI: Restore RPC Console to non-wallet tray icon menu
f33efa8ec5 GUI: Restore RPC Console to non-wallet tray icon menu (Luke Dashjr)

Pull request description:

  #14383 moved the debug window's menu position, to make it conditional on wallet mode. The rationale given was to match the behaviour of the 'Help' menu.

  #14573 replaced the 'Help' menu's conditional debug window with an unconditional list of items in the new 'Window' menu.

  This PR reverts the no-longer-applicable part of #14383, putting the debug window back on the tray menu unconditionally, and in the position it previously had.

ACKs for top commit:
  jonasschnelli:
    Tested ACK f33efa8ec5 - the debug window is also accessible from the menu (though directly the subpages which counts IMO).

Tree-SHA512: c04a588fed37a8c31cb413baaa346e3c1c18724f9b40d64b8528c517f65290930d577bccf0a794180e968e84d3c52e9fa3fdc8a40bbc5fe3418eaddd73481271
2019-10-10 09:02:34 +02:00
Sebastian Falbesoner bb36372b8f test: add unit tests for Span-parsing helpers
tests the following four functions:
    - Const() [parse constant]
    - Func()  [parse function]
    - Expr()  [parse expression]
    - Split() [split up a string]
2019-10-09 18:11:14 -07:00
fanquake a2ae766a61
Merge #15098: qt: Show addresses for "SendToSelf" transactions
11fdfcf7f9 Show addresses for "SendToSelf" transactions (Hennadii Stepanov)

Pull request description:

  Fix #11464
  Fix #12688
  Ref: #11471 by jonasschnelli

  Note: change addresses are not recognized (ref: https://github.com/bitcoin/bitcoin/pull/11471#discussion_r180547041)

  Result:
  ![screenshot from 2019-01-04 09-06-12](https://user-images.githubusercontent.com/32963518/50677356-19c79500-1002-11e9-986c-999c366e4b2a.png)

ACKs for top commit:
  jonasschnelli:
    Tested ACK 11fdfcf7f9
  fanquake:
    ACK 11fdfcf7f9 - did the bare minimum testing.

Tree-SHA512: 2678a2fdf017c376750c73fdc751b7838b0d3a970ba02e9032e4c5824494362672036c3ebf87b425aefdfe197fb952b70e4b7b6011077abb39a8bfc1ae14dfd2
2019-10-09 14:35:29 -04:00
Antoine Riard f4c8953b00 Add missing fields in TransactionDescriptionString and others
Fields involvesWatchonly, generated, walletconflicts were missing
in result description of listtransactions, listsinceblock,
gettransaction

Align getttransaction fields which were odd compare to other rpc
helpers
2019-10-09 14:26:50 -04:00
Antoine Riard 3530108491 MOVEONLY : move RPC wallets helpers to TransactionDescriptionString 2019-10-09 14:22:02 -04:00
practicalswift 5c2987636f tests: Remove TRANSACTION_DESERIALIZE (replaced by transaction fuzzer) 2019-10-09 13:53:13 +00:00
practicalswift 0a573682f2 tests: Add fuzzing harness for CheckTransaction(...), IsStandardTx(...) and other CTransaction related functions 2019-10-09 13:53:13 +00:00
fanquake b1de33d29a
Merge #16821: Fix bug where duplicate PSBT keys are accepted
9743432034 Fix bug where duplicate PSBT keys are accepted (John L. Jegutanis)

Pull request description:

  As per the BIP 174 spec a PSBT key cannot be duplicated,
  however the current code accepts key duplication.
  The PSBT key/value entries can be duplicated when the value
  is `empty()` or `IsNull()` for `CScript` or `CTxOut` respectively
  and if those key/value entries are serialized before the non-empty ones.

  For example, the following PSBT, included in the test vectors,
  contains a duplicate field:

  ```
  // magic
  70736274ff

  // global tx
  //// key
  0100
  //// value
  2a02000000000140420f000000000017a9146e91b72d5593e7d4391e2ff44e91e985c31641f08700000000
  //// separator
  00

  // no inputs

  // outputs
  //// key PSBT_OUT_WITNESSSCRIPT
  0101
  //// value (empty script)
  00
  //// key PSBT_OUT_WITNESSSCRIPT (same as the above)
  0101
  //// value (an OP_RETURN script)
  016a
  //// separator
  00
  ```

ACKs for top commit:
  achow101:
    ACK 9743432034
  instagibbs:
    code review ACK 9743432034

Tree-SHA512: 34f4b34c8e6561c6a6ab745cdd319f6687eac6f7cecc735c94035eeca8c5157e17a27f2ae853dbaa6634fcd5a8f4e1c6cc13d1ebd7e563459665d72bb147cc1e
2019-10-09 09:18:27 -04:00
Wladimir J. van der Laan facb9a1315 init: Change fallback locale to C.UTF-8
Much of our code assumes UTF-8 support, and this is a more realistic
guess for modern systems anyway than the default character set (which
would be ASCII only). So change the assumed fallback locale (if no
locale is defined by the user or OS) to `C.UTF-8`.
2019-10-09 14:53:18 +02:00
Daki Carnhof 4de0bde7bc build: Fix #include sys/poll.h to just poll.h (without sys/)
http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html
http://man7.org/linux/man-pages/man2/poll.2.html
2019-10-09 13:30:36 +02:00
Wladimir J. van der Laan c08bf2b574
Merge #15437: p2p: Remove BIP61 reject messages
fa25f43ac5 p2p: Remove BIP61 reject messages (MarcoFalke)

Pull request description:

  Reject messages (BIP 61) appear in the following settings:

  * Parsing of reject messages (in case `-debug=net` is set, off by default). This has only been used for a single `LogPrint` call for several releases now. Such logging is completely meaningless to us and should thus be removed.

  * The sending of reject messages (in case `-enablebip61` is set, off by default). This can be used to debug a node that is under our control. Instead of hacking this debugging into the p2p protocol, it could be more easily achieved by parsing the debug log. (Use `-printtoconsole` to have it as stream, or read from the `debug.log` file like our python function `assert_debug_log` in the test framework does)

  Having to maintain all of this logic and code to accommodate debugging, which can be achieved by other means a lot easier, is a burden. It makes review on net processing changes a lot harder, since the reject message logic has to be carried around without introducing any errors or DOS vectors.

ACKs for top commit:
  jnewbery:
    utACK fa25f43ac5
  laanwj:
    I'm still not 100% convinced that I like getting rid of BIP61 conceptually, but apparently everyone wants it, code review ACK fa25f43ac5.
  ryanofsky:
    Code review ACK fa25f43ac5

Tree-SHA512: daf55254202925e56be3d6cfb3c1c804e7a82cecb1dd1e5bd7b472bae989fd68ac4f21ec53fc46751353056fd645f7f877bebcb0b40920257991423a3d99e0be
2019-10-09 11:51:58 +02:00
fanquake 520d140e6e
Merge #17056: descriptors: Introduce sortedmulti descriptor
4bb660be90 Add release note (Andrew Chow)
ed96b295d7 Update descriptors.md to include sortedmulti (Andrew Chow)
80be78ea75 Test sortedmulti descriptor using BIP 67 tests (Andrew Chow)
6f588fd227 Add sortedmulti descriptor and unit tests (Andrew Chow)

Pull request description:

  Adds a `sortedmulti()` descriptor as mentioned in https://github.com/bitcoin/bitcoin/pull/17023#issuecomment-537596416.

  `sortedmulti()` works in the same way as `multi` does but sorts the pubkeys in the resulting scripts in lexicographic order as described in [BIP67](https://github.com/bitcoin/bips/blob/master/bip-0067.mediawiki). Note that this does not add support for BIP67 nor is BIP67 fully supported by this descriptor (which is why it is not named `multi67()`) as it does not require compressed pubkeys.

  Tests from BIP67 were added and documentation was updated.

ACKs for top commit:
  instagibbs:
    re-ACK 4bb660be90
  Sjors:
    re-ACK 4bb660be90

Tree-SHA512: 93b21112a74ebe0bf316d8f3e0291f69fd975cf0a29332f9728e7b880cad312b8b14007e86adcd7899f117b9303cbcf4cb35f3bb2f2f648d1a446f83f75a70a5
2019-10-08 14:26:26 -04:00
Andrew Chow 6f588fd227 Add sortedmulti descriptor and unit tests 2019-10-08 13:56:56 -04:00
Wladimir J. van der Laan e173d587e1
Merge #17068: qt: Always generate bitcoinstrings.cpp on make translate
c640ca24f9 Always generate `bitcoinstrings.cpp` on `make translate` (Franck Royer)

Pull request description:

  Resolves #16891.

  `bitcoinstrings.cpp` is to be generated at release time. Hence,
  it should not depend on whether the source files are younger as the
  releaser may proceed from a fresh checkout.

  More information on the investigation in the issue.

ACKs for top commit:
  jonasschnelli:
    Tested ACK c640ca24f9 - Tested master + this on macOS 10.14. With this PR, it always "runs" `GEN      qt/bitcoinstrings.cpp` and `GEN      translate`.

Tree-SHA512: f799fdc3ad16a2a6a59704bc2c50f5179e6a7e064d8f43354592f11857cc901cac99b2b90f3319d25d49c9d78378b8d119cc5f59b48ea7f1008f33dd26700877
2019-10-08 14:08:08 +02:00
Wladimir J. van der Laan 9f8cd0ac89
Merge #17059: util: Simplify path argument for CBlockTreeDB ctor
c2bb3919a8 util: Simplify path argument for CBlockTreeDB ctor (Hennadii Stepanov)

Pull request description:

  This PR:
  - simplifies path argument (`datadir/blocks/index`) for `CBlockTreeDB`  constructor
  - does not change behavior as `GetBlocksDir()` with unset "-blocksdir" returns the same path
  - improves code readability

ACKs for top commit:
  MarcoFalke:
    ACK c2bb3919a8
  laanwj:
    ACK c2bb3919a8
  promag:
    ACK c2bb3919a8.

Tree-SHA512: 646a0a3a31e2f419b05f696cbdfb7d8987f1d89ec0797b72464ae05680fd5f95f6469be0ea5b56f772434c49d48504cd9cf9760c05d4054d11349d502e157ee2
2019-10-08 11:47:24 +02:00
Wladimir J. van der Laan 2f174498d6
Merge #17073: move-only: PASTE macros to util/macros.h
0d86f4d3da refactor: consolidate PASTE macros (James O'Beirne)

Pull request description:

  Really dumb move-only stolen from #16805. Some of my pull requests also depend on this, so I split it up to not depend on #16805.

ACKs for top commit:
  practicalswift:
    ACK 0d86f4d3da -- diff looks correct
  hebasto:
    ACK 0d86f4d3da, I have reviewed the code and it looks OK, I agree it can be merged.
  promag:
    ACK 0d86f4d3da.

Tree-SHA512: 19208a8cbf83034b1ef25138d8f08d8f32ace7775f654b1597fc4599dd576f0758145f592f161cfdcaaa29d4907ac9aa5553f6f524e2b960205c760605a05901
2019-10-08 11:25:51 +02:00
John L. Jegutanis 9743432034 Fix bug where duplicate PSBT keys are accepted
As per the BIP 174 spec a PSBT key cannot be duplicated,
however the current code accepts key duplication.
The PSBT key/value entries can be duplicated when the value
is `empty()` or `IsNull()` for `CScript` or `CTxOut` respectively
and if those key/value entries are serialized before the non-empty ones.

For example, the following PSBT, included in the test vectors,
contains a duplicate field:

```
// magic
70736274ff

// global tx
//// key
0100
//// value
2a02000000000140420f000000000017a9146e91b72d5593e7d4391e2ff44e91e985c31641f08700000000
//// separator
00

// no inputs

// outputs
//// key PSBT_OUT_WITNESSSCRIPT
0101
//// value (empty script)
00
//// key PSBT_OUT_WITNESSSCRIPT (same as the above)
0101
//// value (an OP_RETURN script)
016a
//// separator
00
```
2019-10-08 01:45:36 +03:00
practicalswift ffa2221256 tests: Pass fuzzing inputs as constant references 2019-10-07 08:48:35 +00:00
Franck Royer c640ca24f9 Always generate bitcoinstrings.cpp on make translate
`bitcoinstrings.cpp` is to be generated at release time. Hence,
it should not depend on whether the source files are younger as the
releaser may proceed from a fresh checkout.
2019-10-07 15:38:07 +11:00
Hennadii Stepanov c2bb3919a8
util: Simplify path argument for CBlockTreeDB ctor
This commit does not change behavior as GetBlocksDir() with unset 
"-blocksdir" returns the same path.
2019-10-05 09:38:56 +03:00
fanquake 94d6a18f23
Merge #16507: feefilter: Compute the absolute fee rather than stored rate
eb7b781659 modify p2p_feefilter test to catch rounding error (Gregory Sanders)
6a51f79517 Disallow implicit conversion for CFeeRate constructor (Gregory Sanders)
8e59af55aa feefilter: Compute the absolute fee rather than stored rate to match mempool acceptance logic (Gregory Sanders)

Pull request description:

  This means we will use the rounding-down behavior in `GetFee` to match both mempool acceptance and wallet logic, with minimal changes.

  Fixes https://github.com/bitcoin/bitcoin/issues/16499

  Replacement PR for https://github.com/bitcoin/bitcoin/pull/16500

ACKs for top commit:
  ajtowns:
    ACK eb7b781659 code review only
  naumenkogs:
    utACK eb7b781659
  achow101:
    re ACK eb7b781659
  promag:
    ACK eb7b781659.

Tree-SHA512: 484a11c8f0e825f0c983b1f7e71cf6252b1bba6858194abfe4c088da3bae8a418ec539ef6c4181bf30940e277a95c08d493595d59dfcc6ddf77c65b05563dd7e
2019-10-04 13:46:45 -04:00