mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +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
|
|
@ -211,7 +211,7 @@ sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, CTransaction transac
|
|||
// and vice-versa)
|
||||
//
|
||||
result << OP_0;
|
||||
BOOST_FOREACH(CKey key, keys)
|
||||
BOOST_FOREACH(const CKey &key, keys)
|
||||
{
|
||||
vector<unsigned char> vchSig;
|
||||
BOOST_CHECK(key.Sign(hash, vchSig));
|
||||
|
|
@ -221,7 +221,7 @@ sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, CTransaction transac
|
|||
return result;
|
||||
}
|
||||
CScript
|
||||
sign_multisig(CScript scriptPubKey, CKey key, CTransaction transaction)
|
||||
sign_multisig(CScript scriptPubKey, const CKey &key, CTransaction transaction)
|
||||
{
|
||||
std::vector<CKey> keys;
|
||||
keys.push_back(key);
|
||||
|
|
@ -333,11 +333,13 @@ BOOST_AUTO_TEST_CASE(script_combineSigs)
|
|||
// Test the CombineSignatures function
|
||||
CBasicKeyStore keystore;
|
||||
vector<CKey> keys;
|
||||
vector<CPubKey> pubkeys;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
CKey key;
|
||||
key.MakeNewKey(i%2 == 1);
|
||||
keys.push_back(key);
|
||||
pubkeys.push_back(key.GetPubKey());
|
||||
keystore.AddKey(key);
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +392,7 @@ BOOST_AUTO_TEST_CASE(script_combineSigs)
|
|||
BOOST_CHECK(combined == scriptSig);
|
||||
|
||||
// Hardest case: Multisig 2-of-3
|
||||
scriptPubKey.SetMultisig(2, keys);
|
||||
scriptPubKey.SetMultisig(2, pubkeys);
|
||||
keystore.AddCScript(scriptPubKey);
|
||||
SignSignature(keystore, txFrom, txTo, 0);
|
||||
combined = CombineSignatures(scriptPubKey, txTo, 0, scriptSig, empty);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue