From 00a49ca94e5e0a554a36e82296e655a6c5521447 Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Mon, 22 Jul 2024 17:14:51 -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 ea35516b96c..f9d49d80500 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -1345,7 +1345,7 @@ struct PartiallySignedTransaction SerializeToVector(s, CompactSizeWriter(PSBT_GLOBAL_UNSIGNED_TX)); // Write serialized tx to a stream - SerializeToVector(s, TX_NO_WITNESS(*tx)); + SerializeToVector(s, TX_NO_WITNESS(GetUnsignedTx())); } // Write xpubs