Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.h
Show First 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | struct PSBTInput { | ||||
void FillSignatureData(SignatureData &sigdata) const; | void FillSignatureData(SignatureData &sigdata) const; | ||||
void FromSignatureData(const SignatureData &sigdata); | void FromSignatureData(const SignatureData &sigdata); | ||||
void Merge(const PSBTInput &input); | void Merge(const PSBTInput &input); | ||||
bool IsSane() const; | bool IsSane() const; | ||||
PSBTInput() {} | PSBTInput() {} | ||||
template <typename Stream> inline void Serialize(Stream &s) const { | template <typename Stream> inline void Serialize(Stream &s) const { | ||||
// Write the utxo | // Write the utxo | ||||
if (!utxo.IsNull()) { | |||||
SerializeToVector(s, PSBT_IN_UTXO); | SerializeToVector(s, PSBT_IN_UTXO); | ||||
SerializeToVector(s, utxo); | SerializeToVector(s, utxo); | ||||
} | |||||
if (final_script_sig.empty()) { | if (final_script_sig.empty()) { | ||||
// Write any partial signatures | // Write any partial signatures | ||||
for (auto sig_pair : partial_sigs) { | for (auto sig_pair : partial_sigs) { | ||||
SerializeToVector(s, PSBT_IN_PARTIAL_SIG, | SerializeToVector(s, PSBT_IN_PARTIAL_SIG, | ||||
MakeSpan(sig_pair.second.first)); | MakeSpan(sig_pair.second.first)); | ||||
s << sig_pair.second.second; | s << sig_pair.second.second; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | template <typename Stream> inline void Serialize(Stream &s) const { | ||||
// Separator | // Separator | ||||
s << PSBT_SEPARATOR; | s << PSBT_SEPARATOR; | ||||
// Write inputs | // Write inputs | ||||
for (const PSBTInput &input : inputs) { | for (const PSBTInput &input : inputs) { | ||||
s << input; | s << input; | ||||
} | } | ||||
// Write outputs | // Write outputs | ||||
for (const PSBTOutput &output : outputs) { | for (const PSBTOutput &output : outputs) { | ||||
s << output; | s << output; | ||||
} | } | ||||
} | } | ||||
template <typename Stream> inline void Unserialize(Stream &s) { | template <typename Stream> inline void Unserialize(Stream &s) { | ||||
// Read the magic bytes | // Read the magic bytes | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |