psbt: always put a non_witness_utxo and don't remove it

Offline signers will always need a non_witness_utxo so make sure it is
there.
This commit is contained in:
Andrew Chow
2020-06-04 23:43:43 -04:00
parent 5279d8bc07
commit 4600479058
5 changed files with 11 additions and 8 deletions

View File

@ -67,12 +67,12 @@ struct PSBTInput
template <typename Stream>
inline void Serialize(Stream& s) const {
// Write the utxo
// If there is a non-witness utxo, then don't add the witness one.
if (non_witness_utxo) {
SerializeToVector(s, PSBT_IN_NON_WITNESS_UTXO);
OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS);
SerializeToVector(os, non_witness_utxo);
} else if (!witness_utxo.IsNull()) {
}
if (!witness_utxo.IsNull()) {
SerializeToVector(s, PSBT_IN_WITNESS_UTXO);
SerializeToVector(s, witness_utxo);
}