Commit graph

25667 commits

Author SHA1 Message Date
João Barbosa a13cafc6c6 wallet: GetWalletTx requires cs_wallet lock 2020-08-17 00:06:02 +01:00
Wladimir J. van der Laan ffad348167
Merge #19705: Shrink CAddress from 48 to 40 bytes on x64
767073fb96 Shrink CAddress from 48 to 40 bytes on x64 (Vasil Dimov)

Pull request description:

  `CAddress` inherits `CService` which is 28 bytes (on 64 bit machines).
  `CAddress` then adds two member variables - one that requires 4 byte
  alignment (`nTime`) and one that requires 8 byte alignment
  (`nServices`).

  Declare the smaller one first so that it fits in bytes 29..32.

  On 32 bit machines this change has no effect and `CAddress` remains 40
  bytes.

ACKs for top commit:
  laanwj:
    ACK 767073fb96
  theStack:
    ACK 767073fb96

Tree-SHA512: 73d6a4fcfa2687b4076950801871252e369510ecf09f820576dbeca9ee3ee94d14672e7d5596cb45fedd9e4b973dd0716a2ea3f13fc3058b4b697d036a7c9db0
2020-08-16 18:56:25 +02:00
Igor Cota 366913e307 build: AX_BOOST_THREAD serial 33 2020-08-16 18:47:48 +02:00
Igor Cota cf0681133a build: disable D-Bus on Android by default
Android uses a different notification system and doesn't support D-Bus
2020-08-16 15:16:36 +02:00
Fabian Jahr 124e1ee134
doc: Add release notes for getindexinfo RPC 2020-08-16 11:15:52 +02:00
Fabian Jahr c447b09458
test: Add tests for getindexinfo RPC 2020-08-16 11:15:52 +02:00
Fabian Jahr 667bc7a7f7
rpc: Add getindexinfo RPC 2020-08-16 11:15:49 +02:00
MarcoFalke a57af897ec
Merge #19564: test: p2p_feefilter improvements (logging, refactoring, speedup)
9e7894357e test: speedup p2p_feefilter.py by whitelisting peers (immediate tx relay) (Sebastian Falbesoner)
fe3f0cc44e test: use wait_until for invs matching in p2p_feefilter.py (Sebastian Falbesoner)
6d941923c3 test: add logging for p2p_feefilter.py (Sebastian Falbesoner)

Pull request description:

  This PR gives some love to the functional test `p2p_feefilter.py` by introducing the following changes:
  * add missing log messages for the `test_feefilter` subtest (the main one)
  * deduplicate code by using the utility function `wait_until` (already using the [recently introduced version](12410b1feb)) instead of a manual condition checking loop with `time.sleep`
  * improve naming of the function `matchAllInvs` (more expressive name, snake_case) and moving it from global namespace to the connection class `FeefilterConn`
  * speeding up the test significantly by the good ol' method of activating immediate tx relay (as seen on e.g. https://github.com/bitcoin/bitcoin/pull/17121, https://github.com/bitcoin/bitcoin/pull/17124, https://github.com/bitcoin/bitcoin/pull/17340, https://github.com/bitcoin/bitcoin/pull/17362, ...):
  ```
  master branch:
  $ time ./p2p_feefilter.py
  ...
  real    0m39.367s
  user    0m1.227s
  sys 0m0.571s

  PR branch:
  $ time ./p2p_feefilter.py
  ...
  real    0m9.386s
  user    0m1.120s
  sys 0m0.577s
  ```

ACKs for top commit:
  instagibbs:
    code review ACK 9e7894357e
  jonatack:
    re-ACK 9e78943 per `git range-diff 3ab2582 ea74a3c 9e78943`

Tree-SHA512: fe21c1c5413df9165fea916b5d5f609d3ba33e7b5c3364b38eb824fcc55d9e6abddf27116cbc0b325913d451a73c44542040fb916aec9c46f805c6e12f6f10cf
2020-08-16 11:04:28 +02:00
Marcin Jachymiak 7668db3b08 Move only: Move CDiskTxPos to its own file 2020-08-15 18:23:55 -04:00
Jake Leventhal c91b241b48 Updated outdated help command for getblocktemplate (fixes #19625)
* Removed coinbasetxn from the getblocktemplate help outputs
* Added the missing name for transactions in the help outputs
* Added getblocktemplate help outputs for longpollid and default_witness_commitment
* Added more clarity to capabilities, rules, and coinbaseaux for getblocktemplate help (credit to luke-jr)

Co-authored-by: Luke Dashjr <luke+github_public@dashjr.org>
2020-08-15 13:06:03 -07:00
MarcoFalke 3ab2582c7f
Merge #19730: ci: Set increased --timeout-factor by default
fa330ec2fe test: Remove confusing and broken use of wait_until global (MarcoFalke)
fa6583c30b ci: Set increased --timeout-factor by default (MarcoFalke)

Pull request description:

  Assuming that tests don't have a logic error or race, setting a high timeout should not cause any issues. The tests will still pass just as fast in the fastest case, but it allows for some buffer in case of slow disks or otherwise starved ci machines.

  Fixes #19729

ACKs for top commit:
  hebasto:
    ACK fa330ec2fe, I have reviewed the code, and it looks OK, I agree it can be merged.

Tree-SHA512: 3da80ee008c7b08bab5fdaf7804d57c79d6fed49a7d37b9c54fc89756659fcb9981fd10afc4d07bd90d93c1699fd410a0110a3cd34d016873759d114ce3cd82d
2020-08-15 15:39:02 +02:00
Jon Atack 5da96210fc
doc: release note for getpeerinfo last_block/last_transaction 2020-08-15 15:26:33 +02:00
Jon Atack cfef5a2c98
test: rpc_net.py logging and test naming improvements 2020-08-15 15:13:40 +02:00
Jon Atack 21c57bacda
test: getpeerinfo last_block and last_transaction tests 2020-08-15 15:13:13 +02:00
Jon Atack 8a560a7d57
rpc: expose nLastBlockTime/TXTime as getpeerinfo last_block/transaction 2020-08-15 14:34:37 +02:00
MarcoFalke fa330ec2fe
test: Remove confusing and broken use of wait_until global 2020-08-15 14:01:54 +02:00
Jon Atack 02fbe3ae0b
net: add nLastBlockTime/TXTime to CNodeStats, CNode::copyStats 2020-08-15 12:03:16 +02:00
MarcoFalke fa6583c30b
ci: Set increased --timeout-factor by default 2020-08-15 09:24:46 +02:00
Pieter Wuille 86d4cf42d9 Increase the ip address relay branching factor for unreachable networks
Onion addresses propagate very badly among the IPv4/IPv6 network, resulting
in difficulty for those to find each other.

The branching factor 1 is probably so low that propagations die out before
they reach another onion peer. Increase it to 1.5 on average.
2020-08-14 23:02:42 -07:00
fanquake 4cde97374d
Merge #19718: build: Add missed gcov files to 'make clean'
6cb8771173 build: Add missed gcov files to 'make clean' (Hennadii Stepanov)

Pull request description:

  On master (b4d0366b47):
  ```
  $ ./autogen.sh
  $ ./configure --enable-lcov
  $ make && make cov
  $ make clean
  $ find . -name '*.gcno'
  ./src/rpc/libbitcoin_server_a-blockchain.gcno
  ./src/rpc/libbitcoin_common_a-util.gcno
  ./src/rpc/libbitcoin_common_a-rawtransaction_util.gcno
  ./src/rpc/libbitcoin_server_a-rawtransaction.gcno
  ./src/rpc/libbitcoin_util_a-request.gcno
  ./src/rpc/libbitcoin_server_a-net.gcno
  ./src/rpc/libbitcoin_server_a-server.gcno
  ./src/rpc/libbitcoin_server_a-mining.gcno
  ./src/rpc/libbitcoin_server_a-misc.gcno
  ./src/rpc/libbitcoin_cli_a-client.gcno
  ./src/node/libbitcoin_server_a-coinstats.gcno
  ./src/node/libbitcoin_server_a-transaction.gcno
  ./src/node/libbitcoin_server_a-context.gcno
  ./src/node/libbitcoin_server_a-psbt.gcno
  ./src/node/libbitcoin_server_a-ui_interface.gcno
  ./src/node/libbitcoin_server_a-coin.gcno
  ./src/test/util/libtest_util_a-setup_common.gcno
  ./src/test/util/libtest_util_a-net.gcno
  ./src/test/util/libtest_util_a-blockfilter.gcno
  ./src/test/util/libtest_util_a-mining.gcno
  ./src/test/util/libtest_util_a-transaction_utils.gcno
  ./src/test/util/libtest_util_a-wallet.gcno
  ./src/test/util/libtest_util_a-str.gcno
  ./src/test/util/libtest_util_a-logging.gcno
  ./src/index/libbitcoin_server_a-txindex.gcno
  ./src/index/libbitcoin_server_a-base.gcno
  ./src/index/libbitcoin_server_a-blockfilterindex.gcno
  ./src/util/libbitcoin_util_a-error.gcno
  ./src/util/libbitcoin_util_a-rbf.gcno
  ./src/util/libbitcoin_util_a-message.gcno
  ./src/util/libbitcoin_util_a-time.gcno
  ./src/util/libbitcoin_util_a-moneystr.gcno
  ./src/util/libbitcoin_util_a-url.gcno
  ./src/util/libbitcoin_consensus_a-strencodings.gcno
  ./src/util/libbitcoin_util_a-settings.gcno
  ./src/util/libbitcoin_util_a-system.gcno
  ./src/util/libbitcoin_util_a-threadnames.gcno
  ./src/util/libbitcoin_util_a-fees.gcno
  ./src/util/libbitcoin_util_a-asmap.gcno
  ./src/util/libbitcoin_util_a-strencodings.gcno
  ./src/util/libbitcoin_util_a-string.gcno
  ./src/util/libbitcoin_util_a-bytevectorhash.gcno
  ./src/util/libbitcoin_util_a-bip32.gcno
  ./src/util/libbitcoin_util_a-spanparsing.gcno
  ./src/util/libbitcoinconsensus_la-strencodings.gcno
  ./src/interfaces/libbitcoin_wallet_a-wallet.gcno
  ./src/interfaces/libbitcoin_util_a-handler.gcno
  ./src/interfaces/libbitcoin_server_a-chain.gcno
  ./src/interfaces/libbitcoin_server_a-node.gcno
  ./src/crc32c/src/libcrc32c_a-crc32c_portable.gcno
  ./src/crc32c/src/libcrc32c_a-crc32c.gcno
  ./src/crc32c/src/libcrc32c_sse42_a-crc32c_sse42.gcno
  ```

  This PR fixes this issue.

ACKs for top commit:
  practicalswift:
    ACK 6cb8771173 -- patch looks correct

Tree-SHA512: d331b8fa18f2e0cb2c107de747a39a018f73bcc20b05ed403aa38cf316b5be30b3229e92fb6c85469747571d0048a34b2846432994d0911c8234d207d4e32f1a
2020-08-15 10:15:42 +08:00
fanquake d052f5e6b7
Merge #16841: Replace GetScriptForWitness with GetScriptForDestination
7966aa424a Add variables for repeated scripts (MeshCollider)
fec8336ad9 Remove GetScriptForWitness function (MeshCollider)
b887060d06 Replace usage of GetScriptForWitness with GetScriptForDestination (MeshCollider)

Pull request description:

  As per this TODO in the code:

  > TODO: replace calls to GetScriptForWitness with GetScriptForDestination using the various witness-specific CTxDestination subtypes.

  The commit "Add additional check for P2SH before adding extra wrapper" also adds an additional check that the scriptPubKey is a P2SH before auto-wrapping the witness script. We shouldn't wrap the witness script if not. Note: #16251 is even better than this check, please review that.

ACKs for top commit:
  instagibbs:
    ACK 7966aa424a
  jonatack:
    Code review re-ACK 7966aa4 per `git range-diff b4d0366 ed266f7 7966aa4`
  achow101:
    re-ACK 7966aa424a only changes since last is rebase.

Tree-SHA512: 3449e0e83bd842acc7c94544a85367da97ac20d859eefc1a618caef0c98204398c266fe8fb9600b78326df5175402e1ae4a132eb766e2c4485e7cda6a2a95c43
2020-08-15 08:54:45 +08:00
Samuel Dobson a0e75bd31d
Merge #15937: Add loadwallet and createwallet load_on_startup options
642ad31b41 Add loadwallet and createwallet RPC load_on_startup options (Russell Yanofsky)

Pull request description:

  This maintains a persistent list of wallets stored in settings that will automatically be loaded on startup. Being able to load a wallet automatically on startup will be more useful in the GUI, but it's reasonable to expose this feature by RPC as well.

ACKs for top commit:
  achow101:
    re-ACK 642ad31b41 Only change is the test
  meshcollider:
    re-utACK 642ad31b41

Tree-SHA512: cca0b71bf1a83ad071830e6c459f1cd979b4add7144e899ec560da72b5910dd9bf9426e5c7d125ae96fad8990fbf81a76bc83c0459486c16086ada6cbde5eaa3
2020-08-15 12:19:48 +12:00
Samuel Dobson f269165edc
Merge #17458: Refactor OutputGroup effective value calculations and filtering to occur within the struct
9adc2f80fc Refactor OutputGroups to handle effective values, fees, and filtering (Andrew Chow)
7d07e864b8 Use real value when calculating OutputGroup value (Andrew Chow)

Pull request description:

  Currently, the effective values and filtering for positive effective values is done outside of the OutputGroup. We should instead have functions in Outputgroup to do this and call those for each OutputGroup. So this PR does that.

  This makes future changes for effective values in coin selection much easier.

ACKs for top commit:
  instagibbs:
    reACK 9adc2f80fc
  fjahr:
    re-ACK 9adc2f80fc
  meshcollider:
    Light code review ACK 9adc2f80fc

Tree-SHA512: 7445c94b7295b45bcd83a6f8a5c8f6961a89453fcc856335192d4b4a66aec7724513616b04e5111588ab208c89b311055399d6279cd9c4ce452aefb85f04b64a
2020-08-15 11:44:30 +12:00
Adam Jonas 4792cad88c doc: comment out and add annotation to unused MSG_FILTERED_WITNESS_BLOCK 2020-08-14 09:58:34 -04:00
MarcoFalke fa55c1d5fd
build: Add Werror=range-loop-analysis 2020-08-14 15:27:38 +02:00
MarcoFalke 30dd562fd2
Merge #19457: wallet: Cleanup wallettool salvage and walletdb extraneous declarations
0e279fe489 walletdb: Remove unused static functions from walletdb.h (Andrew Chow)
9f536d4fe9 wallettool: Have RecoverDatabaseFile return errors and warnings (Andrew Chow)
06e263a4e3 Call RecoverDatabaseFile directly from wallettool (Andrew Chow)

Pull request description:

  Followup to #19324 addressing some comments.

  Removes the `SalvageWallet` function in wallettool and instead directly calls `RecoverDatabaseFile` as suggested in https://github.com/bitcoin/bitcoin/pull/19324#discussion_r450379596

  Removes the `LogPrintf`s and `tfm::format`s in `RecoverDatabaseFile` as noted in https://github.com/bitcoin/bitcoin/pull/19324#discussion_r448027237

  Removes the declarations of `VerifyEnvironment` and `VerifyDatabaseFile` that were forgotten in `walletdb.h` as noted in https://github.com/bitcoin/bitcoin/pull/19324#issuecomment-654389079

ACKs for top commit:
  meshcollider:
    Code review ACK 0e279fe489
  ryanofsky:
    Code review ACK 0e279fe489, just dropped last commit

Tree-SHA512: ffd01f30536c2eab4bf40ba363c3ea916ecef3c8f0c5262040b40498776ffb00f95240204a40e38415d6931800851d0a3fa63ee91efc1d329b60ac317da0363d
2020-08-14 15:12:44 +02:00
MarcoFalke 1a43cd3f74
Merge #19709: test: Fix 'make cov' with clang
35cd2da623 test: Fix 'make cov' with clang (Hennadii Stepanov)

Pull request description:

  This is a follow up of #19688.

  With this PR it is possible to do the following:
  ```
  $ ./autogen.sh
  $ ./configure --enable-lcov CC=clang CXX=clang++
  $ make
  $ make cov
  ```

  Currently, on master (8a85377cd0), `make cov` fails to `Processing src/test/test_bitcoin-util_tests.gcda`.

ACKs for top commit:
  vasild:
    ACK 35cd2da
  Crypt-iQ:
    ACK 35cd2da

Tree-SHA512: aaf56118e2644064e9738a8279889c617db5805c5c804c904469b24c496bd609f9c5fc2aebcf1a422f8a5ed2eb38bd6e76b484680310b55c36d922b73a4c33cf
2020-08-14 14:57:49 +02:00
Hennadii Stepanov ce3e6a7cb2
bench: Allow skip benchmark
Co-authored-by: Martin Ankerl <Martin.Ankerl@gmail.com>
2020-08-14 14:56:18 +03:00
Hennadii Stepanov 6cb8771173
build: Add missed gcov files to 'make clean' 2020-08-14 14:38:28 +03:00
MarcoFalke fa3d9ce325
rpc: Assert that RPCArg names are equal to CRPCCommand ones (rpcdump) 2020-08-14 12:38:03 +02:00
MarcoFalke fa32c1d5ec
rpc: Assert that RPCArg names are equal to CRPCCommand ones (zmq) 2020-08-14 12:37:51 +02:00
MarcoFalke faaa46dc20
rpc: Assert that RPCArg names are equal to CRPCCommand ones (mining) 2020-08-14 12:37:19 +02:00
MarcoFalke fa93bc14c7
rpc: Remove unused return type from appendCommand 2020-08-14 12:37:06 +02:00
Wladimir J. van der Laan 4d4bd5ed74
Merge #17204: wallet: Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code (sipa)
dca28634d7 test: ensure OP_1NEGATE satisfies BIP62 minimal push rule (Jon Atack)
e629d07199 Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code (Pieter Wuille)

Pull request description:

  A rebase of #13084 which additionally modifies the test code (unaddressed in the original, assuming sipa is too busy to deal with this at the moment).

  Relatively simple bugfix so it'd be good to have merged soon.

  Turning OP_1NEGATE into 0x0181 results in a larger-than-necessary data push instead of just actually using the OP_1NEGATE opcode (0x4f). This fails the minimal push rule of BIP 62 and makes the result non-standard.

ACKs for top commit:
  fjahr:
    Code review ACK dca28634d7
  luke-jr:
    ACK dca28634d7
  jonatack:
    ACK dca28634d7

Tree-SHA512: 706d9a2ef20c809dea923e477a873e2fd60db8d0ae64289e510b766a38005c1f31ab0b5883f16b9c7863ff0d3f705e8e413f6121320028ac196b79c3184a4113
2020-08-14 11:53:47 +02:00
Wladimir J. van der Laan dabab06a1a
Merge #19455: rpc generate: print useful help and error message
f0aa8aeea5 test: add rpc_generate functional test (Jon Atack)
92d94ffb8d rpc: print useful help and error message for generate (Jon Atack)
8d32d2011d test: consider generate covered in _get_uncovered_rpc_commands() (Jon Atack)

Pull request description:

  This was a requested follow-up to #19133 and #17700 to alleviate confusion and head-scratching by people following tutorials that use `generate`. See https://github.com/bitcoin/bitcoin/pull/19455#issuecomment-668172916 below, https://github.com/bitcoin/bitcoin/pull/19133#issuecomment-636860943 and https://github.com/bitcoin/bitcoin/pull/17700#issuecomment-566159096.

  before
  ```
  $ bitcoin-cli help generate
  help: unknown command: generate

  $ bitcoin-cli generate
  error code: -32601
  error message:
  Method not found
  ```

  after
  ```
  $ bitcoin-cli help generate
  generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information.

  $ bitcoin-cli generate
  error code: -32601
  error message:
  generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information.
  ```

  In the general help it remains hidden, as requested by laanwj.
  ```
  $ bitcoin-cli help

  == Generating ==
  generateblock "output" ["rawtx/txid",...]
  generatetoaddress nblocks "address" ( maxtries )
  generatetodescriptor num_blocks "descriptor" ( maxtries )
  ```

ACKs for top commit:
  adamjonas:
    utACK f0aa8aeea5
  pinheadmz:
    ACK f0aa8aeea5

Tree-SHA512: d083652589ad3e8228c733455245001db22397559c3946e7e573cf9bd01c46e9e88b72d934728ec7f4361436ae4c74adb8f579670b09f479011924357e729af5
2020-08-14 11:29:05 +02:00
Hennadii Stepanov 35cd2da623
test: Fix 'make cov' with clang 2020-08-14 12:18:47 +03:00
fanquake c0b1706964
Merge #19568: Wallet should not override signing errors
e7448d6680 wallet: Don't override signing errors (Fabian Jahr)

Pull request description:

  While reviewing #17204 I noticed that the errors in `input_errors` from `::SignTransaction` where being overridden by `CWallet::SignTransaction`. For example, a Script related error led to incomplete signature data which led to `CWallet::SignTransaction` reporting that keys were missing, which was a less precise error than the original one.

  Additionally, the error `"Input not found or already spent"` is [duplicated in `sign.cpp`](c7b4968552/src/script/sign.cpp (L481)), so the error here is redundant at the moment. So technically the whole error block could be removed, I think. However, this code is affected by the ongoing work on the wallet so there might be a reason why these errors are here. But even if there is a reason to keep them, I don't think existing, potentially more precise errors should be overridden here unless we want to hide them from the users. I am looking for feedback if this is a work in progress state where these errors could be more useful in the future or if they can be removed.

  On testing: even though [the errors in `CWallet` are covered](https://marcofalke.github.io/btc_cov/total.coverage/src/wallet/wallet.cpp.gcov.html), all tests still pass after removing them. I am not sure if there is a desire to cover these specific error messages, tests in `test/functional/rpc_signrawtransaction.py` seem to aim for a more generic approach.

ACKs for top commit:
  achow101:
    ACK e7448d6680
  meshcollider:
    Code review ACK e7448d6680

Tree-SHA512: 3e2bc11d05379d2aef87b093a383d1b044787efc70e35955b2f8ecd028b6acef02f386180566af6a1a63193635f5d685466e2f6141c96326c49ffc5c81ca3e23
2020-08-14 16:04:31 +08:00
MarcoFalke 31760bb7c9
Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc)
fa77de2baa rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) (MarcoFalke)
fa50bdc755 rpc: Limit echo to 10 args (MarcoFalke)
fa89ca9b5b refactor: Use C++11 range based for loops to simplify rpc code (MarcoFalke)
fa459bdc87 rpc: Treat all args after a hidden arg as hidden as well (MarcoFalke)

Pull request description:

  This is split out from #18531 to just touch the RPC methods in misc. Description from the main pr:

  ### Motivation

  RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the `CRPCCommand`s and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

  ### Changes

  The changes here add an assert in the `CRPCCommand` constructor that the RPCArg names are identical to the ones in the `CRPCCommand`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  laanwj:
    Code review ACK fa77de2baa
  fjahr:
    tested ACK fa77de2baa
  theStack:
    ACK fa77de2baa
  ryanofsky:
    Code review ACK fa77de2baa. Pretty straightfoward changes

Tree-SHA512: badae1606518c0b55ce2c0bb9025d14f05556532375eb20fd6f3bfadae1e5e6568860bff8599d037e655bf1d23f1f464ca17f4db10a6ab3d502b6e9e61c7b3d3
2020-08-14 09:26:37 +02:00
Samuel Dobson 609ce2d0da
Merge #19644: rpc: document returned error fields as optional if applicable
f110b7c722 rpc: document returned error fields as optional if applicable (Sebastian Falbesoner)

Pull request description:

  The following RPCs return error fields (named `"error"` or `"errors"`) that are optional, but don't show up as optional in the help text yet:
  * `analyzepsbt`
  * `estimatesmartfee`
  * `signrawtransactionwithkey`
  * `signrawtransactionwithwallet`

  The following RPC has the errors field already marked as optional, but doesn't match the usual format in the description (like `"if there are any"` in parantheses):
  * `estimaterawfee`

  This PR adds the missing optional flags and adapts the description strings. Inspired by a recent PR #19634 by justinmoon.

  The instances were found via `git grep "RPCResult.*\"error"`. Note that there is one RPC so far where the return error is not optional (i.e. in case of no error, the field is included in the result, but is just empty), namely `bumpfee`.

