Skip to content

Commit 65c2f78

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#26411: [23.1] Backports
f8ed34d rpc: add non-regression test about deriveaddresses crash when index is 2147483647 (muxator) d9f1c89 rpc: fix crash in deriveaddresses when derivation index is 2147483647 (muxator) bbea830 Adjust `.tx/config` for new Transifex CLI (Hennadii Stepanov) Pull request description: Backports: * bitcoin/bitcoin#26275 * bitcoin/bitcoin#26321 Will leave open to collect remaining backports before a 23.1. ACKs for top commit: MarcoFalke: cherry-pick ACK f8ed34d 🚝 Tree-SHA512: 2a96f66b0d81457a7017b0f4b041a7742008374d00a22d828502bfe170bfebb413e4e63382b10b9e2e250cb9e1be1a41030b8b6c5be42ffb23964808b12ee343
2 parents 40b69fb + f8ed34d commit 65c2f78

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.tx/config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[main]
22
host = https://www.transifex.com
33

4-
[bitcoin.qt-translation-023x]
4+
[o:bitcoin:p:bitcoin:r:qt-translation-023x]
55
file_filter = src/qt/locale/bitcoin_<lang>.xlf
66
source_file = src/qt/locale/bitcoin_en.xlf
77
source_lang = en

src/rpc/misc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static RPCHelpMan deriveaddresses()
284284

285285
UniValue addresses(UniValue::VARR);
286286

287-
for (int i = range_begin; i <= range_end; ++i) {
287+
for (int64_t i = range_begin; i <= range_end; ++i) {
288288
FlatSigningProvider provider;
289289
std::vector<CScript> scripts;
290290
if (!desc->Expand(i, key_provider, scripts, provider)) {

test/functional/rpc_deriveaddresses.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ def run_test(self):
4444
combo_descriptor = descsum_create("combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0)")
4545
assert_equal(self.nodes[0].deriveaddresses(combo_descriptor), ["mtfUoUax9L4tzXARpw1oTGxWyoogp52KhJ", "mtfUoUax9L4tzXARpw1oTGxWyoogp52KhJ", address, "2NDvEwGfpEqJWfybzpKPHF2XH3jwoQV3D7x"])
4646

47+
# Before #26275, bitcoind would crash when deriveaddresses was
48+
# called with derivation index 2147483647, which is the maximum
49+
# positive value of a signed int32, and - currently - the
50+
# maximum value that the deriveaddresses bitcoin RPC call
51+
# accepts as derivation index.
52+
assert_equal(self.nodes[0].deriveaddresses(descsum_create("wpkh(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*)"), [2147483647, 2147483647]), ["bcrt1qtzs23vgzpreks5gtygwxf8tv5rldxvvsyfpdkg"])
53+
4754
hardened_without_privkey_descriptor = descsum_create("wpkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1'/1/0)")
4855
assert_raises_rpc_error(-5, "Cannot derive script without private keys", self.nodes[0].deriveaddresses, hardened_without_privkey_descriptor)
4956

0 commit comments

Comments
 (0)