Use GetUnsignedTx when serializing in PSBTv0

If we are asked to make a PSBTv0, we may not necessarily have made an
unsigned transaction. So instead use GetUnsignedTx which will either
fetch one that already exists, or construct a new one from the stored
data. Internally we may be storing a PSBTv0 like a PSBTv2, but still
want to serialize those as v0.
This commit is contained in:
Andrew Chow 2021-04-05 16:39:48 -04:00
parent e860cd0f42
commit ecaf5ea1cf

View file

@ -761,7 +761,7 @@ struct PartiallySignedTransaction
// Write serialized tx to a stream
OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS);
SerializeToVector(os, *tx);
SerializeToVector(os, GetUnsignedTx());
}
// Write xpubs