Merge bitcoin/bitcoin#26411: [23.1] Backports

f8ed34d1a9 rpc: add non-regression test about deriveaddresses crash when index is 2147483647 (muxator)
d9f1c89e49 rpc: fix crash in deriveaddresses when derivation index is 2147483647 (muxator)
bbea830a96 Adjust `.tx/config` for new Transifex CLI (Hennadii Stepanov)

Pull request description:

  Backports:
  * https://github.com/bitcoin/bitcoin/pull/26275
  * https://github.com/bitcoin/bitcoin/pull/26321

  Will leave open to collect remaining backports before a 23.1.

ACKs for top commit:
  MarcoFalke:
    cherry-pick ACK f8ed34d1a9  🚝

Tree-SHA512: 2a96f66b0d81457a7017b0f4b041a7742008374d00a22d828502bfe170bfebb413e4e63382b10b9e2e250cb9e1be1a41030b8b6c5be42ffb23964808b12ee343
This commit is contained in:
MacroFake 2022-10-31 16:48:51 +01:00
commit 65c2f787c5
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
3 changed files with 9 additions and 2 deletions

View file

@ -1,7 +1,7 @@
[main]
host = https://www.transifex.com
[bitcoin.qt-translation-023x]
[o:bitcoin:p:bitcoin:r:qt-translation-023x]
file_filter = src/qt/locale/bitcoin_<lang>.xlf
source_file = src/qt/locale/bitcoin_en.xlf
source_lang = en

View file

@ -284,7 +284,7 @@ static RPCHelpMan deriveaddresses()
UniValue addresses(UniValue::VARR);
for (int i = range_begin; i <= range_end; ++i) {
for (int64_t i = range_begin; i <= range_end; ++i) {
FlatSigningProvider provider;
std::vector<CScript> scripts;
if (!desc->Expand(i, key_provider, scripts, provider)) {

View file

@ -44,6 +44,13 @@ class DeriveaddressesTest(BitcoinTestFramework):
combo_descriptor = descsum_create("combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0)")
assert_equal(self.nodes[0].deriveaddresses(combo_descriptor), ["mtfUoUax9L4tzXARpw1oTGxWyoogp52KhJ", "mtfUoUax9L4tzXARpw1oTGxWyoogp52KhJ", address, "2NDvEwGfpEqJWfybzpKPHF2XH3jwoQV3D7x"])
# Before #26275, bitcoind would crash when deriveaddresses was
# called with derivation index 2147483647, which is the maximum
# positive value of a signed int32, and - currently - the
# maximum value that the deriveaddresses bitcoin RPC call
# accepts as derivation index.
assert_equal(self.nodes[0].deriveaddresses(descsum_create("wpkh(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*)"), [2147483647, 2147483647]), ["bcrt1qtzs23vgzpreks5gtygwxf8tv5rldxvvsyfpdkg"])
hardened_without_privkey_descriptor = descsum_create("wpkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1'/1/0)")
assert_raises_rpc_error(-5, "Cannot derive script without private keys", self.nodes[0].deriveaddresses, hardened_without_privkey_descriptor)