ACKs for top commit:
  adaminsky:
    ACK `f110b7c`
  laanwj:
    ACK f110b7c722, new documentation looks consistent with actual behavior
  achow101:
    ACK f110b7c722
  meshcollider:
    utACK f110b7c722

Tree-SHA512: 30c00f78a575b60e32b4536496af986d53a25f33e6ebbf553adcdcf825ad21a44f90267f3d1ea53326dac83bcfa9983fdb3dad6d3126e20f97f3c08ce286e188
2020-08-14 09:57:58 +12:00
MeshCollider 7966aa424a Add variables for repeated scripts 2020-08-14 08:47:19 +12:00
MeshCollider fec8336ad9 Remove GetScriptForWitness function 2020-08-14 08:47:19 +12:00
MeshCollider b887060d06 Replace usage of GetScriptForWitness with GetScriptForDestination 2020-08-14 08:44:42 +12:00
Russell Yanofsky 642ad31b41 Add loadwallet and createwallet RPC load_on_startup options
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in #15006, but it's reasonable to expose this feature by RPC as well.
2020-08-13 09:44:48 -04:00
Wladimir J. van der Laan b4d0366b47
Merge #19070: p2p: Signal support for compact block filters with NODE_COMPACT_FILTERS
f5c003d3ea [test] Add test for NODE_COMPACT_FILTER. (Jim Posen)
132b30d9c8 [net] Signal NODE_COMPACT_FILTERS if we're serving compact filters. (Jim Posen)
b3fbc94d4f Apply cfilters review fixups (John Newbery)

Pull request description:

  If -peerblockfilters is configured, signal the `NODE_COMPACT_FILTERS` service bit to indicate that we are able to serve compact block filters, headers and checkpoints.

ACKs for top commit:
  MarcoFalke:
    re-review and Concept ACK f5c003d3ea
  fjahr:
    Code review ACK f5c003d3ea
  clarkmoody:
    Concept ACK f5c003d3ea
  ariard:
    Concept and Code Review ACK f5c003d
  jonatack:
    ACK f5c003d3e

Tree-SHA512: 34d1c153530a0e55d09046fe548c9dc37344b5d6d50e00af1b4e1de1e7b49de770fca8471346a17c151de9fe164776296bb3dd5af331977f0c3ef1e6fc906f85
2020-08-13 15:44:48 +02:00
Wladimir J. van der Laan 6757b3ac8f
Merge #19655: rpc: Catch listsinceblock target_confirmations exceeding block count
c133cdcdc3 Cap listsinceblock target_confirmations param (Adam Stein)

Pull request description:

  This addresses an issue brought up in #19587.

  Currently, the `target_confirmations` parameter to `listsinceblock` is not checked for being too large. When `target_confirmations` is greater than one more than the current number of blocks, `listsinceblock` fails with error code -1. In comparison, when `target_confirmations` is less than 1,  a -8 "Invalid parameter" error code is thrown.

  This PR fixes the issue by returning a -8 "Invalid parameter" error if the `target_confirmations` value corresponds to a block with more confirmations than the genesis block. This happens if `target_confirmations` exceeds one more than the number of blocks.

ACKs for top commit:
  laanwj:
    Code review ACK c133cdcdc3
  ryanofsky:
    Code review ACK c133cdcdc3. Just suggested changes since last review. Thanks!

Tree-SHA512: 02680f4cb937d2c24d5019abd0ebfa188b8a50679a1e64e9c26bfe5c17eef6aea906832e6e2d492ba8a2ea160041bf185d66795ee691e340f6793db03c21b89a
2020-08-13 12:12:33 +02:00
Jonas Schnelli 1052b09031
Merge #19011: Reduce cs_main lock accumulation during GUI startup
386ec192a5 Reduce cs_main lock accumulation during GUI startup (Jonas Schnelli)
d42cb79068 Optionally populate BlockAndHeaderTipInfo during AppInitMain (Jonas Schnelli)
b354a1480a Add BlockAndHeaderTipInfo to the node interface/appInit (Jonas Schnelli)
25e1d0bf41 RPCConsole, take initial chaintip data as parameter (Jonas Schnelli)

Pull request description:

  During the GUI startup, there is currently an accumulation of cs_main locks due to setting initial chain state values at multiple locations (in the GUI main thread).

  This PR tries to cache the initial chain state (tip height, tip time, best header, etc.) short after loading the blockindex.

  The cached values are then used instead of fetching them again (and thus locking `cs_main`) during setting the client model.

  This should fix the initial GUI blocking often experienced during or short after the splashscreen.
  On mac, best tested together with #19007.

