Commit graph

20158 commits

Author SHA1 Message Date
MarcoFalke fab6a0a659
test: Add test that addmultisigaddress fails for watchonly addresses 2019-04-17 07:43:34 -04:00
MarcoFalke 0c9de67f34
Merge #15352: tests: Reduce noise level in test_bitcoin output
0aef39d067 Silence "Test case [...] did not check any assertions" warnings when running "test_bitcoin --log_level=test_suite" (practicalswift)
5fd73c8694 Avoid repeated log messages in tests by connecting to signal handlers (ThreadSafeMessageBox, etc.) only once (practicalswift)
e502c3c515 tests: Reduce noise level in test_bitcoin output (practicalswift)

Pull request description:

  Reduce noise level in `test_bitcoin` output.

  Context: When working on the non-determinism issues in the unit tests (see #15296) I got a bit tired of the amount of noise in the `test_bitcoin` output :-)

  Before:

  ```
  $ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c
        1 Running 341 test cases...
        1 Test case blockencodings_tests/TransactionsRequestDeserializationOverflowTest did not check any assertions
        1 CheckSplitTorReplyLine(PROTOCOLINFO PIVERSION)
        1 CheckSplitTorReplyLine(AUTH METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie")
        1 CheckSplitTorReplyLine(AUTH METHODS=NULL)
        1 CheckSplitTorReplyLine(AUTH METHODS=HASHEDPASSWORD)
        1 CheckSplitTorReplyLine(VERSION Tor="0.2.9.8 (git-a0df013ea241b026)")
        1 CheckSplitTorReplyLine(AUTHCHALLENGE SERVERHASH=aaaa SERVERNONCE=bbbb)
        1 CheckSplitTorReplyLine(COMMAND)
        1 CheckSplitTorReplyLine(COMMAND SOME  ARGS)
        1 CheckSplitTorReplyLine(COMMAND  ARGS)
        1 CheckSplitTorReplyLine(COMMAND   EVEN+more  ARGS)
        1 CheckParseTorReplyMapping(METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie")
        1 CheckParseTorReplyMapping(METHODS=NULL)
        1 CheckParseTorReplyMapping(METHODS=HASHEDPASSWORD)
        1 CheckParseTorReplyMapping(Tor="0.2.9.8 (git-a0df013ea241b026)")
        1 CheckParseTorReplyMapping(SERVERHASH=aaaa SERVERNONCE=bbbb)
        1 CheckParseTorReplyMapping(ServiceID=exampleonion1234)
        1 CheckParseTorReplyMapping(PrivateKey=RSA1024:BLOB)
        1 CheckParseTorReplyMapping(ClientAuth=bob:BLOB)
        1 CheckParseTorReplyMapping(Foo=Bar=Baz Spam=Eggs)
        1 CheckParseTorReplyMapping(Foo="Bar=Baz")
        1 CheckParseTorReplyMapping(Foo="Bar Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\ Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\@Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\"Baz" Spam="\"Eggs\"")
        1 CheckParseTorReplyMapping(Foo="Bar\\Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\nBaz\t" Spam="\rEggs" Octals="\1a\11\17\18\81\377\378\400\2222" Final=Check)
        1 CheckParseTorReplyMapping(Valid=Mapping Escaped="Escape\\")
        1 CheckParseTorReplyMapping(Valid=Mapping Bare="Escape\")
        1 CheckParseTorReplyMapping(OneOctal="OneEnd\1" TwoOctal="TwoEnd\11")
        1 CheckParseTorReplyMapping(Null="\0")
        1 CheckParseTorReplyMapping(SOME=args,here MORE optional=arguments  here)
        1 CheckParseTorReplyMapping(ARGS)
        1 CheckParseTorReplyMapping(MORE ARGS)
        1 CheckParseTorReplyMapping(MORE  ARGS)
        1 CheckParseTorReplyMapping(EVEN more=ARGS)
        1 CheckParseTorReplyMapping(EVEN+more ARGS)
        1 Test case util_tests/util_criticalsection did not check any assertions
        1 Testing known outcomes
      326 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_943311758/tempdir/path_does_not_exist" does not exist
      327 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_643733972/tempdir/not_a_directory.dat" is not a directory
      328 Error: Specified -walletdir "wallets" is a relative path
        1
        1 *** No errors detected

  ```

  After:

  ```
  $ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c
        1 Running 341 test cases...
        1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_943311758/tempdir/path_does_not_exist" does not exist
        1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_643733972/tempdir/not_a_directory.dat" is not a directory
        1 Error: Specified -walletdir "wallets" is a relative path
        1
        1 *** No errors detected

  ```

ACKs for commit 0aef39:
  MarcoFalke:
    utACK 0aef39d067

Tree-SHA512: 9cc22f64aa5c875861bae6533d18675ad978c623f053754deef6a8e271ea70bda3f72fb4ec5c8fd19b841757f21380639051d5f5b44301b9d2464b57655e9c05
2019-04-16 14:18:47 -04:00
MarcoFalke fad81d870a
test: Fixup creatmultisig documentation and whitespace 2019-04-16 13:05:54 -04:00
MarcoFalke fa346fe883
doc: Remove upgrade note in release notes from EOL versions 2019-04-16 10:40:39 -04:00
Tobias Kaderle 81b2830b15
qt: update request payment button text and tab description 2019-04-16 20:40:13 +08:00
MarcoFalke 598323911e
Merge #15770: rpc: Validate maxfeerate with AmountFromValue
aa410c2b17 rpc: Validate maxfeerate with AmountFromValue (João Barbosa)

Pull request description:

  With this change `maxfeerate` can also be set as a string, accordingly to the help test:
  ```
    maxfeerate    (numeric or string,
  ```
  Beside, there are no tests for the removed errors.

ACKs for commit aa410c:
  meshcollider:
    utACK aa410c2b17
  MarcoFalke:
    utACK aa410c2b17 Good catch

Tree-SHA512: f3bfea91dc7daa943729e270585dbf333055aeda805fbd01eaab20a7e0e6147382647c11525334382d198df0d3d45da6102b541efda5a1361f96271c98d5d89d
2019-04-15 17:05:42 -04:00
MarcoFalke fa46ac3127
bench: Add wallet_balance benchmarks 2019-04-15 16:49:34 -04:00
r8921039 2d8ba4f867 remove out-of-date comment on pay-to-witness support 2019-04-15 09:15:25 -07:00
MarcoFalke 78295e97b8
Merge #15788: test: Unify testing setups for fuzz, bench, and unit tests
faf400077d scripted-diff: Bump copyright headers in test, bench (MarcoFalke)
fa821904bf scripted-diff: Rename test_bitcoin to test/setup_common (MarcoFalke)
fa8685d49e test: Use test_bitcoin setup in bench, Add test utils (MarcoFalke)
666696b673 test: Have segwit always active in (Basic)TestingSetup (MarcoFalke)

Pull request description:

  Now that the fuzz tests can use the BasicTestingSetup [1], do the same for bench.

  Also move some duplicate code to a common "test/util" module.

  [1]:  fuzz: Link BasicTestingSetup (shared with unit tests) #15504

ACKs for commit faf400:
  jonatack:
    ACK faf400077d

Tree-SHA512: 8ac5692e72cf50e460958f291643ae6b8bb04d5c1331ed50dce9eb4e9457e5a925144c532c42b360a26707e11eeece74aab27db8c76ab9a429b9dd7167e7cdc4
2019-04-15 11:28:25 -04:00
MarcoFalke 2209b3ba25
Merge #15799: doc: Clarify RPC versioning
fa747498f7 doc: Clarify RPC versioning (MarcoFalke)

Pull request description:

ACKs for commit fa7474:

Tree-SHA512: 4d374cc9ae77a06423acc9c73fe29f706f4349c548b17cb2414f15f72e0fc8c6ef7783ce099e938db2ab949717a4ef29e1aebc6aa09a350853d7f875b192ccb5
2019-04-15 11:20:53 -04:00
MarcoFalke fa747498f7
doc: Clarify RPC versioning 2019-04-15 11:20:16 -04:00
MarcoFalke 2a854a1781
Merge #15750: [rpc] Remove the addresses field from the getaddressinfo return object
b4338c151d [rpc] Remove the addresses field from the getaddressinfo return object (John Newbery)

Pull request description:

  The "addresses" field was confusing because it refered to public keys
  using their P2PKH address.  It was included in the return object when
  needed for backward compatibility. Remove that compatibility now that
  the -deprecatedrpc=validateaddress option has been removed.

  New applications should use the 'embedded'->'address' field for P2SH or
  P2WSH wrapped addresses, and 'pubkeys' for inspecting multisig
  participants.

ACKs for commit b4338c:
  jonatack:
    ACK b4338c151d. Tests [gist](https://gist.github.com/jonatack/31915e290bb1be39b9769dc9357385ca).

Tree-SHA512: 2c207510e565df600428838bfc6db5211fa06aaace365e31cbd74f1d2376b598675cb90df2fc1440858d49b22095aaa9d6b9ce3de0aff22417fe72cc6a6a321f
2019-04-15 11:09:18 -04:00
Wladimir J. van der Laan 2a191b4846
Merge #15802: doc: mention creating application support bitcoin folder on OSX
8dfbb5cf23 doc: mention creating application support bitcoin folder on OSX (Jack Mallers)

Pull request description:

  When setting up bitcoin core on my new MacBook via the [`macOS Build Instructions and Notes`](https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md), running `touch "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"` resulted in `No such file or directory` because my `/Users/${USER}/Library/Application Support/Bitcoin/` folder had not been created yet.

  This PR adds `mkdir "/Users/${USER}/Library/Application Support/Bitcoin"` to the documentation before creating the configuration file with `touch "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"`

ACKs for commit 8dfbb5:
  fanquake:
    utACK 8dfbb5cf23

Tree-SHA512: c401dae0a681bed77b31939bd29f79837f66c8537da393871fc3596e8c10629b8817ece9c8d49b1b9de34e74e0fbff742a9116b02ce7a71af93f872b87539337
2019-04-15 14:42:15 +02:00
Wladimir J. van der Laan 9422e2c29f
Merge #15792: doc: describe onlynet option in doc/tor.md
140bbeec45 doc: describe onlynet option in doc/tor.md (Jon Atack)

Pull request description:

  as per http://www.erisian.com.au/bitcoin-core-dev/log-2019-04-11.html#l-102.

  Description adapted from [/src/init.cpp#L429](https://github.com/bitcoin/bitcoin/blob/master/src/init.cpp#L429).

  Please verify if this is the best place to add it in the documentation.

  This commit also fixes a typo in doc/dependencies.md.

  [skip ci]

ACKs for commit 140bbe:
  practicalswift:
    ACK 140bbeec45
  fanquake:
    utACK 140bbee

Tree-SHA512: 05064cc155de5a855e26f70ac5741a137ee5050573007a19e10dba0b5b2c89148ef30f765b50fc76f73dfad17df082f4e68e174b93e2bf7e169e8bd1f9426673
2019-04-15 14:38:39 +02:00
Wladimir J. van der Laan 0c6487c74f
Merge #15751: Speed up deriveaddresses for large ranges
41a46cbb31 Speed up deriveaddresses for large ranges (Pieter Wuille)

Pull request description:

  `deriveaddresses` dumps all generated addresses into a single `FlatSigningProvider`, which is also used for looking up information for future derivations. @achow101 points out that the growing data structures may unnecessary increase lookup time for later derivations.

  Fix this by separating the provider used for lookups (`key_provider`) and the one we dump things into.

  This gives a 10x speedup for a range of 7000 elements, and probably a larger speedup for larger ranges.

ACKs for commit 41a46c:
  achow101:
    Regardless, I do think this is a good change, so utACK 41a46cbb31
  fanquake:
    tACK 41a46cb
  meshcollider:
    utACK 41a46cbb31

Tree-SHA512: a1b894ce9d5195d8f9760f44acc6d67a90bb259283fd8c1524c38a222fe53e8c1d35b6653a508b121b7ad91e155c97d26c658f6bdcebf6c360546931e4a26a22
2019-04-15 13:52:17 +02:00
Wladimir J. van der Laan 617261eb1c
Merge #15809: gitignore: plist and dat
17be9e0e30 gitignore: add *.plist (clang-check) (James O'Beirne)
e7acf44bbf gitignore: add *.dat (James O'Beirne)

Pull request description:

  Ignore anything ending in `.dat` and files generated by clang-check.

ACKs for commit 17be9e:
  fanquake:
    utACK 17be9e0

Tree-SHA512: 92854ad6fe1e7fd1180f2c809aeed802a9e95c90bd1faeca884d27dba7cacd34a6ececa2218f681433bb69a194efb932ff43b501ec1ccccb56b7d4e41facafe6
2019-04-15 13:43:13 +02:00
MeshCollider 4f4ef3138b
Merge #15557: Enhance bumpfee to include inputs when targeting a feerate
184f8785f wallet_bumpfee.py: add test for change key preservation (Gregory Sanders)
d08becff8 add functional tests for feerate bumpfee with adding inputs (Gregory Sanders)
0ea47ba7b generalize bumpfee to add inputs when needed (Gregory Sanders)

Pull request description:

  When targeting a feerate using `bumpfee`, call a new function that directly uses `CWallet::CreateTransaction` and coin control to get the desired result. This allows us to get a superset of previous behavior, with an arbitrary RBF bump of a transaction provided it passes the preconditional checks and spare confirmed utxos are available.

  Note(s):
  0) The coin selection will use knapsack solver for the residual selection.
  1) This functionality, just like knapsack coin selection in general, will hoover up negative-value inputs when given the chance.
  2) Newly added inputs must be confirmed due to current Core policy. See error: `replacement-adds-unconfirmed`
  3) Supporting this with `totalFee` is difficult since the "minimum total fee" option in `CreateTransaction` logic was (rightly)taken out in #10390 .

ACKs for commit 184f87:
  jnewbery:
    utACK 184f8785f7

Tree-SHA512: fb6542bdfb2c6010e328ec475cf9dcbff4eb2b1a1b27f78010214534908987a5635797196fa05edddffcbcf2987335872dc644a99261886d5cbb34a8f262ad3e
2019-04-15 08:39:50 +12:00
MeshCollider adc55dbac5
Merge #15748: [rpc] remove dead mining code
1b46a4889 [cleanup] Remove unused CReserveKey (John Newbery)
9819ad6d0 [rpc] simplify generate RPC (John Newbery)

Pull request description:

  Removes dead code from after the generate method was removed

ACKs for commit 1b46a4:
  MarcoFalke:
    utACK 1b46a4889f
  meshcollider:
    utACK 1b46a4889f
  scravy:
    utACK 1b46a48
  Empact:
    utACK 1b46a4889f

Tree-SHA512: d1fab1bf76ac3036b85cf33be89868bc016f912575545ecaa16f958397b0ec4f1ce4de8fe254d4f21aabeea9c83a8928530cc520de26af0d1a8bdb4ca0f2cb77
2019-04-14 16:09:05 +12:00
James O'Beirne 17be9e0e30 gitignore: add *.plist (clang-check) 2019-04-12 15:25:00 -04:00
James O'Beirne e7acf44bbf gitignore: add *.dat 2019-04-12 15:24:45 -04:00
MarcoFalke 66ce95a434
Merge #15797: travis: Bump second timeout to 33 minutes, Add rationale
fa2dfbf30a travis: Bump second timeout to 33 minutes, Add rationale (MarcoFalke)

Pull request description:

  People have been complaining on IRC about timeouts, but I don't think we can bump it much further. The tests take more than 15 minutes in some cases [1], so if there is less than 1000 seconds left to finish them we need to abort and save the cache. 🤷‍♂️.

  [1] https://travis-ci.org/bitcoin/bitcoin/jobs/518788414#L3568

ACKs for commit fa2dfb:
  practicalswift:
    utACK fa2dfbf30a
  fanquake:
    utACK fa2dfbf 

Tree-SHA512: ae981731e574f34cc54145eec52c4bdee241943ef22a6fbdf3e14b8f36538b0ae4f83815fa6a2a5fe4b15a18a2f0c7898dca8ec435125f32d92fa8c19caf4272
2019-04-12 12:50:29 -04:00
Jack Mallers 8dfbb5cf23 doc: mention creating application support bitcoin folder on OSX 2019-04-12 09:18:41 -05:00
Luke Dashjr 8a33f4d63f GUI: Options: Remove the upper-bound limit from pruning size setting
Hypothetically, someone may wish to begin pruning at a future blockchain size, and there's no reason to limit it lower
2019-04-11 23:44:48 +00:00
Luke Dashjr 4ddeb2f860 GUI: Options: Set the range of pruning size before loading its value
Without this, an out-of-default-range value gets limited to the range
2019-04-11 23:42:26 +00:00
John Newbery b4338c151d [rpc] Remove the addresses field from the getaddressinfo return object
The "addresses" field was confusing because it refered to public keys
using their P2PKH address.  It was included in the return object when
needed for backward compatibility. Remove that compatibility now that
the -deprecatedrpc=validateaddress option has been removed.

New applications should use the 'embedded'->'address' field for P2SH or
P2WSH wrapped addresses, and 'pubkeys' for inspecting multisig
participants.
2019-04-11 15:10:53 -04:00
MarcoFalke fa2dfbf30a
travis: Bump second timeout to 33 minutes, Add rationale 2019-04-11 14:56:56 -04:00
MarcoFalke faf400077d
scripted-diff: Bump copyright headers in test, bench
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./src/bench/
./contrib/devtools/copyright_header.py update ./src/test/
-END VERIFY SCRIPT-
2019-04-11 13:34:43 -04:00
MarcoFalke 0e9cb2d24d
Merge #15773: test: Add BitcoinTestFramework::sync_* methods
fafe5f0d09 test: Remove unused imports (MarcoFalke)
fa16a09215 scripted-diff: use self.sync_* methods (MarcoFalke)
faf77f9b90 test: Pass self to test_simple_bumpfee_succeeds (MarcoFalke)
fa6dc7c5c3 test: Add BitcoinTestFramework::sync_* methods (MarcoFalke)
fafe008cb4 test: Pass at most one node group to sync_all (MarcoFalke)
fa4680ed09 scripted-diff: Rename sync_blocks to send_blocks to avoid name collisions and confusion (MarcoFalke)

Pull request description:

  This adds methods to the test framework that can be called by just `self.sync_*()`.

  This avoids having to import the underlying util method. Also, in the default case, where all nodes are synced this avoid having to pass `self.nodes` explicitly.

  So the effective changes are:

  ```diff
  @@
  -from test_framework.util import sync_blocks, sync_mempools
  @@
  -        sync_blocks(self.nodes)
  +        self.sync_blocks()
  @@
  -        sync_mempools(self.nodes)
  +        self.sync_mempools()

ACKs for commit fafe5f:
  promag:
    utACK fafe5f0.
  jonatack:
    ACK fafe5f0d09, nice simplification.

Tree-SHA512: 5c81840edf9fb3c5de2d7bf95ca36a5a8d23567cd1479a0f4044547c2080e9a3c5cf375357bc8eebb5b68829be050a171ab2512cfd47b89feed51fe3bad2cd72
2019-04-11 13:23:05 -04:00
MarcoFalke fa821904bf
scripted-diff: Rename test_bitcoin to test/setup_common
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/test_bitcoin\.(h|cpp)/setup_common.\1/g' $(git grep -l test_bitcoin)
git mv ./src/test/test_bitcoin.h   ./src/test/setup_common.h
git mv ./src/test/test_bitcoin.cpp ./src/test/setup_common.cpp
sed -i -e 's/BITCOIN_TEST_TEST_BITCOIN_H/BITCOIN_TEST_SETUP_COMMON_H/g' ./src/test/setup_common.h
-END VERIFY SCRIPT-
2019-04-11 10:12:36 -04:00
Wladimir J. van der Laan bb68abe784
Merge #15718: docs: Improve netaddress comments
303372c41a docs: Improve netaddress comments (Carl Dong)

Pull request description:

  Improves comments for `netaddress`, making them available to Doxygen.

  I think this is worthwhile because a lot of the code require some context (e.g., A lot of the things that we do to fit hostnames and tor addresses into `CNetAddr` is non-obvious, and documenting it is beneficial).

ACKs for commit 303372:

Tree-SHA512: 2a35784a01ed8ec5fdbe111a540192d31bde16afa96e4be97b0385daf290fc7469a66d7cb8905a70b920fad6a0e7400ca4e5da082d6e4af1d1aaccc0e8297720
2019-04-11 16:02:54 +02:00
Wladimir J. van der Laan 570eb7b130
Merge #15782: Avoid redefine warning
0b3a65455a Avoid redefine warning (Peter Bushnell)

Pull request description:

  Wrap preprocessor definition of NOMINMAX in ifndef conditional to suppress warning when cross compiling Windows.

  `fs.cpp:6:0: warning: "NOMINMAX" redefined`
  `/usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/include/c++/x86_64-w64-mingw32/bits/os_defines.h:45:0: note: this is the location of the previous definition
   #define NOMINMAX 1`

  #define NOMINMAX was introduced in the following merge.

  https://github.com/bitcoin/bitcoin/pull/14426

ACKs for commit 0b3a65:
  practicalswift:
    utACK 0b3a65455a
  promag:
    utACK 0b3a654.

Tree-SHA512: 0175195b88e63d3d44ffac2b8cc87ae7b285a45ed4e49605bca0cc82db073006c22024ef9c2f287980d357dac1099f798f1eeaa0bd75bb7a625919dc1632366c
2019-04-11 15:57:13 +02:00
Jon Atack 140bbeec45
doc: describe onlynet option in doc/tor.md
as per http://www.erisian.com.au/bitcoin-core-dev/log-2019-04-11.html#l-102.

Description adapted from https://github.com/bitcoin/bitcoin/blob/master/src/init.cpp#L429.

Also fixes a typo in doc/dependencies.md.
2019-04-11 14:05:02 +02:00
Gregory Sanders 184f8785f7 wallet_bumpfee.py: add test for change key preservation 2019-04-11 07:21:49 -04:00
Gregory Sanders d08becff85 add functional tests for feerate bumpfee with adding inputs 2019-04-11 07:21:49 -04:00
Gregory Sanders 0ea47ba7b3 generalize bumpfee to add inputs when needed 2019-04-11 07:21:49 -04:00
MeshCollider c536dfbcb0
Merge #15639: bitcoin-wallet tool: Drop libbitcoin_server.a dependency
78a2fb55c bitcoin-wallet tool: Drop libbitcoin_server.a dependency (Russell Yanofsky)
b874747b5 Remove access to node globals from wallet-linked code (Russell Yanofsky)
fbc6bb8e8 bitcoin-wallet tool: Drop MakeChain calls (Russell Yanofsky)

Pull request description:

  Dropping the `bitcoin-wallet` dependency on `libbitcoin_server.a` ensures wallet code can't access node global state, avoiding bugs like https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431

ACKs for commit 78a2fb:
  jnewbery:
    utACK 78a2fb55c9. Nice work, Russ.
  MarcoFalke:
    utACK 78a2fb5
  MeshCollider:
    utACK 78a2fb55c9

Tree-SHA512: ee6ea774f683b936bea66638211dd53c42b8316e1ef03dd58d12fb7ee3891432a43c5c149944173c1e2436aa756b672e1679c39fc10043792ac55cd4d8af2823
2019-04-11 21:29:59 +12:00
MeshCollider f6120d40d5
Merge #15728: [wallet] Refactor relay transactions
7a9046e48 [wallet] Refactor CWalletTx::RelayWalletTransaction() (John Newbery)

Pull request description:

  Refactor `CWalletTx::RelayWalletTransaction()` function.

  This was a suggestion from the wallet-node separation PR: https://github.com/bitcoin/bitcoin/pull/15288#discussion_r256036330, which we deferred until after the main PR was merged.

  There are also makes two minor behavior changes:

  - no longer assert if fBroadcastTransactions is false. Just return false from the function.
  - no longer print the relay message if p2pEnabled is set to false (since the transaction is not actually relayed).

ACKs for commit 7a9046:
  promag:
    utACK 7a9046e48d.
  MeshCollider:
    utACK 7a9046e48d
  ryanofsky:
    utACK 7a9046e48d. No changes at all, just rebase after base PR #15632 was merged

Tree-SHA512: 2ae6214cfadd917a1b3a892c4277e5e57c3eb791e17f67511470e6fbc634d19356554b9f9c55af6b779fdef821914aad59b7cc9e6c13ece145df003bf507d486
2019-04-11 21:25:07 +12:00
MarcoFalke fa8685d49e
test: Use test_bitcoin setup in bench, Add test utils 2019-04-10 15:59:11 -04:00
MarcoFalke 666696b673
test: Have segwit always active in (Basic)TestingSetup 2019-04-10 15:57:48 -04:00
Carl Dong 303372c41a docs: Improve netaddress comments
- Improve IsRFC methods docs
- Improve {Is,Set}Internal docs
- Add tor methods docs
- Add IsIPv{4,6} docs
- Add IsValid docs
- Add IsRoutable docs
- Improve GetGroup docs
- Add CService::GetSockAddr docs
- Add CService::GetKey docs
- Add CSubNet::Match docs
- Add NetmaskBits docs
- Add CNetAddr default constructor docs
2019-04-10 11:48:47 -04:00
John Newbery 1b46a4889f [cleanup] Remove unused CReserveKey 2019-04-10 11:44:40 -04:00
John Newbery 9819ad6d07 [rpc] simplify generate RPC
Removes dead code from after the generate method was removed
2019-04-10 11:44:37 -04:00
Russell Yanofsky 78a2fb55c9 bitcoin-wallet tool: Drop libbitcoin_server.a dependency
This ensures wallet code doesn't access node global state, avoiding bugs like
https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431
2019-04-10 09:51:37 -04:00
Wladimir J. van der Laan 6a135fbe5b
Merge #15638: Move-only: Pull wallet code out of libbitcoin_server
4d074e84a2 [build] Move AnalyzePSBT from psbt.cpp to node/psbt.cpp (Russell Yanofsky)
fd509bd1f7 [docs] Document src subdirectories and different libraries (John Newbery)
9eaeb7fb8d [build] Move wallet load functions to wallet/load unit (John Newbery)
91a25d1e71 [build] Add several util units (John Newbery)
99517866b6 [build] Move several units into common libraries (John Newbery)
0509465542 [build] Move rpc rawtransaction util functions to rpc/rawtransaction_util.cpp (John Newbery)
1acc61f874 [build] Move rpc utility methods to rpc/util (John Newbery)
4a75c9d651 [build] Move policy settings to new src/policy/settings unit (John Newbery)
fdf8888b6f [build] Move CheckTransaction from lib_server to lib_consensus (John Newbery)

Pull request description:

  This is a move-only commit. No code is changing and the moves can be easily verified with:

  ```sh
  git log -p -n1 --color-moved=dimmed_zebra
  ```

  This commit moves functions and variables that wallet code depends on out of libbitcoin_server.a, so the bitcoin-wallet tool can be built without libbitcoin_server.a in #15639, and attempting to access server state from wallet code will result in link errors instead of silently broken code.

  List of moves:

  - `CheckTransaction` moves from `consensus/tx_verify.cpp` to `consensus/tx_check.cpp`
  - `urlDecode` moves from `httpserver.cpp` to `util/url.cpp`
  - `TransactionErrorString` moves from `node/transaction.cpp` to `util/error.cpp`
  - `StringForFeeReason` and `FeeModeFromString` move from `policy/fees.cpp` to `util/fees.cpp`
  - `incrementalRelayFee` `dustRelayFee` and `nBytesPerSigOp` move from `policy/policy.cpp` to `policy/settings.cpp`
  - `SignalsOptInRBF` moves from `policy/rbf.cpp` to `util/rbf.cpp`
  - `fIsBareMultisigStd` moves from `validation.cpp` to `policy/settings.cpp`
  - `ConstructTransaction` `TxInErrorToJSON` and `SignTransaction` move from `rpc/rawtransaction.cpp` to `rpc/rawtransaction_util.cpp`
  - `RPCTypeCheck` `RPCTypeCheckArgument` `RPCTypeCheckObj` `AmountFromValue` `ParseHashV``ParseHashO` `ParseHexV` `ParseHexO` `HelpExampleCli` and `HelpExampleRpc` move from `rpc/server.cpp` to `rpc/util.cpp`
  - `AmountHighWarn` and `AmountErrMsg` move from `ui_interface.cpp` to `util/error.cpp`
  - `FormatStateMessage` and `strMessageMagic` move from `validation.cpp` to `util/validation.cpp`
  - `VerifyWallets` `LoadWallets` `StartWallets` `FlushWallets` `StopWallets` and `UnloadWallets` move from `wallet/init.cpp` to `wallet/node.cpp`

ACKs for commit 4d074e:
  jnewbery:
    utACK 4d074e84a2 (checked by doing the rebase myself and verifying no difference between my branch and 4d074e84a2)

Tree-SHA512: 5e1604a9fb06475f2b96da0de0baa8330f4dda834dc20a0183ef11e1e4c27631d1d1bbb9abf0054efc03d56945fdf9920f63366b6a4f200f665b742a479ff75c
2019-04-10 15:51:37 +02:00
Russell Yanofsky b874747b51 Remove access to node globals from wallet-linked code
Remove last few instances of accesses to node global variables from wallet
code. Also remove accesses to node globals from code in policy/policy.cpp that
isn't actually called by wallet code, but does get linked into wallet code.

This is the last change needed to allow bitcoin-wallet tool to be linked
without depending on libbitcoin_server.a, to ensure wallet code doesn't access
node global state and avoid bugs like
https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431
2019-04-10 09:51:37 -04:00
Russell Yanofsky fbc6bb8e83 bitcoin-wallet tool: Drop MakeChain calls
Pass null Chain interface pointer to CWallet. This is needed to drop
libbitcoin_server dependency and avoid linking node code.
2019-04-10 09:51:37 -04:00
MarcoFalke e3a0688f82
Merge #15659: [docs] fix findFork comment
c968780785 [docs] fix comment: the return value of findFork is _not_ an ancestor when the specified block is on the active chain (r8921039)

Pull request description:

  The return value of findFork is an ancestor of the specified block only when specified block is _not_ on the active chain. When it is on the active chain, the return value is the specified block itself, not an ancestor of it.

ACKs for commit c96878:
  promag:
    utACK c968780, however comment could be shorter.
  ryanofsky:
    utACK c968780785. Only change since last review is squash

Tree-SHA512: bb05d734059898784c4a59b5b0344719eb4dfb2d49a0f7f705fcb2eb630702e66be81c01299185faf0c219fa9f9aa64cbdf6d5f91e0b3dce0ff420909a454a18
2019-04-10 09:34:02 -04:00
MarcoFalke e82f6ad6f2
Merge #15754: rpc: getrpcinfo docs
f4b7a2f205 rpc: getrpcinfo docs (Ben Carman)

Pull request description:

  Fixes #15731

ACKs for commit f4b7a2:
  laanwj:
    utACK f4b7a2f205

Tree-SHA512: 45dce83c4bfac2ddf85133a29aee332e9de8f73c15438ce899a2edbcd0d82d4f743753f6699c50cbc62d110fa8c6bc257722447e1090cdd23acbe00f26014ec8
2019-04-10 09:24:22 -04:00
John Newbery 7a9046e48d [wallet] Refactor CWalletTx::RelayWalletTransaction()
This refactors the CWalletTx::RelayWalletTransaction() function to be
clearer and adds comments. It also makes two minor behavior
changes:

- no longer assert if fBroadcastTransactions is false. Just return false
from the function.
- no longer print the relay message if p2pEnabled is set to false (since
the transaction is not actually relayed).
2019-04-10 09:19:55 -04:00
Peter Bushnell 0b3a65455a Avoid redefine warning 2019-04-10 12:16:52 +01:00