Skip to content

Commit 7054d24

Browse files
committed
Merge #875: Use WitnessV0KeyHash in TestAddAddressesToSendBook
fa982f1 Use WitnessV0KeyHash in TestAddAddressesToSendBook (MarcoFalke) Pull request description: Fixes bitcoin/bitcoin#32558 Fixes #874 This fixes a bug introduced in commit fafee85, 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: ACK fa982f1 hebasto: ACK fa982f1, I have reviewed the code along with the related changes from bitcoin/bitcoin#32511. Tree-SHA512: f55d7fe4193a0706e1a3ca1a2c0fbf2f04dc5b177699add00013ec56d64218ac85b80dad6e99f9fde26f4c9fca79f99e68ded057c5862364064404ac06b77176
2 parents 4272966 + fa982f1 commit 7054d24

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/qt/test/addressbooktests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2022 The Bitcoin Core developers
1+
// Copyright (c) 2017-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -85,8 +85,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
8585
}
8686

8787
auto build_address{[]() {
88-
CKey key = GenerateRandomKey();
89-
const PKHash dest{key.GetPubKey()};
88+
const WitnessV0KeyHash dest{GenerateRandomKey().GetPubKey()};
9089
return std::make_pair(dest, QString::fromStdString(EncodeDestination(dest)));
9190
}};
9291

0 commit comments

Comments
 (0)