ACKs for top commit:
  promag:
    Code review ACK 386ec192a5.
  ryanofsky:
    Code review ACK 386ec192a5. Just rebased since last review due to conflicts

Tree-SHA512: caccca05360e6dc0c3aade5e7ed24be513607821a8bd6612d0337259304ab772799fb2d707a0d7c7e50fbff4bd394354643fd0aeaa3bb55960ccc28562f4763d
2020-08-13 10:37:46 +02:00
Samuel Dobson 8a85377cd0
Merge #18654: rpc: separate bumpfee's psbt creation function into psbtbumpfee
79d6332e9e moveonly: Fix indentation in bumpfee RPC (Andrew Chow)
431071c28a Hide bumpfee's psbt creation behavior behind -deprecatedrpc (Andrew Chow)
4638224f64 Add psbtbumpfee RPC (Andrew Chow)

Pull request description:

  Adds a new RPC `psbtbumpfee` which always creates a psbt. `bumpfee` will then only be able to create and broadcast fee bumping transactions instead of changing its behavior based on `IsWalletSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)`.

  Split from #18627

ACKs for top commit:
  Sjors:
    re-utACK 79d6332
  meshcollider:
    utACK 79d6332e9e
  fjahr:
    Code review ACK 79d6332e9e

Tree-SHA512: 1c92c4b4461bb30e78be3ee73165f624398ef33996ce36043b61a8931be667030d0fca12fd0b30097b78c56e4e9092c69582b237cbdac51d56f6be23d8c0f1bb
2020-08-13 12:21:11 +12:00
Adam Stein c133cdcdc3
Cap listsinceblock target_confirmations param
Previously, listsinceblock would fail with error code -1 when the
target_confirmations exceeded the number of confirmations of the genesis
block. This commit allows target_confirmations to refer to a lastblock
hash with more confirmations than exist in the chain by setting the
lastblock hash to the genesis hash in this case. This allows for
`listsinceblock "" 6` to not fail if the block count is less than 5
which may happen on regtest.

Includes update to the functional test for listsinceblock to test for
this case.
2020-08-12 15:16:22 -07:00
Sebastian Falbesoner 9e7894357e test: speedup p2p_feefilter.py by whitelisting peers (immediate tx relay)
Most of the test time is spent in wait_for_invs() after sending to addresses,
i.e. the bottleneck is in relaying transactions. By whitelisting the peers via
-whitelist, the inventory is transmissioned immediately rather than on average
every 5 seconds, speeding up the test significantly:

before:
$ time ./p2p_feefilter.py
...
real    0m39.367s
user    0m1.227s
sys 0m0.571s

with this commit:
$ time ./p2p_feefilter.py
...
real    0m9.386s
user    0m1.120s
sys 0m0.577s
2020-08-12 22:38:09 +02:00
Sebastian Falbesoner fe3f0cc44e test: use wait_until for invs matching in p2p_feefilter.py
additionally:
    -> rename function with snake_case (s/allInvsMatch/wait_for_invs_to_match)
    -> move it from global namespace to the class FeefilterConn
2020-08-12 22:30:38 +02:00