mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-15 08:12:49 +02:00
Merge bitcoin-core/gui#875: Use WitnessV0KeyHash in TestAddAddressesToSendBook
fa982f1425
Use WitnessV0KeyHash in TestAddAddressesToSendBook (MarcoFalke) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/32558 Fixes https://github.com/bitcoin-core/gui/issues/874 This fixes a bug introduced in commitfafee85358
, which changed the type of the dummy address from `WitnessV0KeyHash` to `PKHash`. It was expected that this is fine, given that this is just a dummy address. However, the base58 characters can include the substring "io", leading to test failures later on. Fix it by just using `WitnessV0KeyHash` again. For reference, a passing test could look like: ``` Model contains 2 rows and 2 columns. --- Model Data --- Row 0 : "io - new A\tmxgkqJWAwfUwbgzZUsWrG1stKWV6fDn8YH" Row 1 : "io - new B\tmhsxP2yrYDQiEncT8HzKxQSFSFJmUsudsP" ------------------ ``` A failing test could look like: ``` Model contains 3 rows and 2 columns. --- Model Data --- Row 0 : "already here (s)\tmyDFZSKDQdPMMoSQgzkDtq2yioo8DA8qCX" Row 1 : "io - new A\tmsAqQKjMrbxYRDhGXBBJ3yUEQxj5Bf5Njz" Row 2 : "io - new B\tmtALQiit8dw33kznVfHDgE38ohfgz2Pchc" ------------------ FAIL! : AddressBookTests::addressBookTests() Compared values are not the same Actual (table_view->model()->rowCount()): 3 Expected (2) : 2 Loc: [qt/test/addressbooktests.cpp(219)] ``` ACKs for top commit: achow101: ACKfa982f1425
hebasto: ACKfa982f1425
, I have reviewed the code along with the related changes from https://github.com/bitcoin/bitcoin/pull/32511. Tree-SHA512: f55d7fe4193a0706e1a3ca1a2c0fbf2f04dc5b177699add00013ec56d64218ac85b80dad6e99f9fde26f4c9fca79f99e68ded057c5862364064404ac06b77176
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2017-2022 The Bitcoin Core developers
|
||||
// Copyright (c) 2017-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@ -85,8 +85,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
|
||||
}
|
||||
|
||||
auto build_address{[]() {
|
||||
CKey key = GenerateRandomKey();
|
||||
const PKHash dest{key.GetPubKey()};
|
||||
const WitnessV0KeyHash dest{GenerateRandomKey().GetPubKey()};
|
||||
return std::make_pair(dest, QString::fromStdString(EncodeDestination(dest)));
|
||||
}};
|
||||
|
||||
|
Reference in New Issue
Block a user