Commit graph

30989 commits

Author SHA1 Message Date
Andrew Chow
0fbaef9676 fees: Always round up fee calculated from a feerate
When calculating the fee for a given tx size from a fee rate, we should
always round up to the next satoshi. Otherwise, if we round down (via
truncation), the calculated fee may result in a fee with a feerate
slightly less than targeted.

This is particularly important for coin selection as a slightly lower
feerate than expected can result in a variety of issues.
2021-10-08 13:53:48 -04:00
MarcoFalke
927586990e
Merge bitcoin/bitcoin#23185: test: Add ParseMoney and ParseScript tests
fa1477e706 test: Add ParseMoney and ParseScript tests (MarcoFalke)

Pull request description:

  Add missing tests

ACKs for top commit:
  practicalswift:
    cr ACK fa1477e706
  shaavan:
    tACK fa1477e706

Tree-SHA512: e57b4e8da4abe075b4ad7e7abd68c4d0eecf0c805acd2c72076aac4993d3ec5748fd02b721c4c110494db56fdbc199301e5cfd1dc0212f2002f355b47f70e539
2021-10-08 13:53:20 +02:00
fanquake
97e2435ac4
Merge bitcoin/bitcoin#23053: [fuzz] Use public methods in addrman fuzz tests
44452110f0 [fuzz] Update comment in FillAddrman() (John Newbery)
640476eb0e [fuzz] Make Fill() a free function in fuzz/addrman.cpp (John Newbery)
90ad8ad61a [fuzz] Make RandAddr() a free function in fuzz/addrman.cpp (John Newbery)
491975c596 [fuzz] Pass FuzzedDataProvider& into Fill() in addrman fuzz tests (John Newbery)
56303e382e [fuzz] Create a FastRandomContext in addrman fuzz tests (John Newbery)

Pull request description:

  #22974 improved the performance of `CAddrMan::Good()` significantly so that it could be used directly in the fuzz tests, instead of those tests reaching directly into addrman's internal data structures.

  This PR continues the work of making the fuzz tests only use `CAddrMan`'s public methods and pulls the `Fill()` and `RandAddr()` methods from `CAddrManDeterministic` into free functions, since they no longer need access to `CAddrMan` internals.

ACKs for top commit:
  theuni:
    utACK 44452110f0. Agree the failure seems unrelated, looks like some startup race.
  mzumsande:
    ACK 44452110f0
  vasild:
    ACK 44452110f0

Tree-SHA512: fcf994e1dedd0012b77f632720b6423d51ceda4eb85c9efe572f2a1150117f9e511114a5206738dd94409137287577f3b01a9998f5237de845410d3d96e7cb7f
2021-10-08 12:13:48 +08:00
fanquake
99e53967c8
Merge bitcoin/bitcoin#23188: wallet: fund transaction external input cleanups
43568782c2 External input fund support cleanups (Gregory Sanders)

Pull request description:

  Minor cleanups to https://github.com/bitcoin/bitcoin/pull/17211

ACKs for top commit:
  achow101:
    ACK 43568782c2
  meshcollider:
    utACK 43568782c2
  benthecarman:
    ACK 43568782c2

Tree-SHA512: 865f8a3804f8c0027f5393a0539041158166a919378f2c3bc99b936843eee2329372bcc2af888fa62babfa5f6baf4f13d4cfef7b4e26a7265a82a908f9719ad6
2021-10-08 08:19:16 +08:00
W. J. van der Laan
991753e4d5
Merge bitcoin/bitcoin#23118: test: refactor: introduce script_util helper for creating P2PK scripts
429b49378e test: introduce script_util helper for creating P2PK scripts (Sebastian Falbesoner)

Pull request description:

  This PR is a follow-up to #22363, which took use of already existing `script_util` helpers to get rid of manual CScript for the P2{PKH,SH,WPKH,WSH} output types, in order to increase readability and maintainability of the test code. Here the same is done for P2PK scripts by introducing a helper `key_to_p2pk_script` and using it. Note that the helper only accepts ECDSA pubkeys (i.e. ones with a size of 33 or 65 bytes), hence it can't be used for scripts in the form of [x-only-pubkey, OP_CHECKSIG].

ACKs for top commit:
  brunoerg:
    Code review ACK 429b49378e
  laanwj:
    Code review ACK 429b49378e
  rajarshimaitra:
    Concept + tACK 429b49378e

Tree-SHA512: 984aea01eba5f38a328d69905d90a3a36f0a02419ca3e5baf3c8095895fb094e3780c7da16fad5851db3847bdb05ce8cda244ab09b79b8aa9602dfb3c5e0414c
2021-10-07 15:41:57 +02:00
W. J. van der Laan
6334ff7364
Merge bitcoin/bitcoin#23196: util: Make syscall sandbox compilable with kernel 4.4.0
ac402e749c util: Conditionalize some syscalls in syscall name table (W. J. van der Laan)
64085b37f8 util: Add __NR_copy_file_range syscall constant for sandbox (W. J. van der Laan)

