mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
refactor: Extract RIPEMD160
To directly return a CRIPEMD160 hash from data. Incidentally, decoding this acronym: * RIPEMD -> RIPE Message Digest * RIPE -> RACE Integrity Primitives Evaluation * RACE -> Research and Development in Advanced Communications Technologies in Europe
This commit is contained in:
parent
7386da7a0b
commit
6879be691b
8 changed files with 27 additions and 20 deletions
|
|
@ -285,7 +285,6 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
|||
std::vector<valtype>& ret, TxoutType& whichTypeRet, SigVersion sigversion, SignatureData& sigdata)
|
||||
{
|
||||
CScript scriptRet;
|
||||
uint160 h160;
|
||||
ret.clear();
|
||||
std::vector<unsigned char> sig;
|
||||
|
||||
|
|
@ -314,8 +313,8 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
|||
ret.push_back(ToByteVector(pubkey));
|
||||
return true;
|
||||
}
|
||||
case TxoutType::SCRIPTHASH:
|
||||
h160 = uint160(vSolutions[0]);
|
||||
case TxoutType::SCRIPTHASH: {
|
||||
uint160 h160{vSolutions[0]};
|
||||
if (GetCScript(provider, sigdata, CScriptID{h160}, scriptRet)) {
|
||||
ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
|
||||
return true;
|
||||
|
|
@ -323,7 +322,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
|||
// Could not find redeemScript, add to missing
|
||||
sigdata.missing_redeem_script = h160;
|
||||
return false;
|
||||
|
||||
}
|
||||
case TxoutType::MULTISIG: {
|
||||
size_t required = vSolutions.front()[0];
|
||||
ret.push_back(valtype()); // workaround CHECKMULTISIG bug
|
||||
|
|
@ -349,8 +348,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
|||
return true;
|
||||
|
||||
case TxoutType::WITNESS_V0_SCRIPTHASH:
|
||||
CRIPEMD160().Write(vSolutions[0].data(), vSolutions[0].size()).Finalize(h160.begin());
|
||||
if (GetCScript(provider, sigdata, CScriptID{h160}, scriptRet)) {
|
||||
if (GetCScript(provider, sigdata, CScriptID{RIPEMD160(vSolutions[0])}, scriptRet)) {
|
||||
ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue