Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.cpp
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | switch (whichTypeRet) { | ||||
sigdata.missing_redeem_script = h160; | sigdata.missing_redeem_script = h160; | ||||
return false; | return false; | ||||
case TX_MULTISIG: { | case TX_MULTISIG: { | ||||
size_t required = vSolutions.front()[0]; | size_t required = vSolutions.front()[0]; | ||||
// workaround CHECKMULTISIG bug | // workaround CHECKMULTISIG bug | ||||
ret.push_back(valtype()); | ret.push_back(valtype()); | ||||
for (size_t i = 1; i < vSolutions.size() - 1; ++i) { | for (size_t i = 1; i < vSolutions.size() - 1; ++i) { | ||||
CPubKey pubkey = CPubKey(vSolutions[i]); | CPubKey pubkey = CPubKey(vSolutions[i]); | ||||
if (ret.size() < required + 1 && | // We need to always call CreateSig in order to fill sigdata | ||||
CreateSig(creator, sigdata, provider, sig, pubkey, | // with all possible signatures that we can create. This will | ||||
// allow further PSBT processing to work as it needs all | |||||
// possible signature and pubkey pairs | |||||
if (CreateSig(creator, sigdata, provider, sig, pubkey, | |||||
scriptPubKey)) { | scriptPubKey)) { | ||||
if (ret.size() < required + 1) { | |||||
ret.push_back(std::move(sig)); | ret.push_back(std::move(sig)); | ||||
} | } | ||||
} | } | ||||
} | |||||
bool ok = ret.size() == required + 1; | bool ok = ret.size() == required + 1; | ||||
for (size_t i = 0; i + ret.size() < required + 1; ++i) { | for (size_t i = 0; i + ret.size() < required + 1; ++i) { | ||||
ret.push_back(valtype()); | ret.push_back(valtype()); | ||||
} | } | ||||
return ok; | return ok; | ||||
} | } | ||||
default: | default: | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |