Bitcoin ABC 0.34.2
P2P Digital Currency
sign.cpp
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include <script/sign.h>
7
8#include <consensus/amount.h>
9#include <key.h>
10#include <policy/policy.h>
12#include <script/script.h>
14#include <script/solver.h>
15#include <uint256.h>
16
17typedef std::vector<uint8_t> valtype;
18
20 const CMutableTransaction &tx, unsigned int input_idx, const Amount &amount,
21 SigHashType sig_hash_type)
22 : m_txto(tx), nIn(input_idx), amount(amount), sigHashType(sig_hash_type),
23 checker(&m_txto, nIn, amount) {}
24
26 const SigningProvider &provider, std::vector<uint8_t> &vchSig,
27 const CKeyID &address, const CScript &scriptCode) const {
28 CKey key;
29 if (!provider.GetKey(address, key)) {
30 return false;
31 }
32
33 // If an input is signed with SIGHASH_SINGLE but there is no output at
34 // the same index, the signature commits to no output at all. Which means
35 // such a signature stays valid if the output is swapped, which is a
36 // footgun. So don't produce it.
38 nIn >= m_txto.vout.size()) {
39 return false;
40 }
41
42 uint256 hash = SignatureHash(scriptCode, m_txto, nIn, sigHashType, amount);
43 if (!key.SignECDSA(hash, vchSig)) {
44 return false;
45 }
46
47 vchSig.push_back(uint8_t(sigHashType.getRawSigHashType()));
48 return true;
49}
50
51static bool GetCScript(const SigningProvider &provider,
52 const SignatureData &sigdata, const CScriptID &scriptid,
53 CScript &script) {
54 if (provider.GetCScript(scriptid, script)) {
55 return true;
56 }
57 // Look for scripts in SignatureData
58 if (CScriptID(sigdata.redeem_script) == scriptid) {
59 script = sigdata.redeem_script;
60 return true;
61 }
62 return false;
63}
64
65static bool GetPubKey(const SigningProvider &provider,
66 const SignatureData &sigdata, const CKeyID &address,
67 CPubKey &pubkey) {
68 // Look for pubkey in all partial sigs
69 const auto it = sigdata.signatures.find(address);
70 if (it != sigdata.signatures.end()) {
71 pubkey = it->second.first;
72 return true;
73 }
74 // Look for pubkey in pubkey list
75 const auto &pk_it = sigdata.misc_pubkeys.find(address);
76 if (pk_it != sigdata.misc_pubkeys.end()) {
77 pubkey = pk_it->second.first;
78 return true;
79 }
80 // Query the underlying provider
81 return provider.GetPubKey(address, pubkey);
82}
83
84static bool CreateSig(const BaseSignatureCreator &creator,
85 SignatureData &sigdata, const SigningProvider &provider,
86 std::vector<uint8_t> &sig_out, const CPubKey &pubkey,
87 const CScript &scriptcode) {
88 CKeyID keyid = pubkey.GetID();
89 const auto it = sigdata.signatures.find(keyid);
90 if (it != sigdata.signatures.end()) {
91 sig_out = it->second.second;
92 return true;
93 }
94 KeyOriginInfo info;
95 if (provider.GetKeyOrigin(keyid, info)) {
96 sigdata.misc_pubkeys.emplace(keyid,
97 std::make_pair(pubkey, std::move(info)));
98 }
99 if (creator.CreateSig(provider, sig_out, keyid, scriptcode)) {
100 auto i = sigdata.signatures.emplace(keyid, SigPair(pubkey, sig_out));
101 assert(i.second);
102 return true;
103 }
104 // Could not make signature or signature not found, add keyid to missing
105 sigdata.missing_sigs.push_back(keyid);
106 return false;
107}
108
116static bool SignStep(const SigningProvider &provider,
117 const BaseSignatureCreator &creator,
118 const CScript &scriptPubKey, std::vector<valtype> &ret,
119 TxoutType &whichTypeRet, SignatureData &sigdata) {
120 CScript scriptRet;
121 uint160 h160;
122 ret.clear();
123 std::vector<uint8_t> sig;
124
125 std::vector<valtype> vSolutions;
126 whichTypeRet = Solver(scriptPubKey, vSolutions);
127
128 switch (whichTypeRet) {
131 return false;
133 if (!CreateSig(creator, sigdata, provider, sig,
134 CPubKey(vSolutions[0]), scriptPubKey)) {
135 return false;
136 }
137 ret.push_back(std::move(sig));
138 return true;
140 CKeyID keyID = CKeyID(uint160(vSolutions[0]));
141 CPubKey pubkey;
142 if (!GetPubKey(provider, sigdata, keyID, pubkey)) {
143 // Pubkey could not be found, add to missing
144 sigdata.missing_pubkeys.push_back(keyID);
145 return false;
146 }
147 if (!CreateSig(creator, sigdata, provider, sig, pubkey,
148 scriptPubKey)) {
149 return false;
150 }
151 ret.push_back(std::move(sig));
152 ret.push_back(ToByteVector(pubkey));
153 return true;
154 }
156 h160 = uint160(vSolutions[0]);
157 if (GetCScript(provider, sigdata, CScriptID{h160}, scriptRet)) {
158 ret.push_back(
159 std::vector<uint8_t>(scriptRet.begin(), scriptRet.end()));
160 return true;
161 }
162 // Could not find redeemScript, add to missing
163 sigdata.missing_redeem_script = h160;
164 return false;
165 case TxoutType::MULTISIG: {
166 size_t required = vSolutions.front()[0];
167 // workaround CHECKMULTISIG bug
168 ret.push_back(valtype());
169 for (size_t i = 1; i < vSolutions.size() - 1; ++i) {
170 CPubKey pubkey = CPubKey(vSolutions[i]);
171 // We need to always call CreateSig in order to fill sigdata
172 // with all possible signatures that we can create. This will
173 // allow further PSBT processing to work as it needs all
174 // possible signature and pubkey pairs
175 if (CreateSig(creator, sigdata, provider, sig, pubkey,
176 scriptPubKey)) {
177 if (ret.size() < required + 1) {
178 ret.push_back(std::move(sig));
179 }
180 }
181 }
182 bool ok = ret.size() == required + 1;
183 for (size_t i = 0; i + ret.size() < required + 1; ++i) {
184 ret.push_back(valtype());
185 }
186 return ok;
187 }
188 default:
189 return false;
190 }
191}
192
193static CScript PushAll(const std::vector<valtype> &values) {
194 CScript result;
195 for (const valtype &v : values) {
196 if (v.size() == 0) {
197 result << OP_0;
198 } else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
199 result << CScript::EncodeOP_N(v[0]);
200 } else if (v.size() == 1 && v[0] == 0x81) {
201 result << OP_1NEGATE;
202 } else {
203 result << v;
204 }
205 }
206
207 return result;
208}
209
211 const BaseSignatureCreator &creator,
212 const CScript &fromPubKey, SignatureData &sigdata) {
213 if (sigdata.complete) {
214 return true;
215 }
216
217 std::vector<valtype> result;
218 TxoutType whichType;
219 bool solved =
220 SignStep(provider, creator, fromPubKey, result, whichType, sigdata);
221 CScript subscript;
222
223 if (solved && whichType == TxoutType::SCRIPTHASH) {
224 // Solver returns the subscript that needs to be evaluated; the final
225 // scriptSig is the signatures from that and then the serialized
226 // subscript:
227 subscript = CScript(result[0].begin(), result[0].end());
228 sigdata.redeem_script = subscript;
229
230 solved = solved &&
231 SignStep(provider, creator, subscript, result, whichType,
232 sigdata) &&
233 whichType != TxoutType::SCRIPTHASH;
234 result.push_back(
235 std::vector<uint8_t>(subscript.begin(), subscript.end()));
236 }
237
238 sigdata.scriptSig = PushAll(result);
239
240 // Test solution
241 sigdata.complete =
242 solved && VerifyScript(sigdata.scriptSig, fromPubKey,
244 return sigdata.complete;
245}
246
247namespace {
248class SignatureExtractorChecker final : public BaseSignatureChecker {
249private:
250 SignatureData &sigdata;
251 BaseSignatureChecker &checker;
252
253public:
254 SignatureExtractorChecker(SignatureData &sigdata_,
255 BaseSignatureChecker &checker_)
256 : sigdata(sigdata_), checker(checker_) {}
257 bool CheckSig(const std::vector<uint8_t> &scriptSig,
258 const std::vector<uint8_t> &vchPubKey,
259 const CScript &scriptCode, uint32_t flags) const override {
260 if (checker.CheckSig(scriptSig, vchPubKey, scriptCode, flags)) {
261 CPubKey pubkey(vchPubKey);
262
263 sigdata.signatures.emplace(pubkey.GetID(),
264 SigPair(pubkey, scriptSig));
265 return true;
266 }
267 return false;
268 }
269};
270
271struct Stacks {
272 std::vector<valtype> script;
273
274 Stacks() = delete;
275 Stacks(const Stacks &) = delete;
276 explicit Stacks(const SignatureData &data) {
277 if (data.scriptSig.IsPushOnly()) {
280 }
281 }
282};
283} // namespace
284
285// Extracts signatures and scripts from incomplete scriptSigs. Please do not
286// extend this, use PSBT instead
288 unsigned int nIn, const CTxOut &txout) {
289 SignatureData data;
290 assert(tx.vin.size() > nIn);
291 data.scriptSig = tx.vin[nIn].scriptSig;
292 Stacks stack(data);
293
294 // Get signatures
295 MutableTransactionSignatureChecker tx_checker(&tx, nIn, txout.nValue);
296 SignatureExtractorChecker extractor_checker(data, tx_checker);
297 if (VerifyScript(data.scriptSig, txout.scriptPubKey,
298 STANDARD_SCRIPT_VERIFY_FLAGS, extractor_checker)) {
299 data.complete = true;
300 return data;
301 }
302
303 // Get scripts
304 std::vector<std::vector<uint8_t>> solutions;
305 TxoutType script_type = Solver(txout.scriptPubKey, solutions);
306 CScript next_script = txout.scriptPubKey;
307
308 if (script_type == TxoutType::SCRIPTHASH && !stack.script.empty() &&
309 !stack.script.back().empty()) {
310 // Get the redeemScript
311 CScript redeem_script(stack.script.back().begin(),
312 stack.script.back().end());
313 data.redeem_script = redeem_script;
314 next_script = std::move(redeem_script);
315
316 // Get redeemScript type
317 script_type = Solver(next_script, solutions);
318 stack.script.pop_back();
319 }
320 if (script_type == TxoutType::MULTISIG && !stack.script.empty()) {
321 // Build a map of pubkey -> signature by matching sigs to pubkeys:
322 assert(solutions.size() > 1);
323 unsigned int num_pubkeys = solutions.size() - 2;
324 unsigned int last_success_key = 0;
325 for (const valtype &sig : stack.script) {
326 for (unsigned int i = last_success_key; i < num_pubkeys; ++i) {
327 const valtype &pubkey = solutions[i + 1];
328 // We either have a signature for this pubkey, or we have found
329 // a signature and it is valid
330 if (data.signatures.count(CPubKey(pubkey).GetID()) ||
331 extractor_checker.CheckSig(sig, pubkey, next_script,
333 last_success_key = i + 1;
334 break;
335 }
336 }
337 }
338 }
339
340 return data;
341}
342
343void UpdateInput(CTxIn &input, const SignatureData &data) {
344 input.scriptSig = data.scriptSig;
345}
346
348 if (complete) {
349 return;
350 }
351 if (sigdata.complete) {
352 *this = std::move(sigdata);
353 return;
354 }
355 if (redeem_script.empty() && !sigdata.redeem_script.empty()) {
357 }
358 signatures.insert(std::make_move_iterator(sigdata.signatures.begin()),
359 std::make_move_iterator(sigdata.signatures.end()));
360}
361
362bool SignSignature(const SigningProvider &provider, const CScript &fromPubKey,
363 CMutableTransaction &txTo, unsigned int nIn,
364 const Amount amount, SigHashType sigHashType) {
365 assert(nIn < txTo.vin.size());
366
367 MutableTransactionSignatureCreator creator(txTo, nIn, amount, sigHashType);
368
369 SignatureData sigdata;
370 bool ret = ProduceSignature(provider, creator, fromPubKey, sigdata);
371 UpdateInput(txTo.vin.at(nIn), sigdata);
372 return ret;
373}
374
375bool SignSignature(const SigningProvider &provider, const CTransaction &txFrom,
376 CMutableTransaction &txTo, unsigned int nIn,
377 SigHashType sigHashType) {
378 assert(nIn < txTo.vin.size());
379 const CTxIn &txin = txTo.vin[nIn];
380 assert(txin.prevout.GetN() < txFrom.vout.size());
381 const CTxOut &txout = txFrom.vout[txin.prevout.GetN()];
382
383 return SignSignature(provider, txout.scriptPubKey, txTo, nIn, txout.nValue,
384 sigHashType);
385}
386
387namespace {
389class DummySignatureChecker final : public BaseSignatureChecker {
390public:
391 DummySignatureChecker() = default;
392 bool CheckSig(const std::vector<uint8_t> &scriptSig,
393 const std::vector<uint8_t> &vchPubKey,
394 const CScript &scriptCode, uint32_t flags) const override {
395 return true;
396 }
397};
398const DummySignatureChecker DUMMY_CHECKER;
399
400class DummySignatureCreator final : public BaseSignatureCreator {
401private:
402 char m_r_len = 32;
403 char m_s_len = 32;
404
405public:
406 DummySignatureCreator(char r_len, char s_len)
407 : m_r_len(r_len), m_s_len(s_len) {}
408 const BaseSignatureChecker &Checker() const override {
409 return DUMMY_CHECKER;
410 }
411 bool CreateSig(const SigningProvider &provider,
412 std::vector<uint8_t> &vchSig, const CKeyID &keyid,
413 const CScript &scriptCode) const override {
414 // Create a dummy signature that is a valid DER-encoding
415 vchSig.assign(m_r_len + m_s_len + 7, '\000');
416 vchSig[0] = 0x30;
417 vchSig[1] = m_r_len + m_s_len + 4;
418 vchSig[2] = 0x02;
419 vchSig[3] = m_r_len;
420 vchSig[4] = 0x01;
421 vchSig[4 + m_r_len] = 0x02;
422 vchSig[5 + m_r_len] = m_s_len;
423 vchSig[6 + m_r_len] = 0x01;
424 vchSig[6 + m_r_len + m_s_len] = SIGHASH_ALL | SIGHASH_FORKID;
425 return true;
426 }
427};
428
429} // namespace
430
432 DummySignatureCreator(32, 32);
434 DummySignatureCreator(33, 32);
435
436bool IsSolvable(const SigningProvider &provider, const CScript &script) {
437 // This check is to make sure that the script we created can actually be
438 // solved for and signed by us if we were to have the private keys. This is
439 // just to make sure that the script is valid and that, if found in a
440 // transaction, we would still accept and relay that transaction.
441 SignatureData sigs;
442 if (ProduceSignature(provider, DUMMY_SIGNATURE_CREATOR, script, sigs)) {
443 // VerifyScript check is just defensive, and should never fail.
444 bool verified =
446 DUMMY_CHECKER);
447 assert(verified);
448 return true;
449 }
450 return false;
451}
452
454 const std::map<COutPoint, Coin> &coins,
455 SigHashType sigHashType,
456 std::map<int, std::string> &input_errors) {
457 // Use CTransaction for the constant parts of the
458 // transaction to avoid rehashing.
459 const CTransaction txConst(mtx);
460 // Sign what we can:
461 for (size_t i = 0; i < mtx.vin.size(); i++) {
462 CTxIn &txin = mtx.vin[i];
463 auto coin = coins.find(txin.prevout);
464 if (coin == coins.end() || coin->second.IsSpent()) {
465 input_errors[i] = "Input not found or already spent";
466 continue;
467 }
468 const CScript &prevPubKey = coin->second.GetTxOut().scriptPubKey;
469 const Amount amount = coin->second.GetTxOut().nValue;
470
471 SignatureData sigdata =
472 DataFromTransaction(mtx, i, coin->second.GetTxOut());
474 *keystore,
475 MutableTransactionSignatureCreator(mtx, i, amount, sigHashType),
476 prevPubKey, sigdata);
477
478 UpdateInput(txin, sigdata);
479
480 // amount must be specified for valid signature
481 if (amount == MAX_MONEY) {
482 input_errors[i] = "Missing amount";
483 continue;
484 }
485
487 if (!VerifyScript(
488 txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS,
489 TransactionSignatureChecker(&txConst, i, amount), &serror)) {
491 // Unable to sign input and verification failed (possible
492 // attempt to partially sign).
493 input_errors[i] = "Unable to sign input, invalid stack size "
494 "(possibly missing key)";
495 } else {
496 input_errors[i] = ScriptErrorString(serror);
497 }
498 } else {
499 // If this input succeeds, make sure there is no error set for it
500 input_errors.erase(i);
501 }
502 }
503 return input_errors.empty();
504}
std::vector< uint8_t > valtype
Definition: addresstype.cpp:16
static constexpr Amount MAX_MONEY
No amount larger than this (in satoshi) is valid.
Definition: amount.h:176
int flags
Definition: bitcoin-tx.cpp:544
virtual bool CheckSig(const std::vector< uint8_t > &vchSigIn, const std::vector< uint8_t > &vchPubKey, const CScript &scriptCode, uint32_t flags) const
Definition: interpreter.h:80
Interface for signature creators.
Definition: sign.h:27
virtual bool CreateSig(const SigningProvider &provider, std::vector< uint8_t > &vchSig, const CKeyID &keyid, const CScript &scriptCode) const =0
Create a singular (non-script) signature.
virtual const BaseSignatureChecker & Checker() const =0
An encapsulated secp256k1 private key.
Definition: key.h:28
bool SignECDSA(const uint256 &hash, std::vector< uint8_t > &vchSig, bool grind=true, uint32_t test_case=0) const
Create a DER-serialized ECDSA signature.
Definition: key.cpp:241
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:22
A mutable version of CTransaction.
Definition: transaction.h:274
std::vector< CTxOut > vout
Definition: transaction.h:277
std::vector< CTxIn > vin
Definition: transaction.h:276
uint32_t GetN() const
Definition: transaction.h:36
An encapsulated public key.
Definition: pubkey.h:31
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
Definition: pubkey.h:137
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:434
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
Definition: script.cpp:407
static opcodetype EncodeOP_N(int n)
Definition: script.h:523
A reference to a CScript: the Hash160 of its serialization.
Definition: script.h:564
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:192
const std::vector< CTxOut > vout
Definition: transaction.h:207
An input of a transaction.
Definition: transaction.h:59
CScript scriptSig
Definition: transaction.h:62
COutPoint prevout
Definition: transaction.h:61
An output of a transaction.
Definition: transaction.h:128
CScript scriptPubKey
Definition: transaction.h:131
Amount nValue
Definition: transaction.h:130
A signature creator for transactions.
Definition: sign.h:39
MutableTransactionSignatureCreator(const CMutableTransaction &tx LIFETIMEBOUND, unsigned int input_idx, const Amount &amount, SigHashType sig_hash_type=SigHashType())
Definition: sign.cpp:19
bool CreateSig(const SigningProvider &provider, std::vector< uint8_t > &vchSig, const CKeyID &keyid, const CScript &scriptCode) const override
Create a singular (non-script) signature.
Definition: sign.cpp:25
const CMutableTransaction & m_txto
Definition: sign.h:40
Signature hash type wrapper class.
Definition: sighashtype.h:37
uint32_t getRawSigHashType() const
Definition: sighashtype.h:83
BaseSigHashType getBaseType() const
Definition: sighashtype.h:64
An interface to be implemented by keystores that support signing.
virtual bool GetCScript(const CScriptID &scriptid, CScript &script) const
virtual bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const
virtual bool GetKey(const CKeyID &address, CKey &key) const
virtual bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const
bool empty() const
Definition: prevector.h:400
iterator begin()
Definition: prevector.h:402
iterator end()
Definition: prevector.h:404
160-bit opaque blob.
Definition: uint256.h:184
256-bit opaque blob.
Definition: uint256.h:199
bool EvalScript(std::vector< valtype > &stack, const CScript &script, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metrics, ScriptError *serror)
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, SigHashType sigHashType, const Amount amount, const PrecomputedTransactionData *cache, uint32_t flags, SigHashCache *sighash_cache)
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metricsOut, ScriptError *serror)
Execute an unlocking and locking script together.
static constexpr uint32_t STANDARD_SCRIPT_VERIFY_FLAGS
Standard script verification flags that standard transactions will comply with.
Definition: policy.h:101
SchnorrSig sig
Definition: processor.cpp:538
@ OP_1NEGATE
Definition: script.h:60
@ OP_0
Definition: script.h:55
std::vector< uint8_t > ToByteVector(const T &in)
Definition: script.h:48
std::string ScriptErrorString(const ScriptError serror)
ScriptError
Definition: script_error.h:11
@ INVALID_STACK_OPERATION
@ SCRIPT_VERIFY_NONE
Definition: script_flags.h:12
@ SIGHASH_FORKID
Definition: sighashtype.h:18
@ SIGHASH_ALL
Definition: sighashtype.h:15
bool ProduceSignature(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
Definition: sign.cpp:210
std::vector< uint8_t > valtype
Definition: sign.cpp:17
void UpdateInput(CTxIn &input, const SignatureData &data)
Definition: sign.cpp:343
static bool CreateSig(const BaseSignatureCreator &creator, SignatureData &sigdata, const SigningProvider &provider, std::vector< uint8_t > &sig_out, const CPubKey &pubkey, const CScript &scriptcode)
Definition: sign.cpp:84
static bool SignStep(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &scriptPubKey, std::vector< valtype > &ret, TxoutType &whichTypeRet, SignatureData &sigdata)
Sign scriptPubKey using signature made with creator.
Definition: sign.cpp:116
bool IsSolvable(const SigningProvider &provider, const CScript &script)
Check whether we know how to sign for an output like this, assuming we have all private keys.
Definition: sign.cpp:436
const BaseSignatureCreator & DUMMY_MAXIMUM_SIGNATURE_CREATOR
A signature creator that just produces 72-byte empty signatures.
Definition: sign.cpp:433
static bool GetPubKey(const SigningProvider &provider, const SignatureData &sigdata, const CKeyID &address, CPubKey &pubkey)
Definition: sign.cpp:65
bool SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, SigHashType sigHashType, std::map< int, std::string > &input_errors)
Sign the CMutableTransaction.
Definition: sign.cpp:453
SignatureData DataFromTransaction(const CMutableTransaction &tx, unsigned int nIn, const CTxOut &txout)
Extract signature data from a transaction input, and insert it.
Definition: sign.cpp:287
static CScript PushAll(const std::vector< valtype > &values)
Definition: sign.cpp:193
const BaseSignatureCreator & DUMMY_SIGNATURE_CREATOR
A signature creator that just produces 71-byte empty signatures.
Definition: sign.cpp:431
bool SignSignature(const SigningProvider &provider, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, const Amount amount, SigHashType sigHashType)
Produce a script signature for a transaction.
Definition: sign.cpp:362
static bool GetCScript(const SigningProvider &provider, const SignatureData &sigdata, const CScriptID &scriptid, CScript &script)
Definition: sign.cpp:51
std::pair< CPubKey, std::vector< uint8_t > > SigPair
Definition: sign.h:61
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< uint8_t > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
Definition: solver.cpp:93
TxoutType
Definition: solver.h:15
Definition: amount.h:23
uint160 missing_redeem_script
ScriptID of the missing redeemScript (if any)
Definition: sign.h:84
std::vector< CKeyID > missing_sigs
KeyIDs of pubkeys for signatures which could not be found.
Definition: sign.h:82
void MergeSignatureData(SignatureData sigdata)
Definition: sign.cpp:347
std::map< CKeyID, SigPair > signatures
BIP 174 style partial signatures for the input.
Definition: sign.h:77
std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo > > misc_pubkeys
Definition: sign.h:78
CScript scriptSig
The scriptSig of an input.
Definition: sign.h:72
CScript redeem_script
The redeemScript (if any) for the input.
Definition: sign.h:74
std::vector< CKeyID > missing_pubkeys
KeyIDs of pubkeys which could not be found.
Definition: sign.h:80
bool complete
Stores whether the scriptSig are complete.
Definition: sign.h:69
assert(!tx.IsCoinBase())