mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
CSecret/CKey -> CKey/CPubKey split/refactor
This commit is contained in:
parent
5d891489ab
commit
dfa23b94c2
26 changed files with 578 additions and 609 deletions
|
|
@ -133,9 +133,8 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_parse)
|
|||
// Note: CBitcoinSecret::SetString tests isValid, whereas CBitcoinAddress does not!
|
||||
BOOST_CHECK_MESSAGE(secret.SetString(exp_base58string), "!SetString:"+ strTest);
|
||||
BOOST_CHECK_MESSAGE(secret.IsValid(), "!IsValid:" + strTest);
|
||||
bool fCompressedOut = false;
|
||||
CSecret privkey = secret.GetSecret(fCompressedOut);
|
||||
BOOST_CHECK_MESSAGE(fCompressedOut == isCompressed, "compressed mismatch:" + strTest);
|
||||
CKey privkey = secret.GetKey();
|
||||
BOOST_CHECK_MESSAGE(privkey.IsCompressed() == isCompressed, "compressed mismatch:" + strTest);
|
||||
BOOST_CHECK_MESSAGE(privkey.size() == exp_payload.size() && std::equal(privkey.begin(), privkey.end(), exp_payload.begin()), "key mismatch:" + strTest);
|
||||
|
||||
// Private key must be invalid public key
|
||||
|
|
@ -187,8 +186,11 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_gen)
|
|||
if(isPrivkey)
|
||||
{
|
||||
bool isCompressed = find_value(metadata, "isCompressed").get_bool();
|
||||
CKey key;
|
||||
key.Set(exp_payload.begin(), exp_payload.end(), isCompressed);
|
||||
assert(key.IsValid());
|
||||
CBitcoinSecret secret;
|
||||
secret.SetSecret(CSecret(exp_payload.begin(), exp_payload.end()), isCompressed);
|
||||
secret.SetKey(key);
|
||||
BOOST_CHECK_MESSAGE(secret.ToString() == exp_base58string, "result mismatch: " + strTest);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue