From ecaf5ea1cfb9ab79a593571eacee6f0835295bea Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 5 Apr 2021 16:39:48 -0400 Subject: [PATCH] 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. --- src/psbt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psbt.h b/src/psbt.h index eeb47610c4..697d97a06d 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -761,7 +761,7 @@ struct PartiallySignedTransaction // Write serialized tx to a stream OverrideStream os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS); - SerializeToVector(os, *tx); + SerializeToVector(os, GetUnsignedTx()); } // Write xpubs