Pull request description:

  Make the new syscall sandbox compilable with kernel 4.4.0.
  This defines a further syscall constant `__NR_copy_file_range` to make sure all syscalls used in the profile are available even if not defined in the kernel headers.

  Also, make a few syscalls optional in the syscall name table:

  - `__NR_pkey_alloc`
  - `__NR_pkey_free`
  - `__NR_pkey_mprotect`
  - `__NR_preadv2`
  - `__NR_pwritev2`

ACKs for top commit:
  practicalswift:
    cr ACK ac402e749c

Tree-SHA512: be6c55bf0a686bcdfad0b80b950d0d7d77a559ac234fc997b47514bdba44865a371c96dd8d34a811ba46424a84f410e23f75485b9b1e69e529b7d40e0b4b91b8
2021-10-07 14:39:13 +02:00
W. J. van der Laan
6f0cbc75be
Merge bitcoin/bitcoin#22539: Re-include RBF replacement txs in fee estimation
3b613722f6 Add release notes for fee est with replacement txs (Antoine Poinsot)
4556406562 qa: test fee estimation with replacement transactions (Antoine Poinsot)
053415b297 qa: split run_test into smaller parts (Antoine Poinsot)
06c5ce9714 Re-include RBF replacement txs in fee estimation (Antoine Poinsot)

Pull request description:

  This effectively reverts #9519.

  RBF is now largely in use on the network (signaled for by around 20% of
  all transactions on average) and replacement logic is implemented in
  most end-user wallets. The rate of replaced transactions is also
  expected to rise as fee-bumping techniques are being developed for
  pre-signed transaction ("L2") protocols.

ACKs for top commit:
  prayank23:
    reACK 3b613722f6
  Zero-1729:
    re-ACK 3b613722f6
  benthecarman:
    reACK 3b613722f6
  glozow:
    ACK 3b613722f6
  theStack:
    re-ACK 3b613722f6 🍪

Tree-SHA512: a6146d15c80ff4ba9249314b0ef953a66a15673e61b8f98979642814f1b169b5695e330e3ee069fa9a7e4d1f8aa10e1dcb7f9aa79181cea5a4c4dbcaf5483023
2021-10-07 13:47:36 +02:00
MarcoFalke
c0b6c96eee
Merge bitcoin/bitcoin#23146: Test transactions conflicted by double spend in listtransactions
502f50da12 Test transactions conflicted by double spend in listtransactions (Jon Atack)

Pull request description:

  Test the properties of transactions conflicted by a double spend as returned by RPC listtransactions in the abandoned, confirmations, trusted and walletconflicts fields. These fields are also returned by RPCs listsinceblock and gettransactions.

ACKs for top commit:
  brunoerg:
    tACK 502f50da12
  rajarshimaitra:
    Concept + tACK 502f50da12

Tree-SHA512: 28968f4a5f1960ea45b2e6f5b20fe25c1b51f66944062dcddea52ea970ad21c74d583793d091b84e8a5e506d6aecc1f0435c5b918213975b22c38e02bba19aa1
2021-10-07 09:59:03 +02:00
MarcoFalke
b4437d7dfe
Merge bitcoin/bitcoin#23210: test: Replace satoshi_round with int() or Decimal()
fa2ac5881e test: Replace satoshi_round with int() or Decimal() (MarcoFalke)

Pull request description:

  satoshi_round will round down. To make the code easier to parse use
  Decimal() where possible, which does not round. Or use int(), which
  explicitly rounds down.

ACKs for top commit:
  lsilva01:
    Tested ACK fa2ac5881e on Ubuntu 20.04.

Tree-SHA512: 17795d906aa7652933d43e510e993cdd9cf8926da1febf1c42d463048cb38c92dc518ec08736efe29c0189ffd532b108bc7a715f32b4c2ee58b215df65352eb9
2021-10-07 09:09:11 +02:00
fanquake
f8911de619
Merge bitcoin/bitcoin#23172: doc: Extract FundTxDoc in rpcwallet
fafff132cf doc: Extract FundTxDoc (MarcoFalke)

Pull request description:

  No need to duplicate the documentation for the same field(s) three times.

  Fix that by de-duplicating it for the fields: conf_target, estimate_mode, replaceable, and solving_data.

  Can be reviewed with `--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`.

ACKs for top commit:
  fanquake:
    ACK fafff132cf

Tree-SHA512: 098ddad3904b80b24c9e7b57ca8e807a6ccc3899eac2c9986d71ba3873c2b580bbb95f2fdfbf94b2db02f81c7b0ebf438a90324c23389b7b968ca85ae8475373
2021-10-07 13:28:26 +08:00
fanquake
0500a22d8c
Merge bitcoin/bitcoin#23208: util: Add mremap syscall to AllowAddressSpaceAccess
fab360aa00 util: Add mremap syscall to AllowAddressSpaceAccess (MarcoFalke)

Pull request description:

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

ACKs for top commit:
  practicalswift:
    cr ACK fab360aa00
  laanwj:
    Code review ACK fab360aa00
  fanquake:
    ACK fab360aa00 - confirmed that the GUIX build is working with this change:

Tree-SHA512: 9cf808b3e04830e87bca49b27914993929be3c27eb674d89739b8ea5e5c848c87713d638506c1cd2b80b0129c3dff0c488eb240eef3bbf3d7508ece3c934fb54
2021-10-07 12:36:02 +08:00
fanquake
a68de12c0e
Merge bitcoin/bitcoin#22890: doc: Replace a link to Qt precompiled binaries with compile instructions
6bc4398937 doc: Suggest using jom instead of nmake (Hennadii Stepanov)
c4139f06a9 doc: Replace a link to Qt precompiled binaries with compile instructions (Hennadii Stepanov)
5e42f2ad26 build: Make <QtBaseDir> default name Qt and VS versions agnostic (Hennadii Stepanov)

Pull request description:

  This PR replaces a [link to Qt precompiled binaries](https://github.com/sipsorcery/qt_win_binary/releases) with compile instructions that allow users to self-compile static Qt package which is required for building Bitcoin Core with Visual Studio.

ACKs for top commit:
  sipsorcery:
    ACK 6bc4398937.

Tree-SHA512: 0c91536e51177ec2ed437614cb37b3fd1dccce856548c22307359da68200433971fd97cd8a537b0856cfccc521ac50d61801a78cb5275b818829ee7b43bc7d6a
2021-10-07 08:39:52 +08:00
Hennadii Stepanov
577b0ffd2e
Merge bitcoin-core/gui#409: Fix window title of wallet loading window
01bff8f049 qt: Fix WalletControllerActivity progress dialog title (Shashwat)

Pull request description:

  Throughout the GUI, the title of the window, tells about the purpose of the window. This was not true for the title of wallet loading wallet.
  This PR fixes this issue by renaming the wallet loading window title to 'Open Wallet'

  Changes introduced in this PR (Runned Bitcoin-GUI on signet network)

  |Master|PR|
  |---|---|
  |![Screenshot from 2021-08-24 00-02-18](https://user-images.githubusercontent.com/85434418/130500309-2f0af2c9-55f0-4609-a92b-3156800fa92e.png)|![Screenshot from 2021-09-07 18-19-10](https://user-images.githubusercontent.com/85434418/132351394-1ee4a36c-3ba9-4d1a-a8f3-f17804fb856a.png)|

ACKs for top commit:
  jarolrod:
    ACK 01bff8f
  hebasto:
    ACK 01bff8f049, tested on Linux Mint 20.2 (Qt 5.12.8).

Tree-SHA512: cd21c40752eb1c0afb5ec61b8a40e900bc3aa05749963f7957ece6024e4957f5bb37e0eb4f95aac488f5e08aea51fe13b023b05d8302a08c88dcc6790410ba64
2021-10-06 21:36:48 +03:00
MarcoFalke
fa1477e706
test: Add ParseMoney and ParseScript tests 2021-10-06 20:01:42 +02:00
MarcoFalke
7962c97a2e
Merge bitcoin-core/gui#446: RPCConsole: Throw when overflowing size_t type for array indices
faa5e171e6 RPCConsole: Throw when overflowing size_t type for array indices (MarcoFalke)

Pull request description:

  To test:

  -> `getblock(getbestblockhash(), 1)[tx][22222222222222222222222222222]`

  Before:

  <- `868693731dea69a197c13c2cfaa41c9f78fcdeb8ab8e9f8cdf2c9025147ee7d1` (hash of the coinbase tx)

  After:

  <- `Error: Invalid result query`

ACKs for top commit:
  jarolrod:
    ACK faa5e171e6
  shaavan:
    ACK faa5e17

Tree-SHA512: ddff39aae1c15db45928b110a9f1c42eadc5404cdfa89d67ccffc4c6af24091967d43c068ce9e0c1b863cfc4eb5b4f12373a73756a9474f8294e8a44aabc28d8
2021-10-06 19:48:17 +02:00
MarcoFalke
bb8550b788
Merge bitcoin/bitcoin#23209: test: Avoid RPC roundtrip in MiniWallet get_descriptor()
fa3ab7b5b1 test: Avoid RPC roundtrip in MiniWallet get_descriptor() (MarcoFalke)

Pull request description:

  No need to call an RPC to calculate the checksum.

ACKs for top commit:
  theStack:
    ACK fa3ab7b5b1 🍂

Tree-SHA512: 2ab019bf7535d7a9fbf30f7e9f1c35f70b0e699e52a8218cbde636fbb0062f58809e750156d7e3cde2ec532023482a4fb26e8f0f2a18def5727cf13b432e3bfd
2021-10-06 19:21:28 +02:00
MarcoFalke
fa2ac5881e
test: Replace satoshi_round with int() or Decimal()
satoshi_round will round down. To make the code easier to parse use
Decimal() where possible, which does not round. Or use int(), which
explicitly rounds down.
2021-10-06 15:16:59 +02:00
MarcoFalke
fa3ab7b5b1
test: Avoid RPC roundtrip in MiniWallet get_descriptor() 2021-10-06 14:54:26 +02:00
Shashwat
01bff8f049 qt: Fix WalletControllerActivity progress dialog title
The WalletControllerActivity progress dialog had title of "Bitcoin-Qt".
The window title for opening wallet window should be "Open Wallet",
for creating wallet window should be "Create Wallet", and for the window
that is displayed when wallets are being loaded at startup should be
"Load Wallets". This PR fixes that.
2021-10-06 17:42:04 +05:30
MarcoFalke
fab360aa00
util: Add mremap syscall to AllowAddressSpaceAccess 2021-10-06 13:58:38 +02:00
MarcoFalke
66d11b1435
Merge bitcoin/bitcoin#23200: Fix intermittent failure in wallet_send.py and rpc_fundrawtransaction.py
75a9305d45 Fix intermittent test failures due to missing sync_all (Samuel Dobson)
eb02dbba3c Use self.generate not node.generate throughout tests (Samuel Dobson)

Pull request description:

  After #17211 was merged, there have been a few intermittent test failures in `wallet_send.py`, `rpc_fundrawtransaction.py`, and `rpc_psbt.py`

  I believe all these failures are due to these missing `sync_all()`s

ACKs for top commit:
  achow101:
    ACK 75a9305d45
  lsilva01:
    Tested ACK 75a9305d45 on Ubuntu 20.04

Tree-SHA512: 91de5763664046e5a35802eb1a9a28f69a1a27d78d26c9fa0024bcfab4ccb4b7ad4feebea7de4b19e141db9c39270c623c57c47942a48dfe679fdc8cad70df43
2021-10-06 13:05:12 +02:00
Samuel Dobson
75a9305d45 Fix intermittent test failures due to missing sync_all 2021-10-06 12:19:04 +13:00
Samuel Dobson
eb02dbba3c Use self.generate not node.generate throughout tests 2021-10-06 12:18:33 +13:00
Gregory Sanders
43568782c2 External input fund support cleanups
Synchronize error checking for external inputs
Rename external output Select to SelectExternal
Const FundTransaction variables
2021-10-06 06:55:34 +08:00
W. J. van der Laan
ac402e749c util: Conditionalize some syscalls in syscall name table
Put these in `#ifdef` as they are newer syscalls that might not be
defined on all kernels:

     __NR_pkey_alloc
     __NR_pkey_free
     __NR_pkey_mprotect
     __NR_preadv2
     __NR_pwritev2

Thanks to jamesob for reporting.
2021-10-05 19:36:29 +02:00
W. J. van der Laan
64085b37f8 util: Add __NR_copy_file_range syscall constant for sandbox
Kernel 4.4.0 doesn't define this.
2021-10-05 19:35:24 +02:00
John Newbery
44452110f0 [fuzz] Update comment in FillAddrman()
Suggested here: https://github.com/bitcoin/bitcoin/pull/22974#discussion_r711119626
2021-10-05 16:59:09 +01:00
John Newbery
640476eb0e [fuzz] Make Fill() a free function in fuzz/addrman.cpp
Also rename it to FillAddrman and pass an addrman reference as an
argument. Change FillAddrman to only use addrman's public interface methods.
2021-10-05 16:59:09 +01:00
John Newbery
90ad8ad61a [fuzz] Make RandAddr() a free function in fuzz/addrman.cpp
It doesn't require access to CAddrManDeterministic
2021-10-05 16:59:07 +01:00
John Newbery
491975c596 [fuzz] Pass FuzzedDataProvider& into Fill() in addrman fuzz tests
Use a (reference) parameter instead of a data member of
CAddrManDeterministic. This will allow us to make Fill() a free function
in a later commit.

Also remove CAddrManDeterministic.m_fuzzed_data_provider since it's no
longer used.
2021-10-05 16:38:42 +01:00
John Newbery
56303e382e [fuzz] Create a FastRandomContext in addrman fuzz tests
Don't reach inside the object-under-test to use its random context.
2021-10-05 16:38:42 +01:00
W. J. van der Laan
113b863f07
Merge bitcoin/bitcoin#23162: contrib: Ask for captcha in signet getcoins.py
a6d9675d60 contrib: Ask for captcha in signet getcoins.py (W. J. van der Laan)

Pull request description:

  As the faucet will always ask for a captcha now, the current script is no longer usable.

  Change the `getcoins.py` script to print the captcha in dot-matrix to the terminal, using unicode Braille characters.

  ```
  $ ./getcoins.py  -a tb1q9srj96uj4uk5gva9k7h2zxuy6ttu7ltsagu0gl
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠙⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠢⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠊⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⢦⣄⣀⠀⠀⠀⠉⠒⠤⣀⠀⠀⢀⣀⠄⠀⠀⠀⠀⠀⢀⣀⣀⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠹⣍⠹⣦⡀⠀⠀⠀⢀⡿⢻⣿⣿⠋⠀⠀⠀⠀⢸⠋⢩⣤⣴⣿⠃⠀⠀⠀⠀⠀⠀⠈⡟⠓⠒⠒⠖⠒⢛⣿⡖⠀⠀⠀⠀⠀⡶⠒⠛⠛⠒⠒⠶⣄⠴⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢳⡈⢻⣄⠀⣰⠏⣴⣿⠟⠀⠉⠓⠢⢄⣀⣸⡀⢸⣿⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⣧⠀⣿⣿⣿⠿⠿⠟⠃⠀⠀⠀⠀⠀⣷⠀⣾⣿⡿⣷⠊⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠹⣾⢃⣾⣿⠋⠀⠀⠀⠀⠀⠀⢸⣟⡓⣾⣟⣯⡄⠀⠀⠀⠀⠀⠀⠀⠀⡿⠐⣛⡛⠛⠲⣄⠀⠀⠀⠀⠀⠀⢀⡸⣷⡻⢯⡤⢟⣼⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣧⢠⣾⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⣿⣿⠛⠏⠓⠒⠤⠤⣀⣀⣀⠀⠛⣿⡿⠿⠿⣆⣹⣧⡠⠤⠔⠒⠉⠁⣰⠟⣥⣶⣶⣌⠹⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⢸⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⣉⠉⠉⠉⢉⡏⢸⣿⡀⠀⠀⠀⠀⠀⡟⢸⣿⠏⠉⢹⡆⣻⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠈⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠛⠳⠶⠶⠛⣁⣼⣿⡇⠀⠀⠀⠀⠀⣧⠈⠻⠶⠶⠛⣀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠿⠿⢷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠿⠿⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠻⠿⣿⣿⣿⣿⡿⠿⠀⠀⠀⠀⠀⠀⠈⠻⠿⣿⣿⣿⣿⣿⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  Enter captcha: Yf58
  Payment of 0.00100000 BTC sent with txid e0a96a2a768d1ae0d22eaa2942476927d956445276bdf508dfd2f0e2e836f300
  ```

  The only added dependency is that `convert` from ImageMagick (or compatible fork) is installed.

  Captchas are disabled by default for custom faucets, but it is possible to specify a custom captcha URL on the command line.

  Also adds a way to change the amount requested with e.g.  `-n 0.1`.

  Edit: credit where credit is due, yope gave me the idea of using Braille characters as a widely available way to do graphics in the terminal. Another possibility is `2x2` block characters but it is a lot less compact. Yet another one is [VT340 Sixel graphics](https://en.wikipedia.org/wiki/Sixel) but it's not supported in many terminal emulators.

ACKs for top commit:
  kallewoof:
    Tested ACK a6d9675d60
  dunxen:
    Tested ACK a6d9675
  lsilva01:
    Tested ACK a6d9675d on Ubuntu 20.04 with the command below:
  shaavan:
    ACK a6d9675d60
  stratospher:
    Tested ACK a6d9675 on macOS 10.15.7. This PR:
  theStack:
    tACK a6d9675d60 ♟️

Tree-SHA512: 6b39cadcc42b41289977daa523c849d0b1e194ff385a7828ca0097efc0b4d7c74d1ebd3f5b274762563cf039f5198ce22a3ea8cfaa8ac3b9f9c9a954fe43d457
2021-10-05 17:10:47 +02:00
W. J. van der Laan
89b910711c
Merge bitcoin/bitcoin#23178: util: Fix GUIX build with syscall sandbox
2d0279987e util: Make sure syscall numbers used in profile are defined (W. J. van der Laan)
8289d19ea5 util: Define SECCOMP_RET_KILL_PROCESS if not provided by the headers (W. J. van der Laan)

Pull request description:

  Looks like we've broke the GUIX build in #20487. This attempts to fix it:

  - Define `__NR_statx` `__NR_getrandom` `__NR_membarrier` as some kernel headers lack them, and it's important to have the same profile independent on what kernel is used for building.
  - Define `SECCOMP_RET_KILL_PROCESS` as it isn't defined in the headers.

ACKs for top commit:
  practicalswift:
    cr ACK 2d0279987e

Tree-SHA512: c264c66f90af76bf364150e44d0a31876c2ef99f05777fcdd098a23f1e80efef43028f54bf9b3dad016110056d303320ed9741b0cb4c6266175fa9d5589b4277
2021-10-05 16:50:34 +02:00
MarcoFalke
c4fc899442
Merge bitcoin/bitcoin#22950: [p2p] Pimpl AddrMan to abstract implementation details
021f86953e [style] Run changed files through clang formatter. (Amiti Uttarwar)
375750387e scripted-diff: Rename CAddrInfo to AddrInfo (Amiti Uttarwar)
dd8f7f2500 scripted-diff: Rename CAddrMan to AddrMan (Amiti Uttarwar)
3c263d3f63 [includes] Fix up included files (Amiti Uttarwar)
29727c2aa1 [doc] Update comments (Amiti Uttarwar)
14f9e000d0 [refactor] Update GetAddr_() function signature (Amiti Uttarwar)
40acd6fc9a [move-only] Move constants to test-only header (Amiti Uttarwar)
7cf41bbb38 [addrman] Change CAddrInfo access (Amiti Uttarwar)
e3f1ea659c [move-only] Move CAddrInfo to test-only header file (Amiti Uttarwar)
7cba9d5618 [net, addrman] Remove external dependencies on CAddrInfo objects (Amiti Uttarwar)
8af5b54f97 [addrman] Introduce CAddrMan::Impl to encapsulate addrman implementation. (Amiti Uttarwar)
f2e5f38f09 [move-only] Match ordering of CAddrMan declarations and definitions (Amiti Uttarwar)
5faa7dd6d8 [move-only] Move CAddrMan function definitions to cpp (Amiti Uttarwar)

Pull request description:

  Introduce the pimpl pattern for AddrMan to separate the implementation details from the externally used object representation. This reduces compile-time dependencies and conceptually clarifies AddrMan's interface from the implementation specifics.

  Since the unit & fuzz tests currently rely on accessing AddrMan internals, this PR introduces addrman_impl.h, which is exclusively imported by addrman.cpp and test files.

ACKs for top commit:
  jnewbery:
    ACK 021f86953e
  GeneFerneau:
    utACK [021f869](021f86953e)
  mzumsande:
    ACK 021f86953e
  rajarshimaitra:
    Concept + Code Review ACK 021f86953e
  theuni:
    ACK 021f86953e

Tree-SHA512: aa70cb77927a35c85230163c0cf6d3872382d79048b0fb79341493caa46f8e91498cb787d8b06aba4da17b2f921f2230e73f3d66385519794fff86a831b3a71d
2021-10-05 16:48:33 +02:00
W. J. van der Laan
2d0279987e util: Make sure syscall numbers used in profile are defined
Define the following syscall numbers for x86_64, so that the profile
will be the same no matter what kernel is built against, including
kernels that don't have `__NR_statx`:
```c++
 #define __NR_statx 332
 #define __NR_getrandom 318
 #define __NR_membarrier 324
```
2021-10-05 14:42:35 +02:00
MarcoFalke
faa5e171e6
RPCConsole: Throw when overflowing size_t type for array indices 2021-10-05 14:28:57 +02:00
MarcoFalke
c79d9fb2f6
Merge bitcoin/bitcoin#23179: sandbox: add newfstatat & copy_file_range to allowed filesystem syscalls
44d77d2213 sandbox: add copy_file_range to allowed filesystem syscalls (fanquake)
ee08741c9c sandbox: add newfstatat to allowed filesystem syscalls (fanquake)

Pull request description:

  Similar to #23178, this is a follow up to #20487, which has broken running the unit tests for some developers. Fix this by adding `newfstatat` to the list of allowed filesystem related calls.

ACKs for top commit:
  achow101:
    ACK 44d77d2213
  laanwj:
    Code review ACK  44d77d2213
  practicalswift:
    cr ACK 44d77d2213

Tree-SHA512: ce9d1b441ebf25bd2cf290566e05864223c1418dab315c962e1094ad877db5dd9fcab94ab98a46da8b712a8f5f46675d62ca3349215d8df46ec5b3c4d72dbaa6
2021-10-05 11:35:18 +02:00
MarcoFalke
371f0aeeb4
Merge bitcoin/bitcoin#23182: build: add python3.10 alias to AC_PATH_PROGS call in configure
ef15c574ff build: add python3.10 alias to AC_PATH_PROGS call in configure (fanquake)

Pull request description:

  Python 3.10 is [now released](https://pythoninsider.blogspot.com/2021/10/python-3100-is-available.html), and has been available as a beta/rc in distros for a little while already.

ACKs for top commit:
  MarcoFalke:
    cr ACK ef15c574ff
  laanwj:
    Code review ACK ef15c574ff
  hebasto:
    ACK ef15c574ff, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 4d503d43dfbe210ac6180c63276d4ebe1aa39b0ada2a36c1292634f86603c385179b3034759441401a9ee5022f7687ccd5f3432be5c4e63f2eba7ddb76f5cbb9
2021-10-05 11:28:43 +02:00
MarcoFalke
816e15ee81
Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus
9d0379cea6 consensus: use <cstdint> over <stdint.h> in amount.h (fanquake)
863e52fe63 consensus: make COIN & MAX_MONEY constexpr (fanquake)
d09071da5b [MOVEONLY] consensus: move amount.h into consensus (fanquake)

Pull request description:

  A first step (of a few) towards some source code reorganization, as well as making libbitcoinconsensus slightly more self contained.

  Related to #15732.

ACKs for top commit:
  MarcoFalke:
    concept ACK 9d0379cea6 🏝

Tree-SHA512: 97fc79262dcb8c00996852a288fee69ddf8398ae2c95700bba5b326f1f38ffcfaf8fa66e29d0cb446d9b3f4e608a96525fae0c2ad9cd531ad98ad2a4a687cd6a
2021-10-05 09:43:23 +02:00
W. J. van der Laan
8289d19ea5 util: Define SECCOMP_RET_KILL_PROCESS if not provided by the headers
Define `SECCOMP_RET_KILL_PROCESS` as it isn't defined in the headers, as
is the case for the GUIX build on this platform.
2021-10-05 08:15:04 +02:00
fanquake
ef15c574ff
build: add python3.10 alias to AC_PATH_PROGS call in configure
Python 3.10 is now relased, and has been available as a beta/rc in
distros for a little while already.
2021-10-05 12:00:02 +08:00
fanquake
44d77d2213
sandbox: add copy_file_range to allowed filesystem syscalls 2021-10-05 09:13:55 +08:00
fanquake
ee08741c9c
sandbox: add newfstatat to allowed filesystem syscalls 2021-10-05 08:41:41 +08:00
W. J. van der Laan
9e530c6352
Merge bitcoin/bitcoin#20487: Add syscall sandboxing using seccomp-bpf (Linux secure computing mode)
4747da3a5b Add syscall sandboxing (seccomp-bpf) (practicalswift)

Pull request description:

  Add experimental syscall sandboxing using seccomp-bpf (Linux secure computing mode).

  Enable filtering of system calls using seccomp-bpf: allow only explicitly allowlisted (expected) syscalls to be called.

  The syscall sandboxing implemented in this PR is an experimental feature currently available only under Linux x86-64.

  To enable the experimental syscall sandbox the `-sandbox=<mode>` option must be passed to `bitcoind`:

  ```
    -sandbox=<mode>
         Use the experimental syscall sandbox in the specified mode
         (-sandbox=log-and-abort or -sandbox=abort). Allow only expected
         syscalls to be used by bitcoind. Note that this is an
         experimental new feature that may cause bitcoind to exit or crash
         unexpectedly: use with caution. In the "log-and-abort" mode the
         invocation of an unexpected syscall results in a debug handler
         being invoked which will log the incident and terminate the
         program (without executing the unexpected syscall). In the
         "abort" mode the invocation of an unexpected syscall results in
         the entire process being killed immediately by the kernel without
         executing the unexpected syscall.
  ```

  The allowed syscalls are defined on a per thread basis.

  I've used this feature since summer 2020 and I find it to be a helpful testing/debugging addition which makes it much easier to reason about the actual capabilities required of each type of thread in Bitcoin Core.

  ---

  Quick start guide:

  ```
  $ ./configure
  $ src/bitcoind -regtest -debug=util -sandbox=log-and-abort
  …
  2021-06-09T12:34:56Z Experimental syscall sandbox enabled (-sandbox=log-and-abort): bitcoind will terminate if an unexpected (not allowlisted) syscall is invoked.
  …
  2021-06-09T12:34:56Z Syscall filter installed for thread "addcon"
  2021-06-09T12:34:56Z Syscall filter installed for thread "dnsseed"
  2021-06-09T12:34:56Z Syscall filter installed for thread "net"
  2021-06-09T12:34:56Z Syscall filter installed for thread "msghand"
  2021-06-09T12:34:56Z Syscall filter installed for thread "opencon"
  2021-06-09T12:34:56Z Syscall filter installed for thread "init"
  …
  # A simulated execve call to show the sandbox in action:
  2021-06-09T12:34:56Z ERROR: The syscall "execve" (syscall number 59) is not allowed by the syscall sandbox in thread "msghand". Please report.
  …
  Aborted (core dumped)
  $
  ```

  ---

  [About seccomp and seccomp-bpf](https://en.wikipedia.org/wiki/Seccomp):

  > In computer security, seccomp (short for secure computing mode) is a facility in the Linux kernel. seccomp allows a process to make a one-way transition into a "secure" state where it cannot make any system calls except exit(), sigreturn(), and read() and write() to already-open file descriptors. Should it attempt any other system calls, the kernel will terminate the process with SIGKILL or SIGSYS. In this sense, it does not virtualize the system's resources but isolates the process from them entirely.
  >
  > […]
  >
  > seccomp-bpf is an extension to seccomp that allows filtering of system calls using a configurable policy implemented using Berkeley Packet Filter rules. It is used by OpenSSH and vsftpd as well as the Google Chrome/Chromium web browsers on Chrome OS and Linux. (In this regard seccomp-bpf achieves similar functionality, but with more flexibility and higher performance, to the older systrace—which seems to be no longer supported for Linux.)

ACKs for top commit:
  laanwj:
    Code review and lightly tested ACK 4747da3a5b

Tree-SHA512: e1c28e323eb4409a46157b7cc0fc29a057ba58d1ee2de268962e2ade28ebd4421b5c2536c64a3af6e9bd3f54016600fec88d016adb49864b63edea51ad838e17
2021-10-04 22:45:43 +02:00
MarcoFalke
42fedb4acd
Merge bitcoin/bitcoin#23156: refactor: Remove unused ParsePrechecks and ParseDouble
fa9d72a794 Remove unused ParseDouble and ParsePrechecks (MarcoFalke)
fa3cd28535 refactor: Remove unused ParsePrechecks from ParseIntegral (MarcoFalke)

Pull request description:

  All of the `ParsePrechecks` are already done by `ToIntegral`, so remove them from `ParseIntegral`.

  Also:
  * Remove redundant `{}`. See https://github.com/bitcoin/bitcoin/pull/20457#discussion_r720116866
  * Add missing failing c-string test case
  * Add missing failing test cases for non-int32_t integral types

ACKs for top commit:
  laanwj:
    Code review ACK fa9d72a794, good find on ParseDouble not being used at all, and testing for behavior of embedded NULL characters is always a good thing.
  practicalswift:
    cr ACK fa9d72a794

Tree-SHA512: 3d654dcaebbf312dd57e54241f9aa6d35b1d1d213c37e4c6b8b9a69bcbe8267a397474a8b86b57740fbdd8e3d03b4cdb6a189a9eb8e05cd38035dab195410aa7
2021-10-04 15:06:37 +02:00
MarcoFalke
fafff132cf
doc: Extract FundTxDoc
For the fields: conf_target, estimate_mode, replaceable, and solving_data.
2021-10-04 14:55:10 +02:00
W. J. van der Laan
cdb4dfcbf1
Merge bitcoin/bitcoin#20452: util: Replace use of locale dependent atoi(…) with locale-independent std::from_chars(…) (C++17)
4343f114cc Replace use of locale dependent atoi(…) with locale-independent std::from_chars(…) (C++17) (practicalswift)

Pull request description:

  Replace use of locale dependent `atoi(…)` with locale-independent `std::from_chars(…)` (C++17).

ACKs for top commit:
  laanwj:
    Code review ACK 4343f114cc
  jonatack:
    Code review ACK 4343f114cc

Tree-SHA512: e4909da282b6cefc5ca34e13b02cc489af56cab339a77ae5c35ac9ef355d9b941b129a2bfddc1b37426b11c79a21c8b729fbb5255e6d9eaa344406b18b825494
2021-10-04 12:59:28 +02:00
MarcoFalke
c6f710ec98
Merge bitcoin/bitcoin#23052: test: use miniwallet in test_rpc function in feature_rbf.py
74c0d81b46 test: use miniwallet in test_rpc() function in feature_rbf.py (Shubhankar)

Pull request description:

  This PR aims to further increase MiniWallet usage in the functional test feature_rbf.py by using it in the test_rpc(...) . Sub test needs wallet to get a utxo for creating raw txn, and to get address for output, address can be hardcoded and mini wallet can be used for utxo. fund raw transaction is a wallet rpc and should be tested only when bitcoin core is compiled with wallet

ACKs for top commit:
  laanwj:
    Code review ACK 74c0d81b46
  theStack:
    tACK 74c0d81b46

Tree-SHA512: a98cc0df0fe70ee113a293cd4fd659c5bece47c17937d368193b65b150b331a2c694cdeb2792386f1a6deefb8d6750ed83ffa0ae6f9d13fa2b7625cd80bc692a
2021-10-04 11:11:45 +02:00
Samuel Dobson
573b4621cc
Merge bitcoin/bitcoin#17211: Allow fundrawtransaction and walletcreatefundedpsbt to take external inputs
928af61cdb allow send rpc take external inputs and solving data (Andrew Chow)
e39b5a5e7a Tests for funding with external inputs (Andrew Chow)
38f5642ccc allow fundtx rpcs to work with external inputs (Andrew Chow)
d5cfb864ae Allow Coin Selection be able to take external inputs (Andrew Chow)
a00eb388e8 Allow CInputCoin to also be constructed with COutPoint and CTxOut (Andrew Chow)

Pull request description:

  Currently `fundrawtransaction` and `walletcreatefundedpsbt` both do not allow external inputs as the wallet does not have the information necessary to estimate their fees.

  This PR adds an additional argument to both those RPCs which allows the user to specify solving data. This way, the wallet can use that solving data to estimate the size of those inputs. The solving data can be public keys, scripts, or descriptors.

ACKs for top commit:
  prayank23:
    reACK 928af61cdb
  meshcollider:
    Re-utACK 928af61cdb
  instagibbs:
    crACK 928af61cdb
  yanmaani:
    utACK 928af61.

Tree-SHA512: bc7a6ef8961a7f4971ea5985d75e2d6dc50c2a90b44c664a1c4b0f1be5c1c97823516358fdaab35771a4701dbefc0862127b1d0d4bfd02b4f20d2befa4434700
2021-10-04 22:08:46 +13:00
MarcoFalke
fa9d72a794
Remove unused ParseDouble and ParsePrechecks 2021-10-04 09:46:17 +02:00