MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / PSBTOutput

Class PSBTOutput

src/script/sign.h:429–539  ·  view source on GitHub ↗

A structure for PSBTs which contains per output information */

Source from the content-addressed store, hash-verified

427
428/** A structure for PSBTs which contains per output information */
429struct PSBTOutput
430{
431 CScript redeem_script;
432 CScript witness_script;
433 std::map<CPubKey, std::vector<uint32_t>> hd_keypaths;
434 std::map<std::vector<unsigned char>, std::vector<unsigned char>> unknown;
435
436 bool IsNull() const;
437 void FillSignatureData(SignatureData& sigdata) const;
438 void FromSignatureData(const SignatureData& sigdata);
439 void Merge(const PSBTOutput& output);
440 bool IsSane() const;
441 PSBTOutput() {}
442
443 template <typename Stream>
444 inline void Serialize(Stream& s) const {
445 // Write the redeem script
446 if (!redeem_script.empty()) {
447 SerializeToVector(s, PSBT_OUT_REDEEMSCRIPT);
448 s << redeem_script;
449 }
450
451 // Write the witness script
452 if (!witness_script.empty()) {
453 SerializeToVector(s, PSBT_OUT_WITNESSSCRIPT);
454 s << witness_script;
455 }
456
457 // Write any hd keypaths
458 SerializeHDKeypaths(s, hd_keypaths, PSBT_OUT_BIP32_DERIVATION);
459
460 // Write unknown things
461 for (auto& entry : unknown) {
462 s << entry.first;
463 s << entry.second;
464 }
465
466 s << PSBT_SEPARATOR;
467 }
468
469
470 template <typename Stream>
471 inline void Unserialize(Stream& s) {
472 // Read loop
473 bool found_sep = false;
474 while(!s.empty()) {
475 // Read
476 std::vector<unsigned char> key;
477 s >> key;
478
479 // the key is empty if that was actually a separator byte
480 // This is a special case for key lengths 0 as those are not allowed (except for separator)
481 if (key.empty()) {
482 found_sep = true;
483 break;
484 }
485
486 // First byte of key is the type

Callers 2

createpsbtFunction · 0.85
converttopsbtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected