Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.cpp
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | for (const valtype &v : values) { | ||||
} | } | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
bool ProduceSignature(const BaseSignatureCreator &creator, | bool ProduceSignature(const BaseSignatureCreator &creator, | ||||
const CScript &fromPubKey, SignatureData &sigdata) { | const CScript &fromPubKey, SignatureData &sigdata) { | ||||
CScript script = fromPubKey; | |||||
std::vector<valtype> result; | std::vector<valtype> result; | ||||
txnouttype whichType; | txnouttype whichType; | ||||
bool solved = SignStep(creator, script, result, whichType); | bool solved = SignStep(creator, fromPubKey, result, whichType); | ||||
CScript subscript; | CScript subscript; | ||||
if (solved && whichType == TX_SCRIPTHASH) { | if (solved && whichType == TX_SCRIPTHASH) { | ||||
// Solver returns the subscript that needs to be evaluated; the final | // Solver returns the subscript that needs to be evaluated; the final | ||||
// scriptSig is the signatures from that and then the serialized | // scriptSig is the signatures from that and then the serialized | ||||
// subscript: | // subscript: | ||||
script = subscript = CScript(result[0].begin(), result[0].end()); | subscript = CScript(result[0].begin(), result[0].end()); | ||||
solved = solved && SignStep(creator, script, result, whichType) && | solved = solved && SignStep(creator, subscript, result, whichType) && | ||||
whichType != TX_SCRIPTHASH; | whichType != TX_SCRIPTHASH; | ||||
result.push_back( | result.push_back( | ||||
std::vector<uint8_t>(subscript.begin(), subscript.end())); | std::vector<uint8_t>(subscript.begin(), subscript.end())); | ||||
} | } | ||||
sigdata.scriptSig = PushAll(result); | sigdata.scriptSig = PushAll(result); | ||||
// Test solution | // Test solution | ||||
▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines |