Commit graph

34953 commits

Author SHA1 Message Date
muxator
8d24f56227 rpc: fix crash in deriveaddresses when derivation index is 2147483647
2147483647 is the maximum positive value of a signed int32, and - currently -
the maximum value that the deriveaddresses bitcoin RPC call accepts as
derivation index due to its input validation routines.

Before this change, when the derivation index (and thus range_end) reached
std::numeric_limits<int_32_t>::max(), the "i" variable in the for cycle (which
is declared as int, and as such 32 bits in size on most platforms) would be
incremented at the end of the first iteration and then warp back to
-2147483648. This caused SIGABRT in bitcoind and a core dump.

This change assigns "i" an explicit size of 64 bits on every platform,
sidestepping the problem.

Fixes #26274.

Github-Pull: #26275
Rebased-From: addf9d6502
(cherry picked from commit db20d278e212b2a393a331624184a61fab6c05c9)
2022-12-07 20:13:57 +00:00
Hennadii Stepanov
d5e9672686 Adjust .tx/config for new Transifex CLI
The old Transifex Command-Line Tool is considered deprecated (as of
January 2022) and will sunset on Nov 30, 2022.

See: https://github.com/transifex/cli/blob/devel/README.md#migrating-from-older-versions-of-the-client

An accompanying PR: https://github.com/bitcoin-core/bitcoin-maintainer-tools/pull/142

Github-Pull: #26321
Rebased-From: d6adbb7ee1
(cherry picked from commit d174db0f3ded1055555b998225090ebb130ca00d)
2022-12-07 20:13:57 +00:00
fanquake
02a93ab0ac doc: remove brew install sqlite from macOS docs
(cherry picked from commit 63d2ee9a50c5690df08f25e6840d10be8232f106)
2022-12-07 20:13:57 +00:00
Hennadii Stepanov
77c94f82d2 Prevent data race for pathHandlers
Github-Pull: bitcoin/bitcoin#25983
Rebased-From: 4296dde287
(cherry picked from commit 2c6c628ab95b018ac7ce6595954644bf9197ce35)
2022-12-07 20:13:57 +00:00
Pablo Greco
982fe6de9e Fix EOL in win certificate 2022-12-07 20:13:57 +00:00
Andrew Chow
ff81a7c59c windeploy: Renewed windows code signing certificate
Github-Pull: #25201
Rebased-From: 7e9fe6d800
(cherry picked from commit c4aacfbf6510261edc3b3f4b3d78db95fedfb92c)
2022-12-07 20:08:16 +00:00
Ryan Ofsky
d407fb6168 qt: Avoid crash on startup if int specified in settings.json
Fix GUI startup crash reported by Rspigler in
https://github.com/bitcoin/bitcoin/issues/24457 that happens if
settings.json contains an integer value for any of the configuration
options which GUI settings can currently clash with (-dbcache, -par,
-spendzeroconfchange, -signer, -upnp, -natpmp, -listen, -server, -proxy,
-proxy, -onion, -onion, -lang, and -prune).

Fix is a one-line change in ArgsManager::GetArg.

Github-Pull: bitcoin/bitcoin#24498
Rebased-From: 5b1aae12ca
(cherry picked from commit 344537cf04373d757522e042f29f25a0f9595404)
2022-12-07 20:08:16 +00:00
Martin Zumsande
856ba34e21 test: Call ceildiv helper with integer
It returns an incorrect result when called with a Decimal,
for which the "//" operator works differently.
Also drop unnecessary call to satoshi_round.

Github-Pull: #24239
Rebased-From: d1fab9d5d2
(cherry picked from commit 269553fe73b17f8acda3071a48836c66092d31d0)

NB: This code is commented out in elements and the cherry-pick is done
commenting out the code too.
2022-12-07 20:08:16 +00:00
Kittywhiskers Van Gogh
fcb6e6eb16 build: patch qt to explicitly define previously implicit header include
macOS Monterey has refactored some includes such that implicitly defined headers were no longer exposed and that in turns breaks building Qt on macOS 12.

Additional Resources:
 - https://bugreports.qt.io/browse/QTBUG-97855
 - https://codereview.qt-project.org/c/qt/qtbase/+/378706
 - https://code.qt.io/cgit/qt/qtbase.git/commit/src/plugins/platforms/cocoa?id=dece6f5840463ae2ddf927d65eb1b3680e34a547

Github-Pull: #23580
Rebased-From: 8196b0a2bc
(cherry picked from commit 801b0f05aaf974ab9b0e3f7b59948564638d593f)
2022-12-07 11:11:30 +00:00
Pablo Greco
e528b34ed8 Fix tests after backport of #22949 2022-12-07 11:11:30 +00:00
Andrew Chow
2c72896bb3 tests: Calculate fees more similarly to CFeeRate::GetFee
Because of floating point precision issues, not all of the rounding done
is always correct. To fix this, the fee calculation for
assert_fee_amount is changed to better reflect how CFeeRate::GetFee does
it.

First the feerate is converted to an int representing sat/kvb. Then this
is multiplied by the transaction size, divivided by 1000, and rounded up
to the nearest sat. The result is then converted back to BTC (divided by
1e8) and then rounded down to the nearest sat to avoid precision errors.

Github-Pull: #22949
Rebased-From: 80dc829be7
(cherry picked from commit c768bfa08af034c744402d4294cc323d653b97b8)
2022-12-07 11:11:30 +00:00
Andrew Chow
66d12ce52d tests: Test for assertion when feerate is rounded down
When calculating a txs absolute fee, if the fee is rounded down to the
nearest satoshi, it is possible for the coin selection algorithms to
undercalculate the fee needed. This can lead to an assertion error in
some situations. One such scenario is added to
rpc_fundrawtransaction.py.

Github-Pull: #22949
Rebased-From: ce2cc44afd
(cherry picked from commit f66bc42957ad2e86982c8c487f821683d3009b43)
2022-12-07 11:11:30 +00:00
Andrew Chow
5f376a3588 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.

Github-Pull: #22949
Rebased-From: 0fbaef9676
(cherry picked from commit bd7e08e36bf2e1238ddf8cc01433f8db82f848c9)
2022-12-07 11:11:30 +00:00
Sebastian Falbesoner
ff712274d9 wallet: fix segfault by avoiding invalid default-ctored external_spk_managers entry
In the method `CWallet::LoadActiveScriptPubKeyMan`, the map
`external_spk_managers` (or `internal_spk_managers`, if parameter
`internal` is false) is accessed via std::map::operator[], which means
that a default-ctored entry is created with a null-pointer as value, if
the key doesn't exist.  As soon as this value is dereferenced, a
segmentation fault occurs, e.g. in `CWallet::KeypoolCountExternalKeys`.

The bevaviour can be reproduced by the following steps (starting with empty regtest datadir):

$ ./src/bitcoind -regtest -daemon
$ ./src/bitcoin-cli -regtest -named createwallet_name=wallet descriptors=true blank=true
$ cat regtest-descriptors.txt
[
  {
    "desc": "tr([e4445899/49'/1'/0']tprv8ZgxMBicQKsPd8jCeBWsYLEoWxbVgzJDatJ7XkwQ6G3uF4FsHuaziHQ5JZAW4K515nj6kVVwPaNWZSMEcR7aFCwL4tQqTcaoprMKTTtm6Zg/1/*)#mr3llm7f",
    "timestamp": 1634652324,
    "active": true,
    "internal": true,
    "range": [
      0,
      999
    ],
    "next": 0
  }
]
$ ./src/bitcoin-cli -regtest importdescriptors "$(cat regtest-descriptors.txt)"
[
  {
    "success": true
  }
]
$ ./src/bitcoin-cli -regtest getwalletinfo
error: timeout on transient error: Could not connect to the server 127.0.0.1:18443 (error code 1 - "EOF reached")

Bug reported by Josef Vondrlik (josef-v).

Github-Pull: #23333
Rebased-From: 6911ab95f1
(cherry picked from commit 227ae652542451834faddbaffb54fc384e9156e6)
2022-12-07 11:11:30 +00:00
Joan Karadimov
48a01ec059 refactor: include a missing <limits> header in fs.cpp
... needed for std::numeric_limits<T>::max on WIN32

Github-Pull: #23335
Rebased-From: 077a875d94
(cherry picked from commit 282863a7e9ddfb14ef02182945ca1978699dbe52)
2022-12-07 11:11:30 +00:00
Jon Atack
5ce127803e consensus: don't call GetBlockPos in ReadBlockFromDisk without lock
Github-Pull: #22895
Rebased-From: 350e034e64
(cherry picked from commit 7febe4f3c7f482390c4aa6fc528e2ee3fb34b142)
2022-12-07 11:11:30 +00:00
Saibato
ee109b4f28 the result of CWallet::IsHDEnabled() was initialized with true.
But in case of no keys or a blank hd wallet the iterator would be skipped
and not set to false but true, since the loop would be not entered.

That had resulted in a wrong return and subsequent false HD and watch-only
icon display in gui when reloading a wallet after closing.

Update src/wallet/wallet.cpp

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: #22781
Rebased-From: 8733a8e84c
(cherry picked from commit c671c6f4706d17cccfe5c35950235f8777a7975f)
2022-12-07 11:11:30 +00:00
Hennadii Stepanov
205f84bfb7 build, qt: Fix typo in QtInputSupport check
Github-Pull: #22820
Rebased-From: e251726aff
(cherry picked from commit a5a153882609c8d77118a88a9a440d4966c8d0ef)
2022-12-07 11:11:30 +00:00
fanquake
90ffd0c1b8 system: skip trying to set the locale on NetBSD
Just treat it the same as the other BSDs.

Fixes #17379.

Github-Pull: #22390
Rebased-From: fdd71448e7
(cherry picked from commit c95b188fc08387d0a89668e56bce3a4fad1ee611)
2022-12-07 11:11:30 +00:00
Carl Dong
1fa2661133 guix: Fix powerpc64(le) dynamic linker name
I used Guix's values for the powerpc64(le) dynamic linkers, and the
/lib-prefix seems to be a Guix-ism rather than standard. The standard
path for the linker-loaders start with /lib64.

I've taken the new loader values from SYSDEP_KNOWN_INTERPRETER_NAMES in
glibc's sysdeps/unix/sysv/linux/powerpc/ldconfig.h file.

For future reference, loader path values can also be found on glibc's
website: https://sourceware.org/glibc/wiki/ABIList?action=recall&rev=16

Github-Pull: #23148
Rebased-From: b96adcbfae
(cherry picked from commit c1cdeddd905b5444eac330d565b297b3d4941c5d)
2022-12-07 11:11:30 +00:00
MarcoFalke
df09befb2f Fix (inverse) meaning of -persistmempool
Github-Pull: #23061
Rebased-From: faff17bbde
(cherry picked from commit db76db7329f6357c5226cd08611fe0f669c002af)
2022-12-07 11:11:30 +00:00
W. J. van der Laan
92131fa0e9 build: Restrict check for CRC32C intrinsic to aarch64
`crc32c`'s hardware accelerated code doesn't handle ARM 32-bit at all.
Make the check in `configure.ac` check for this architecture explicitly.

For the release binaries, the current `configure.ac` check happens
to work: it enables it on aarch64 but disables it for armhf. However
some combination of compiler version and settings might ostensibly cause
this check to succeed on armhf (as reported on IRC). So make the 64-bit
platform requirement explicit.

Github-Pull: #23045
Rebased-From: f2747d1602
(cherry picked from commit 85c78e08ec857e51a9748d1a2492d1d3794b221a)
2022-12-07 11:11:30 +00:00
fanquake
7f02d38c2d build: fix depends zeromq dash compatibility
Picks upstream commit 9a397666d28ca5f3c0d8233be3d39b2206555f45 to fix
dash compatibility. This fixes building zeromq in our CentOS 8 CI. This
is my preferred fix over backporting a zeromq update (which would
contain this change).

(cherry picked from commit 685ac6ad2e48093d69cccd1d242ed36a326cf90b)
2022-12-07 11:11:30 +00:00
fanquake
e6cdef6dc4 build: libXau 1.0.9
Github-Pull: #23489
Rebased-From: fc65127244
(cherry picked from commit 4b92a6b42cb80eafa62fe7987860e8925b8c2361)
2022-12-07 11:11:30 +00:00
Martin Zumsande
3b672e7196 rpc: Capture potentially large UniValue by ref for rpcdoccheck
Github-Pull: 25237
Rebased-From: 20ff4991e5
(cherry picked from commit 7fcac96597)
2022-12-07 10:50:06 +00:00
Pablo Greco
dff0e8202b Merge branch 'master' into elements_22_1_rc1 2022-12-07 10:47:10 +00:00
Steven Roose
29e62db08e
Merge ElementsProject/elements#1195: Remove duplicated code from merge
2c7335fecc Remove duplicated code from merge (Pablo Greco)

Pull request description:

  Remove duplicated code that looks like a bad merge in the 21-22 timeframe

ACKs for top commit:
  delta1:
    utACK 2c7335f
  apoelstra:
    utACK 2c7335fecc

Tree-SHA512: 19332412530b898783de7ba705108552dcb17a8e54987d9c916f15aeb33cd94063a3957578edd77fedc97650b224949e5e13a5e25cc045959f3d72567a773e5a
2022-11-28 19:46:32 +00:00
Pablo Greco
2c7335fecc Remove duplicated code from merge 2022-11-25 12:54:09 -03:00
Pablo Greco
679f620a07
Merge pull request #928 from stevenroose/already-have-block
Have testproposedblock return RPC_VERIFY_ALREADY_IN_CHAIN
2022-11-24 12:37:34 -03:00
Steven Roose
30f02624c7
Have testproposedblock return RPC_VERIFY_ALREADY_IN_CHAIN
Instead of RPC_VERIFY_ERROR when the block is already in the chain.
2022-11-24 14:08:51 +00:00
James Dorfman
5c82e351a9
Merge pull request #1194 from andreabonel/add_back_missing_field_in_getblock
Add missing field 'signblock_challenge' back to getblock
2022-11-23 11:23:54 -05:00
Andrew Poelstra
1339dae913
Merge ElementsProject/elements#1167: Add native support for liquidtestnet
c6e074e25b liquidtestnet: Fix chain name in windows installer (Pablo Greco)
d0f391cfdb liquidtestnet: Add style for Elements-Qt (Pablo Greco)
48ddfbf8d7 liquidtestnet: Add fixed seeds (Pablo Greco)
3b34c8e927 liquidtestnet: Add seed nodes (Pablo Greco)
0d1964766f liquidtestnet: Accept multi OP_RETURN (Pablo Greco)
f955cb3d9c liquidtestnet: Add chainparams (Pablo Greco)
0fa20d006d CCustomParams: Move some defaults away from UpdateFromArgs (Pablo Greco)
e9df51121f Add text version of the fixed seeds for liquidv1 and liquidtestnet (Pablo Greco)

Pull request description:

  Currently using liquidtestnet requires a big config file, which is error-prone and uncomfortable for users, this MR adds support for just using `-chain=liquidtestnet`.

  There are a few things that need to be discussed/addressed

  1. Main port (currently set to 18891 because that's the one used originally, and the one that's configured in `liquidtestnet.com`)
  1. RPC and extra ports, I just chose some non-overlapping ports that are "close" to the ones in the other liquid/elements networks.
  1. Icon color, I just used something different than `liquidv1` and `elementsregtest`, suggestions accepted 😉
  1. `liquid-testnet.blockstream.com` is still using port 18892, it will be changed to 18891 soon.
  1. both seeds are just CNAME dns records at the moment, they should be changed to real seed nodes (no changes in code required, but important for review)

ACKs for top commit:
  delta1:
    ACK c6e074e
  wintercooled:
    ACK c6e074e25b
  apoelstra:
    utACK c6e074e25b

Tree-SHA512: 48c17b8b90ba5a33ae987935ffb368737167f6ca5ae772f6dd8c0c5e7efb39355d81e2677cd02d3e22984f2592fdd67caaf838003902b3c827f6ade01f18a040
2022-11-23 15:31:39 +00:00
Andrea Bonel
5d496b81f7 Add missing field 'signblock_challenge' back to getblock 2022-11-22 18:12:41 -03:00
Pablo Greco
58b5fa0dbf
Merge pull request #1186 from achow101/createfunded-explicit-value
Add include_explicit to walletcreatefundedpsbt
2022-11-21 17:15:58 -03:00
Pablo Greco
9c067622cf
Merge pull request #1192 from wintercooled/fix-pset-example
fix pset swap example
2022-11-18 19:39:32 -03:00
wintercooled
437e1e79f7 fix pset swap example 2022-11-18 12:34:18 +00:00
James Dorfman
35aa7168b7
Merge pull request #1188 from psgreco/elements-22_0_2
Bump version to 22.0.2
2022-10-31 10:24:03 -04:00
Pablo Greco
44730b5d0c Bump version to 22.0.2 2022-10-31 08:30:15 -03:00
Andrew Chow
42cbdc81a6 test: Test for explicit values and assets and their proofs 2022-10-18 16:52:31 -04:00
Andrew Chow
9dbf0b6f55 wallet, rpc: Add include_explicit to walletcreatefundedpsbt 2022-10-18 16:52:31 -04:00
Andrew Chow
a584133bd6 wallet: Add include_explicit to FillPSBT 2022-10-18 16:52:31 -04:00
Andrew Chow
462c873639 blindpsbt: Expose CreateBlind{Asset,Value}Proof
Make these two functions available to external callers.
CreateBlindValueProof is a wrapper around the static function to avoid
requiring callers to parse things into secp256k1 objects.
2022-10-18 16:52:31 -04:00
Pablo Greco
816585db1a
Merge pull request #1182 from jgriffiths/fix_blind_reissuance_amount_proof_output
rpc: decodepsbt: fix check for blind_reissuance_amount_proof output
2022-10-18 09:32:07 -03:00
Byron Hambly
b0813e0bb7
Merge pull request #1185 from psgreco/elements-22_0_2rc1
Elements 22 0 2rc1
2022-10-17 14:20:21 +02:00
Pablo Greco
8b3dabd543 Bump version to 22.0.2rc1 2022-10-16 10:06:28 -03:00
Pablo Greco
6624455ec2 Merge branch 'master' into elements-22_0_2rc1 2022-10-16 10:05:35 -03:00
Pablo Greco
fde2277034
Merge pull request #1168 from andreabonel/fix_windows_installer_icons
Fix nsis-header.bmp and nsis-wizard.bmp for Elements Windows installer
2022-10-15 18:10:00 -03:00
Pablo Greco
eca4cd9259
Merge pull request #1169 from andreabonel/fix_windows_elements_company
Fix company for Windows exes
2022-10-15 18:09:44 -03:00
Pablo Greco
f09a276eb0
Merge pull request #1171 from andreabonel/master-replace-icons
Replace icons
2022-10-15 18:09:26 -03:00
Pablo Greco
38eacf73e3
Merge pull request #1175 from andreabonel/fix_windows_uninstaller_icon
Fix Windows uninstaller icon in "Add or remove programs"
2022-10-15 18:09:08 -03:00