v31.1-roots.1 · Commit 6: [PATCH 06/17] feat(wallet): preserve Roots signing and spend controls on v31
src/test/key_io_tests.cpp
Before: src/test/key_io_tests.cpp · After: src/test/key_io_tests.cpp
File metadata
index 2ea9c0b8efe319155784da6a9a225616e4ebe623..feb5dcbd55899867be8162d2728ca6caa9755d18 100644
Download original patch · Release notes
Diff rows 1–24 of 24. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/test/key_io_tests.cpp
CHANGED
|
@@ -20,6 +20,24 @@
|
|
|
20
20
|
|
|
21
21
|
BOOST_FIXTURE_TEST_SUITE(key_io_tests, BasicTestingSetup)
|
|
22
22
|
|
|
23
|
+
BOOST_AUTO_TEST_CASE(secure_wif_decode_matches_script_key_forms)
|
|
24
|
+
{
|
|
25
|
+
for (const bool compressed : {false, true}) {
|
|
26
|
+
CKey key;
|
|
27
|
+
key.MakeNewKey(compressed);
|
|
28
|
+
const std::string encoded{EncodeSecret(key)};
|
|
29
|
+
const SecureString secure{encoded.begin(), encoded.end()};
|
|
30
|
+
const CKey decoded{DecodeSecret(secure)};
|
|
31
|
+
BOOST_CHECK(decoded == key);
|
|
32
|
+
BOOST_CHECK_EQUAL(decoded.IsCompressed(), compressed);
|
|
33
|
+
SecureString embedded_nul{secure};
|
|
34
|
+
embedded_nul.push_back('\0');
|
|
35
|
+
BOOST_CHECK(!DecodeSecret(embedded_nul).IsValid());
|
|
36
|
+
BOOST_CHECK(!DecodeSecret(SecureString{"invalid-WIF"}).IsValid());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
23
41
|
// Goal: check that parsed keys match test payload
|
|
24
42
|
BOOST_AUTO_TEST_CASE(key_io_valid_parse)
|
|
25
43
|
{
|