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