Commit graph

13317 commits

Author SHA1 Message Date
MarcoFalke c83442e174
Merge #15654: net: Remove unused unsanitized user agent string CNode::strSubVer
fa8548c5d1 net: Remove unused unsanitized user agent string CNode::strSubVer (MarcoFalke)

Pull request description:

  I fail to see a use case for this unsanitized byte array. In fact this can easily be confused with `cleanSubVer` and be displayed to the user (or logged) by a simple typo that is hard to find in review.

  Further reading: https://btcinformation.org/en/developer-reference#version

ACKs for commit fa8548:
  promag:
    utACK fa8548c, good catch.
  practicalswift:
    utACK fa8548c5d1
  sipa:
    utACK fa8548c5d1

Tree-SHA512: 3c3ff1504d1583ad099df9a6aa761458a82ec48a58ef7aaa9b5679a5281dd1b59036ba2932ed708488951a565b669a3083ef70be5a58472ff8677b971162ae2f
2019-04-04 16:45:23 -04:00
Pieter Wuille 6e597001a4 Import all origin info in importmulti; even for non-importing pubkeys 2019-04-04 12:48:42 -07:00
Pieter Wuille 9a93c91c88 Keep full pubkeys in FlatSigningProvider::origins 2019-04-04 12:45:32 -07:00
MarcoFalke fa57411fcb
wallet: Get all balances in one call 2019-04-04 13:22:08 -04:00
MarcoFalke daef20fb50
Merge #15596: rpc: Ignore sendmany::minconf as dummy value
fabfb79673 doc: Add release notes for 15596 (MarcoFalke)
fac1a0fe54 wallet: Remove unused GetLegacyBalance (MarcoFalke)
faa3a246e8 scripted-diff: wallet: Rename pcoin to wtx (MarcoFalke)
fae5f874d5 rpc: Document that minconf is an ignored dummy value (MarcoFalke)

Pull request description:

  Other RPCs such as `sendtoaddress` don't have this option at all and `sendmany` should by default spend from (lets say) our change.

ACKs for commit fabfb7:
  jnewbery:
    utACK fabfb79673
  ryanofsky:
    utACK fabfb79673. Nice writeup! Release notes are only change since previous review.

Tree-SHA512: 2526ead2330be7c2beb78b96bc5e55440566c4a3a809bbbd66f5c9fc517f6890affa5d14005dc102644d49679a374510f9507255e870cf88aaa63e429beef658
2019-04-04 13:17:31 -04:00
MarcoFalke fa26eb5e8f
rpc: RPCHelpMan: Always push_name when outer type is an object 2019-04-04 10:49:09 -04:00
MarcoFalke fa652b229e
rpc: Add some doxygen comments to utils 2019-04-04 10:41:36 -04:00
MarcoFalke ba54342c9d
Merge #15685: doc: rpc-mining: Clarify error messages
fa292adce9 doc: rpc-mining: Clarify error messages (MarcoFalke)

Pull request description:

  Fixes #13274

ACKs for commit fa292a:
  fanquake:
    tACK fa292ad

Tree-SHA512: 58946a52ce49b97c35cbf5eaa9175447a231690cb2bac0d39e5db524bdf2cbad274a905038aca270c080d5660f58176d43c01a22a8417c0f5b8276816939c1d6
2019-04-03 12:17:58 -04:00
MarcoFalke 8dbb2c5e67
Merge #15680: Remove resendwallettransactions RPC method
ea1a2d8794 [wallet] Remove ResendWalletTransactionsBefore (John Newbery)
f5162458cd [rpc] remove resendwallettransactions RPC (John Newbery)

Pull request description:

  Remove resendwallettransactions RPC method

  This RPC was added for testing wallet rebroadcasts. Since we now have a real test for wallet rebroadcasts, it's no longer needed.

  The call in wallet_basic.py can be removed because wallet_resendwallettransactions.py tests wallet rebroadcast.

ACKs for commit ea1a2d:
  MarcoFalke:
    re-utACK ea1a2d8794
  promag:
    utACK ea1a2d8.

Tree-SHA512: 48245d947be1a2d2b8c30d2946105818c454a03b70b63534ecadf2144da64dafe1c9527ea670a5f4d1acd05ccdfc6c9be43ca636ee2ba58a8b7a7b2fc7bc88fd
2019-04-02 10:30:57 -04:00
MarcoFalke 5a2a9b5b06
Merge #15652: wallet: Update transactions with current mempool after load
4bf1b1cefa qa: Check unconfirmed balance after loadwallet (João Barbosa)
2ebf650b2e wallet: Update transactions with current mempool after load (João Barbosa)
57908a739c interfaces: Add Chain::requestMempoolTransactions (João Barbosa)
0440481c6b wallet: Move CWallet::ReacceptWalletTransactions locks to callers (João Barbosa)

Pull request description:

  Fixes #15591.

ACKs for commit 4bf1b1:
  MarcoFalke:
    re-utACK 4bf1b1cefa
  jnewbery:
    utACK 4bf1b1cefa

Tree-SHA512: 604b1057c7f9fc3772084bf6914e52dd1a68a1cfd365f907e8ec78f6f5f726bc56a3cad9f2b665642714fbf3d51e37c1184ac396460bddeafd918e8f9f7af392
2019-04-01 15:27:02 -04:00
MarcoFalke 35477e9e4e
Merge #15644: Make orphan processing interruptible
866c8058a7 Interrupt orphan processing after every transaction (Pieter Wuille)
6e051f3d32 [MOVEONLY] Move processing of orphan queue to ProcessOrphanTx (Pieter Wuille)
9453018fdc Simplify orphan processing in preparation for interruptibility (Pieter Wuille)

Pull request description:

  As individual orphan transactions can be relatively expensive to handle, it's undesirable to process all of them (max 100) as soon as the parent becomes available, as it pegs the net processing the whole time.

  Change this by interrupting orphan handling after every transactions, and continue in the next processing slot of the peer that gave us the parent - similar to how getdata processing works now. Messages from other peers arriving in the mean time are processed normally, but other messages from the peer that gave us the parent have to wait until all orphan processing is done.

ACKs for commit 866c80:
  sdaftuar:
    ACK 866c8058a7
  MarcoFalke:
    utACK 866c8058a7
  promag:
    utACK 866c805. Verified refactor in 9453018fdc and moved code in 6e051f3d32. Not so sure about change in 866c8058a7 just because I'm not familiar with net processing.

Tree-SHA512: d8e8a1ee5f2999446cdeb8fc9756ed9c24f3d5cd769a7774ec4c317fc8d463fdfceec88de97266f389b715a5dfcc2b0a3abaa573955ea451786cc43b870e8cde
2019-04-01 11:09:40 -04:00
John Newbery ea1a2d8794 [wallet] Remove ResendWalletTransactionsBefore
This is only called from ResendWalletTransactions(), so bring it inline.
2019-04-01 11:07:31 -04:00
MarcoFalke faf62d9415
gui: Generate bech32 addresses by default 2019-03-31 17:56:12 -04:00
João Barbosa 2ebf650b2e wallet: Update transactions with current mempool after load 2019-03-31 11:37:41 +01:00
João Barbosa 57908a739c interfaces: Add Chain::requestMempoolTransactions 2019-03-31 11:37:28 +01:00
MarcoFalke 79c345a011
Merge #15669: rpc: Fix help text for signtransactionwithXXX
afc06fc868 rpc: Fix help text for signtransactionwithXXX (Torkel Rogstad)

Pull request description:

  This PR fixes the help text for the `signrawtransactionwithwallet` and `signrawtransactionwithkey` RPC calls. They both marked the `amount` field in the UTXO dependencies as required. This field is omitted in the [`rpc_rawtransaction.py` test](8a8b03ecd2/test/functional/rpc_rawtransaction.py (L155)) and [`successful_signing_test`](8a8b03ecd2/test/functional/rpc_signrawtransaction.py (L42)) in `rpc_signrawtransaction.py`.

ACKs for commit afc06f:
  promag:
    utACK afc06fc.
  MarcoFalke:
    utACK afc06fc868

Tree-SHA512: 7847844ca38d8033fef2f5255700d21487d78a63ecee8b80362fa28fadfafc80ba29a89f38d7ebb3a1be4c7d47ff6c338f67afec9ee22bf065fb352bb3d03d3a
2019-03-29 18:26:00 -04:00
John Newbery f5162458cd [rpc] remove resendwallettransactions RPC
This RPC was added for testing wallet rebroadcasts. Since we now have a
real test for wallet rebroadcasts, it's no longer needed.

The call in wallet_basic.py can be removed because
wallet_resendwallettransactions.py tests wallet rebroadcast.
2019-03-29 15:06:59 -04:00
MarcoFalke 0baf4b1f96
Merge #15683: Comment for seemingly duplicate LIBBITCOIN_SERVER
2a1408c3ec Comment for seemingly duplicate LIBBITCOIN_SERVER (Peter Bushnell)

Pull request description:

  Added a comment to explain the addition of LIBBITCOIN_SERVER twice in bitcoind_LDADD which seems incorrect at a glance until the behaviour of Linux linkers is understood.

ACKs for commit 2a1408:
  practicalswift:
    ACK 2a1408c3ec
  MarcoFalke:
    ACK 2a1408c
  fanquake:
    utACK 2a1408c
  ryanofsky:
    utACK 2a1408c3ec

Tree-SHA512: dd2a7f61d53ce8882a56c831c32e1f48e9eab741ef21361f195c38bb455abdc4bc524d3b44b6f69c7498898cd871a23c39d215de28db3b20ef5fd2135d5e136a
2019-03-29 13:21:24 -04:00
Jonas Schnelli edc68d40e9
Merge #15663: crypto: Remove unused AES-128 code
f6ee177f7 Remove unused AES-128 code (practicalswift)

Pull request description:

  Remove unused AES-128 code.

  As far as I can tell this AES-128 code has never been in use in the project (outside of testing/benchmarking).

  The AES-256 code is used in `CCrypter::Encrypt`/`CCrypter::Decrypt` (`src/wallet/crypter.cpp`).

  Trivia: 0.15% of the project's C++ LOC count (excluding dependencies) is trimmed off:

  ```
  $ LOC_BEFORE=$(git grep -I "" HEAD~1 -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" | wc -l)
  $ LOC_AFTER=$(git grep -I "" -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" | wc -l)
  $ bc <<< "scale=4; ${LOC_AFTER}/${LOC_BEFORE}"
  .9985
  ```

  :-)

Tree-SHA512: 9588a3cd795a89ef658b8ee7323865f57723cb4ed9560c21de793f82d35e2835059e7d6d0705e99e3d16bf6b2a444b4bf19568d50174ff3776caf8a3168f5c85
2019-03-29 10:22:24 +01:00
Peter Bushnell 2a1408c3ec Comment for seemingly duplicate LIBBITCOIN_SERVER 2019-03-28 15:31:42 +00:00
MarcoFalke 9e7dc682e0
Merge #15616: rpc: Clarify decodescript RPCResult doc
fa926ec24f rpc: Mention all output types in decodescript doc (MarcoFalke)
fa3caa1666 rpc: decodescript use IsValidNumArgs over hardcoded check (MarcoFalke)
faad33ff15 rpc: Clarify decodescript RPCResult doc (MarcoFalke)

Pull request description:

  * Remove `"hex"` from the decodescript RPCResult doc
  * Add `"segwit`" to the doc

  Follow up to a6099ef319 and 4f933b3d23

ACKs for commit fa926e:
  ryanofsky:
    utACK fa926ec24f. Only change since last review is listing possible output types in the help string using a new `GetAllOutputTypes` function

Tree-SHA512: e6ecc563d04769942567118d50188467bf64ceb276ba6268928d469e8f06621f2ca1ae1e555d3daa6ec22a615ee259bb31c4141c19818d0f53fb6c529b18381b
2019-03-28 10:56:56 -04:00
MarcoFalke fa292adce9
doc: rpc-mining: Clarify error messages 2019-03-28 09:35:32 -04:00
Torkel Rogstad afc06fc868 rpc: Fix help text for signtransactionwithXXX 2019-03-28 08:54:37 +01:00
João Barbosa 0440481c6b wallet: Move CWallet::ReacceptWalletTransactions locks to callers 2019-03-27 16:59:47 +00:00
MarcoFalke 656a15e539
Merge #15620: rpc: Uncouple non-wallet rpcs from maxTxFee global
fa1ad200d3 doc: Add release notes for 15620 (MarcoFalke)
fa96d76421 rpc: Uncouple rpcs from maxTxFee global (MarcoFalke)
fa965e03c7 rpc: Use IsValidNumArgs over hardcoded size checks (MarcoFalke)

Pull request description:

  This makes the rpcs a bit more stateless by falling back to their own default max fee instead of the global maxTxFee.

  A follow up pull request will move `-maxtxfee` to the wallet.

  See also related discussions:

  * `-maxtxfee` should not be used by both node and wallet #15355
  *  [RFC] Long term plan for wallet command-line args #13044

ACKs for commit fa1ad2:
  jnewbery:
    utACK fa1ad200d3
  Empact:
    utACK fa1ad200d3
  jnewbery:
    utACK fa1ad200d3
  promag:
    utACK fa1ad20.

Tree-SHA512: c9cf0b54cd30ff3ab0d090b072cc38fcbb2840bc6ad9a9711995333bc927d2500aece6b5a60e061666eca5ed72b70aa318d21e51eb15ee0106b41f5b6e4e1adf
2019-03-27 09:01:53 -04:00
Wladimir J. van der Laan 208406038c
Merge #15519: Add Poly1305 implementation
e9d5e97561 Poly1305: tolerate the intentional unsigned wraparound in poly1305.cpp (Jonas Schnelli)
b34bf302f2 Add Poly1305 bench (Jonas Schnelli)
03be7f48fa Add Poly1305 implementation (Jonas Schnelli)

Pull request description:

  This adds a currently unused Poly1305 implementation including test vectors from RFC7539.

  Required for BIP151 (and related to #15512).

Tree-SHA512: f8c1ad2f686b980a7498ca50c517e2348ac7b1fe550565156f6c2b20faf764978e4fa6b5b1c3777a16e7a12e2eca3fb57a59be9c788b00d4358ee80f2959edb1
2019-03-27 11:53:15 +01:00
Glenn Willen 892eff05f1 Add documentation of struct PSBTAnalysis et al 2019-03-26 17:38:00 -07:00
Glenn Willen ef22fe8c1f Refactor analyzepsbt for use outside RPC code
Refactor the analyzepsbt RPC into (1) an AnalyzePSBT function, which returns
its output as a new strongly-typed PSBTAnalysis struct, and (2) a thin wrapper
which converts the struct into a UniValue for RPC use.
2019-03-26 17:38:00 -07:00
Glenn Willen afd20a25f2 Move PSBT decoding functions from core_io to psbt.cpp
Move PSBT decoding functions from core_io.h/core_read.cpp to psbt.h/psbt.cpp,
to deal with a linker issue.
2019-03-26 17:38:00 -07:00
Jonas Schnelli b34bf302f2
Add Poly1305 bench 2019-03-26 18:12:31 +01:00
Jonas Schnelli 03be7f48fa
Add Poly1305 implementation 2019-03-26 18:12:29 +01:00
r8921039 c968780785 [docs] fix comment: the return value of findFork is _not_ an ancestor when the specified block is on the active chain
update with suggested comment text from the reviewers
2019-03-25 14:28:05 -07:00
practicalswift f6ee177f7d Remove unused AES-128 code 2019-03-25 14:46:30 +01:00
Miguel Herranz e16b6a7188
rpc: Rename size to vsize in mempool related calls 2019-03-24 12:01:43 +08:00
MarcoFalke fa8548c5d1
net: Remove unused unsanitized user agent string CNode::strSubVer 2019-03-23 11:32:40 -04:00
Pieter Wuille 866c8058a7 Interrupt orphan processing after every transaction
This makes orphan processing work like handling getdata messages:
After every actual transaction validation attempt, interrupt
processing to deal with messages arriving from other peers.
2019-03-22 19:25:50 -07:00
Pieter Wuille 6e051f3d32 [MOVEONLY] Move processing of orphan queue to ProcessOrphanTx 2019-03-22 19:21:58 -07:00
Pieter Wuille 9453018fdc Simplify orphan processing in preparation for interruptibility 2019-03-22 19:10:22 -07:00
MarcoFalke fae38c3dc6
doc: Fix all typos reported by codespell 2019-03-22 13:19:44 -04:00
John Newbery 7b6616b78b [rpc] Remove deprecated functionality message from validateaddress help
This functionality was removed in v0.18.
2019-03-22 10:30:25 -04:00
John Newbery 839c3f7c49 [rpc] Remove signrawtransaction warning
signrawtransaction was deprecated in 0.17 and removed in 0.18. A warning
was left in place to tell users to migrate to using
signrawtransactionswithwallet or signrawtransactionwithkey. Remove the
warning now that it's been two releases since the method was removed.
2019-03-22 10:30:25 -04:00
João Barbosa a10972bc03 gui: Defer removeAndDeleteWallet when no modal widget is active 2019-03-22 09:51:04 +00:00
MeshCollider 717fd58c4b
Merge #15625: refactor: Remove unused function
bb6195e34 refactor: Remove unused function (practicalswift)

Pull request description:

  Last use removed in cad5dd2368.

Tree-SHA512: f65bf8f77b9aadbfba39bd80076a4d773eddf685a8a90ef2db549552a3d0ccd426ce3920b2f71954703f64d840fa88349957996d1f64a9c4d3f27a99b4da70e7
2019-03-21 21:00:25 +13:00
MeshCollider 2607d960a0
Merge #10973: Refactor: separate wallet from node
d358466de Remove remaining wallet accesses to node globals (Russell Yanofsky)
b1b2b2389 Remove use of CCoinsViewMemPool::GetCoin in wallet code (Russell Yanofsky)
4e4d9e9f8 Remove use of CRPCTable::appendCommand in wallet code (Russell Yanofsky)
91868e628 Remove use CValidationInterface in wallet code (Russell Yanofsky)

Pull request description:

  This PR is the last in a chain of PRs (#14437, #14711, and #15288) that make the wallet code access node state through an abstract [`Chain`](https://github.com/ryanofsky/bitcoin/blob/pr/wipc-sep/src/interfaces/chain.h) class in [`src/interfaces/`](https://github.com/ryanofsky/bitcoin/tree/pr/wipc-sep/src/interfaces) instead of using global variables like `cs_main`, `chainActive`, and `g_connman`. After this PR, wallet code no longer accesses global variables declared outside the wallet directory, and no longer calls functions accessing those globals (as verified by the `hide-globals` script in #10244).

  This PR and the previous PRs have been refactoring changes that do not affect behavior. Previous PRs have consisted of lots of mechanical changes like:

  ```diff
  -    wtx.nTimeReceived = GetAdjustedTime();
  +    wtx.nTimeReceived = m_chain->getAdjustedTime();
  ```

  This PR is smaller, but less mechanical. It replaces last few bits of wallet code that access node state directly (through `CValidationInterface`, `CRPCTable`, and `CCoinsViewMemPool` interfaces) with code that uses the `Chain` interface.

  These changes allow followup PR #10102 (multiprocess gui & wallet PR) to work without any significant updates to wallet code. Additionally they:

  * Provide a single place to describe the interface between wallet and node code.
  * Can make better wallet testing possible, because the `Chain` object consists of virtual methods that can be overloaded for mocking. (This could be used to test edge cases in the rescan code, for example).

Tree-SHA512: e6291d8a3c50bdff18a9c8ad11e729beb30b5b7040d7aaf31ba678800b4a97b2dd2be76340b1e5c01fe2827d67d37ed1bb4c8380cf8ed653aadfea003e9b22e7
2019-03-21 20:58:43 +13:00
Wladimir J. van der Laan b3f82284ba
Merge #15597: net: Generate log entry when blocks messages are received unexpectedly
ef0019e054 Generate log entry when blocks messages are received unexpectedly. (Patrick Strateman)

Pull request description:

  Currently these are incorrectly logged as an unknown command.

Tree-SHA512: dd272388a90b79897f8c1ea6d4c949323fcf75493f3a5b2ec9a26a2cf6a8ee743b497941702f21df8fae0f5b9481444363643379832dbd5053b0cc0b0363de04
2019-03-20 20:36:25 +01:00
MarcoFalke 93623eea71
Merge #15623: refactor: Expose UndoReadFromDisk in header
fa11c036e9 refactor: Expose UndoReadFromDisk in header (MarcoFalke)

Pull request description:

  It is not possible to calculate the fee of a non-mempool transaction in RPCs unless txindex is active or the prevtxs are passed in through the RPC.

  Fix that issue for confirmed txs by exposing `UndoReadFromDisk` in the header file.

  This pull is a requirement for
  * rpc: faster getblockstats using BlockUndo data #14802
  *  Index for BIP 157 block filters #14121
  * my local patches

Tree-SHA512: 859ea5f2dfb4feac612b50faeb0e2b6c07b83f1d983e519d7647a78058d85c0390fd09ec66b460ae7a4c3b273e81b0013ee9f4bb8dfba0c4782ffaa1fa453ea6
2019-03-20 12:28:18 -04:00
Wladimir J. van der Laan 81f732bcaa
Merge #15617: p2p: Do not relay banned IP addresses
054d01d0a8 Do not relay banned IP addresses (Pieter Wuille)

Pull request description:

Tree-SHA512: 538c43781c789949e1ae566533e76835d478e40e8ba6427b22234ee611cb4a311b2940a214e37c1e9c9afe28a6814a00d490a39e3580bb5ebd85b03e95040246
2019-03-20 11:38:08 +01:00
practicalswift bb6195e34d refactor: Remove unused function 2019-03-20 10:51:15 +01:00
MarcoFalke fa1ad200d3
doc: Add release notes for 15620 2019-03-19 17:06:43 -04:00
MarcoFalke dddd6f0f58
init: Throw error when network specific config is ignored 2019-03-19 16:30:07 -04:00
MarcoFalke fa926ec24f
rpc: Mention all output types in decodescript doc 2019-03-19 15:54:39 -04:00
MarcoFalke fa11c036e9
refactor: Expose UndoReadFromDisk in header 2019-03-19 14:20:43 -04:00
Wladimir J. van der Laan e45b7f20e6
Merge #15618: refactor: Remove unused function
fa5c511a83 refactor: Remove unused function (MarcoFalke)

Pull request description:

  Oversight of kallewoof and mine in https://github.com/bitcoin/bitcoin/pull/13541#discussion_r266555476

Tree-SHA512: 2fd3c4ecde5d3c58b113aa58d606976ceb4998358bde0547ead8e83df210722fa9821d2c88b717bdd190ef71593cd9c0154c3a5d3f2ccc3af8cbf6c36aaa6d45
2019-03-18 20:06:11 +01:00
MarcoFalke fa96d76421
rpc: Uncouple rpcs from maxTxFee global 2019-03-18 13:56:56 -04:00
MarcoFalke fa965e03c7
rpc: Use IsValidNumArgs over hardcoded size checks 2019-03-18 13:55:19 -04:00
MarcoFalke fa5c511a83
refactor: Remove unused function 2019-03-18 13:30:55 -04:00
MarcoFalke c033c4b5ce
Merge #13541: wallet/rpc: sendrawtransaction maxfeerate
7abd2e697c wallet/rpc: add maxfeerate parameter to testmempoolaccept (Karl-Johan Alm)
6c0a6f73e3 wallet/rpc: add maxfeerate parameter to sendrawtransaction (Karl-Johan Alm)
e5efacb941 test: Refactor vout fetches in rpc_rawtransaction (Karl-Johan Alm)

Pull request description:

  This adds a new `maxfeerate` parameter to `sendrawtransaction` which forces the node to reject a transaction whose feerate is above the given fee rate.

  This is a safety harness from shooting yourself in the foot and accidentally overpaying fees.

  See also #12911.

Tree-SHA512: efa50134a7c17c9330cfdfd48ba400e095c0a419cc45e630618d8b44929c25d780d1bb2710c1fbbb6e687eca373505b0338cdaa7f2ff4ca22636d84c31557a2e
2019-03-18 13:22:15 -04:00
Carl Dong 340ef50772 depends: Defer to Python detected by autoconf
Since autoconf already detects the correct python binary path, we should
use that instead of going around it. Also has the benefit of working in
extremely restricted environments where /usr/bin/env might not be
available.
2019-03-18 11:05:17 -04:00
MeshCollider 7ec7aea442
Merge #15491: wallet: Improve log output for errors during load
faf369880 wallet: Improve log output for errors during load (Glenn Willen)

Pull request description:

  When loading the wallet, display the entire path in error messages, instead of
  the name (which, for the default wallet, is the empty string.)

  When an exception occurs during wallet loading, display e.what() if possible,
  instead of nothing.

Tree-SHA512: 435247628db669579bb694ba4b53ba174fe42c0329fc72f09fc274bb28463ee69f53412abb2a3b45bb8f59f7eb928c0167e397b8d0a514135142192a87294614
2019-03-18 20:34:55 +13:00
Pieter Wuille 054d01d0a8 Do not relay banned IP addresses 2019-03-17 22:05:49 -07:00
MarcoFalke fa3caa1666
rpc: decodescript use IsValidNumArgs over hardcoded check 2019-03-17 22:52:18 -04:00
MarcoFalke faad33ff15
rpc: Clarify decodescript RPCResult doc 2019-03-17 22:51:33 -04:00
Wladimir J. van der Laan 2f501fb5c6
Merge #15522: Document sizeof(size_t) assumptions and compiler assumptions in assumptions.h
c7a7250302 Document assumptions about C++ compiler (practicalswift)
c7ea8d3236 Add sizeof(size_t) assumptions (practicalswift)

Pull request description:

  Document `sizeof(size_t)` assumptions and compiler assumptions by adding compile-time checks in `assumptions.h`.

Tree-SHA512: db46481eecad6a87718ae637a7761d39d32cfe6f95fc8ad2b3a52a3d966c2a05c8f540dd3f362721279816571b04b6cce2de9b3b1d17606d7b197126cd4a8d1f
2019-03-16 17:11:14 +01:00
Glenn Willen faf3698808 wallet: Improve log output for errors during load
When loading the wallet, display the entire path in error messages, instead of
the name (which, for the default wallet, is the empty string.)

When an exception occurs during wallet loading, display e.what() if possible,
instead of nothing.
2019-03-14 18:49:19 -07:00
MarcoFalke fac1a0fe54
wallet: Remove unused GetLegacyBalance 2019-03-14 16:05:13 -04:00
MarcoFalke faa3a246e8
scripted-diff: wallet: Rename pcoin to wtx
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/const CWalletTx ?\* ?pcoin = &/const CWalletTx\& wtx = /g' src/wallet/wallet.cpp
sed -i -e 's/\<pcoin->/wtx./g' src/wallet/wallet.cpp
sed -i -e 's/\<pcoin\>/\&wtx/g' src/wallet/wallet.cpp
-END VERIFY SCRIPT-
2019-03-14 16:03:53 -04:00
Wladimir J. van der Laan 7fa1f6258c
Merge #15583: wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree
15c69b158d wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree (João Barbosa)

Pull request description:

  Use the `noexcept` members of `boost::filesystem::recursive_directory_iterator` in order to ignore `boost::filesystem::directory_iterator::construct: Permission denied` errors. The errors are logged though.

  Steps to reproduce the issue:

  ```sh
  # 1. create directory for -walletdir without read access:
  mkdir /tmp/foo && chmod a-r /tmp/foo

  # 2. run bitcoin-qt and should print an error, but continues running:
  /Volumes/Bitcoin-Core/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -regtest -walletdir=/tmp/foo
  /private/tmp/foo: Permission denied

  # 4. go to File -> Open Wallet and should segfault:
  EXCEPTION: N5boost10filesystem16filesystem_errorE
  boost::filesystem::directory_iterator::construct: Permission denied: "/private/tmp/foo"
  bitcoin in Runaway exception
  ```

Tree-SHA512: 37e8bf5a1e0defc331030fd511bf9cac2765d01dfbf23e7233f37506e85b8ad07edcde9ba6dae7a2c95700c78d28c7dd248153607381852da96273cb159c4934
2019-03-14 18:58:43 +01:00
Patrick Strateman ef0019e054 Generate log entry when blocks messages are received unexpectedly. 2019-03-13 21:05:15 -04:00
Karl-Johan Alm 6c0a6f73e3
wallet/rpc: add maxfeerate parameter to sendrawtransaction 2019-03-14 08:48:46 +09:00
Karl-Johan Alm 7abd2e697c
wallet/rpc: add maxfeerate parameter to testmempoolaccept 2019-03-14 08:48:46 +09:00
João Barbosa 15c69b158d wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree 2019-03-13 20:41:42 +00:00
MarcoFalke fae5f874d5
rpc: Document that minconf is an ignored dummy value 2019-03-13 14:43:55 -04:00
Wladimir J. van der Laan 8e1704c015
Merge #15559: doc: correct analyzepsbt rpc doc
335931df4a rpc: return a number for estimated_feerate in analyzepsbt (fanquake)
a4d0fd026b doc: correct analysepsbt rpc doc (fanquake)

Pull request description:

  Even though `missing` is optional, all its field are also all optional.

  `estimated_vsize` is optional (calculate alongside `estimated_feerate`).

  Make `estimated_feerate` output numeric.

Tree-SHA512: 5e063bcfbca73d3d08d29c5d1f59bc1791757f69248da4a9c70fe4b2fe82807ec4ed9fca48d439101d66ba924916fa5da9232167d74ea2b967fc04f0a36f190e
2019-03-13 12:18:19 +01:00
Wladimir J. van der Laan c3b1cb958f
Merge #15573: dead code: Remove dead option in HexStr conversion
56f1d28d9b dead code: Remove dead option in HexStr conversion (Lenny Maiorani)

Pull request description:

  Problem:
  - Nothing uses the `fspaces` argument to `HexStr()` besides unit
    tests. This argument results in extra complexity and a small
    performance decrease within the function.

  Solution:
  - Remove unused `fspaces` option.
  - Remove associated unit tests.

Tree-SHA512: 33d00ce354bbc62a77232fa301cdef0a9ed2c5a09e792bc40e9620c2f2f88636e322a38c76b81d10d12a1768dd1b3b2b9cf180f7e33daef9b4f27afed68ccf70
2019-03-12 13:11:26 +01:00
fanquake 335931df4a
rpc: return a number for estimated_feerate in analyzepsbt 2019-03-12 07:17:42 +08:00
fanquake a4d0fd026b
doc: correct analysepsbt rpc doc 2019-03-12 07:17:22 +08:00
Pieter Wuille c9963ae8b1 Fix overflow bug in analyzepsbt fee: CAmount instead of int 2019-03-11 15:17:05 -07:00
MarcoFalke c94852e791
Merge #15564: cli: remove duplicate wallet fields from -getinfo
3f6568d66b cli: remove duplicate wallet fields from -getinfo (fanquake)

Pull request description:

  `walletversion` and `balance` are both included below.

Tree-SHA512: cd9fe9739a2f492c8f7c0407b43a6fa95187f7e5318f05e080bac112f9f4333d2e9b84c505d098f8d66fa79439007d1c0b22e5a87d70bf5ea53ab647ee4c2046
2019-03-11 10:28:42 -04:00
MarcoFalke 887f57eb72
Merge #15566: cli: replace testnet with chain and return network name as per BIP70.
890396cbd5 cli: replace testnet with chain and return network name as per BIP70. (fanquake)

Pull request description:

  Related IRC discussion [here (line 151)](http://www.erisian.com.au/bitcoin-core-dev/log-2019-03-09.html).

Tree-SHA512: 8bdbacc7b8ce8bd2cc7c47aa9d73f2830a7c2e2ec43686430e3fba1a9db0e53a285467f26cde6dcc3bf948b7d6d59b9b7f184ce1a30a8970f39e5396dfc122f0
2019-03-11 10:26:46 -04:00
Lenny Maiorani 56f1d28d9b dead code: Remove dead option in HexStr conversion
Problem:
- Nothing uses the `fspaces` argument to `HexStr()` besides unit
  tests. This argument results in extra complexity and a small
  performance decrease within the function for branch evalulation.

Solution:
- Remove unused `fspaces` option.
2019-03-10 21:45:31 -06:00
fanquake 3f6568d66b
cli: remove duplicate wallet fields from -getinfo 2019-03-09 16:40:46 +08:00
fanquake 890396cbd5
cli: replace testnet with chain and return network name as per BIP70. 2019-03-09 16:35:26 +08:00
Wladimir J. van der Laan ff38148808
Merge #15486: [addrman, net] Ensure tried collisions resolve, and allow feeler connections to existing outbound netgroups
20e6ea259b [addrman] Improve collision logging and address nits (Suhas Daftuar)
f71fdda3bc [addrman] Ensure collisions eventually get resolved (Suhas Daftuar)
4991e3c813 [net] feeler connections can be made to outbound peers in same netgroup (Suhas Daftuar)
4d834018e3 [addrman] Improve tried table collision logging (Suhas Daftuar)

Pull request description:

  The restriction on outbound peers sharing the same network group is not intended to apply to feeler connections, so fix this.

  This fixes an issue where a tried table collision with an entry to a netgroup we already have an outbound connection to could cause feelers to stop working, because the tried collision buffer (`m_tried_collisions`) would never be drained.

  Also, ensure that all entries don't linger in `m_tried_collisions` by evicting an old entry if its collisions is unresolved after 40 minutes.

Tree-SHA512: 553fe2b01b82cd7f0f62f90c6781e373455a45b254e3bec085b5e6b16690aa9f3938e8c50e7136f19dafa250ed4578a26227d944b76daf9ce4ef0c75802389b6
2019-03-09 07:12:17 +01:00
Wladimir J. van der Laan efed9809b4
Merge #15532: Remove sharp edge (uninit member) when using the compiler-generated ctor for BlockFilter
82c3b3f8e0 Remove sharp edge (uninitialized m_filter_type) when using the compiler-generated constructor for BlockFilter (practicalswift)

Pull request description:

  Remove sharp edge (uninitialised member `m_filter_type`) when using the compiler-generated constructor for `BlockFilter`.

  Before (but after added test):

  ```
  $ src/test/test_bitcoin -t blockfilter_tests/blockfilter_basic_test
  Running 1 test case...
  test/blockfilter_tests.cpp(118): error: in "blockfilter_tests/blockfilter_basic_test": check default_ctor_block_filter_1.GetFilterType() == default_ctor_block_filter_2.GetFilterType() has failed [ != ]

  *** 1 failure is detected in the test module "Bitcoin Test Suite"
  ```

  After:

  ```
  $ src/test/test_bitcoin -t blockfilter_tests/blockfilter_basic_test
  Running 1 test case...

  *** No errors detected
  ```

Tree-SHA512: 21d41f036b0bf12adcf1a788d84747353f2023cb85fd8ea6c97222967032e8bf54e7910cadb45dfcecd78e5b5dca86685f78cad0596b6d1a08f910ebf20d90aa
2019-03-08 15:26:28 +01:00
Jonas Schnelli d211edb349
Merge #15464: gui: Drop unused return values in WalletFrame
28c86de3b gui: Drop unused return values in WalletFrame (João Barbosa)

Pull request description:

  This is a small cleanup since the return value of `WalletFrame` methods are not used. This is in line with the usual async slot declaration.

Tree-SHA512: ff0ca098804118bba200a58cd796ff90e853a6430e58125bd178b7bfa9b2b763c13d17b81e8f3ebd94395cac249d80379ba1529680c47682ba6a2ed81492ba33
2019-03-07 21:04:28 +01:00
Wladimir J. van der Laan 3db0cc3947
Merge #15402: Granular invalidateblock and RewindBlockIndex
519b0bc5dc Make last disconnected block BLOCK_FAILED_VALID, even when aborted (Pieter Wuille)
8d220417cd Optimization: don't add txn back to mempool after 10 invalidates (Pieter Wuille)
9ce9c37004 Prevent callback overruns in InvalidateBlock and RewindBlockIndex (Pieter Wuille)
9bb32eb571 Release cs_main during InvalidateBlock iterations (Pieter Wuille)
9b1ff5c742 Call InvalidateBlock without cs_main held (Pieter Wuille)
241b2c74ac Make RewindBlockIndex interruptible (Pieter Wuille)
880ce7d46b Call RewindBlockIndex without cs_main held (Pieter Wuille)
436f7d735f Release cs_main during RewindBlockIndex operation (Pieter Wuille)
1d342875c2 Merge the disconnection and erasing loops in RewindBlockIndex (Pieter Wuille)
32b2696ab4 Move erasure of non-active blocks to a separate loop in RewindBlockIndex (Pieter Wuille)
9d6dcc52c6 Abstract EraseBlockData out of RewindBlockIndex (Pieter Wuille)

Pull request description:

  This PR makes a number of improvements to the InvalidateBlock (`invalidateblock` RPC) and RewindBlockIndex functions, primarily around breaking up their long-term cs_main holding. In addition:
  * They're made safely interruptible (`bitcoind` can be shutdown, and no progress in either will be lost, though if incomplete, `invalidateblock` won't continue after restart and will need to be called again)
  * The validation queue is prevented from overflowing (meaning `invalidateblock` on a very old block will not drive bitcoind OOM) (see #14289).
  * `invalidateblock` won't bother to move transactions back into the mempool after 10 blocks (optimization).

  This is not an optimal solution, as we're relying on the scheduler call sites to make sure the scheduler doesn't overflow. Ideally, the scheduler would guarantee this directly, but that needs a few further changes (moving the signal emissions out of cs_main) to prevent deadlocks.

  I have manually tested the `invalidateblock` changes (including interrupting, and running with -checkblockindex and -checkmempool), but haven't tried the rewinding (which is probably becoming increasingly unnecessary, as very few pre-0.13.1 nodes remain that would care to upgrade).

Tree-SHA512: 692e42758bd3d3efc2eb701984a8cb5db25fbeee32e7575df0183a00d0c2c30fdf72ce64c7625c32ad8c8bdc56313da72a7471658faeb0d39eefe39c4b8b8474
2019-03-07 17:40:58 +01:00
MarcoFalke 726d0668ff
Merge #15530: doc: Move wallet lock annotations to header
faebd2ef40 doc: Move wallet lock annotations to header (MarcoFalke)

Pull request description:

  We put the annotations in a central place (the header) as opposed to spreading them over the cpp files, where they easily get outdated.

Tree-SHA512: 18d8c7329efd3471713de18fe8d63d67c50fcb9fa99bc372294d829aa7668ea33e10d44e9e50121a04d8cc3302d5fd7759224f7935451a4693c4498a555257e6
2019-03-07 11:34:04 -05:00
MarcoFalke 3515612e06
Merge #15473: bench: Benchmark MempoolToJSON
fa38535130 bench: Benchmark MempoolToJSON (MarcoFalke)
fa5dc3534b rpc: Pass mempool into MempoolToJSON (MarcoFalke)

Pull request description:

  This is used in production (e.g. https://jochen-hoenicke.de/queue/#0,24h), so add a benchmark to avoid making it even slower.

  Related:

  * "getrawmempool true RPC call is O(n^2)" #14765

Tree-SHA512: da09d2e54ee261af8671152f97f863cf1acd7a6adc6578e94046b1ec9e647a670c67499760ef765254f65522dfdf773c3c8729006fa2d63ccb6d53166bafc425
2019-03-06 16:58:37 -05:00
Russell Yanofsky d358466de1 Remove remaining wallet accesses to node globals 2019-03-06 16:47:57 -05:00
MarcoFalke df36ddf9ce
Merge #15504: fuzz: Link BasicTestingSetup (shared with unit tests)
faa9b88199 fuzz: Link BasicTestingSetup (shared with unit tests) (MarcoFalke)
fa85468cd2 test: Move main_tests to validation_tests (MarcoFalke)
fa02b22245 test: Remove useless test_bitcoin_main.cpp (MarcoFalke)
fab2daa026 test: Add missing LIBBITCOIN_ZMQ to test_test_bitcoin_LDADD (MarcoFalke)

Pull request description:

  Link against BasicTestingSetup in the fuzz tests, so we can fuzz against validation.

  Also include a commit to remove test_bitcoin_main.cpp. That file may or may not overwrite globals in the link stage depending on the link order. This is confusing and useless anyway: The unit tests should never `std::exit` in the middle of the run (especially with success as exit code), since it will skip all test modules afterward.

  Also include a commit to remove some unused forward declarations and move the main_tests to validation_tests, since main was long ago split into net_processing and validation.

Tree-SHA512: bdd34c87505450ec106d632f6664aadcbdac7c198172a77da55fab75b274f869ae1a8d06573ba2aff4cb186be9c7a34b7697894ab6f9c82b392f769c9135f36c
2019-03-06 15:16:23 -05:00
Russell Yanofsky b1b2b23892 Remove use of CCoinsViewMemPool::GetCoin in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 4e4d9e9f85 Remove use of CRPCTable::appendCommand in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 91868e6288 Remove use CValidationInterface in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
practicalswift c7a7250302 Document assumptions about C++ compiler 2019-03-05 11:19:32 +01:00
practicalswift 82c3b3f8e0 Remove sharp edge (uninitialized m_filter_type) when using the compiler-generated constructor for BlockFilter 2019-03-05 09:08:04 +01:00
MarcoFalke faebd2ef40
doc: Move wallet lock annotations to header 2019-03-04 15:59:23 -05:00
Russell Yanofsky 4d4e4c6448 Suggested interfaces::Chain cleanups from #15288
Mostly documentation improvements requested in the last review of #15288 before
it was merged
(https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-210241864)
2019-03-04 15:57:58 -05:00
MarcoFalke 45f434f44d
Merge #15288: Remove wallet -> node global function calls
f7efd87c8f Change brace formatting (Russell Yanofsky)
a1df1b48a8 Remove use of IsInitialBlockDownload in wallet code (Russell Yanofsky)
1106a6fde4 Remove use of uiInterface.LoadWallet in wallet code (Russell Yanofsky)
318f41fb2c circular-dependencies: Avoid treating some .h/.cpp files as a unit (Russell Yanofsky)
d02b34c8a8 Remove use of AcceptToMemoryPool in wallet code (Russell Yanofsky)
e2c8ba9f6e Remove uses of InitMessage/Warning/Error in wallet code (Russell Yanofsky)
c5e59a96a8 Remove uses of GetAdjustedTime in wallet code (Russell Yanofsky)
6d6bcc77c0 Remove use of g_connman / PushInventory in wallet code (Russell Yanofsky)
00dfb2a440 Remove uses of g_connman in wallet code (Russell Yanofsky)
cc3836e8f9 Remove uses of fPruneMode in wallet code (Russell Yanofsky)
cc02c796d3 Remove uses of fee globals in wallet code (Russell Yanofsky)
1fb0a4a04e Remove use of CalculateMemPoolAncestors in wallet code (Russell Yanofsky)
cd32160af0 Remove use of GetTransactionAncestry in wallet code (Russell Yanofsky)
291276f7f4 Remove use of GetCountWithDescendants in wallet code (Russell Yanofsky)
bdc6628683 Remove use of IsRBFOptIn in wallet code (Russell Yanofsky)
80f52a2267 Remove uses of CheckFinalTx in wallet code (Russell Yanofsky)

Pull request description:

  This change removes wallet calls to node functions that access global chain and mempool state.

  This is the next step in the larger #10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in #10102.

Tree-SHA512: 40dbaf1f59fb22b32e70b054b30ba5638d638aa3240fa30e0f721d53c721cd6138a7ab4d423a24d7d2fda0b956e68d44c733abc2c9259c3d6c9fd6d4be89aa23
2019-03-04 13:13:36 -05:00
practicalswift c7ea8d3236 Add sizeof(size_t) assumptions 2019-03-04 14:15:58 +01:00
Pieter Wuille 519b0bc5dc Make last disconnected block BLOCK_FAILED_VALID, even when aborted 2019-03-03 13:01:26 -08:00