From 13715e8020c94111d63a808f9a91e1a1ecaac6a0 Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Mon, 23 Mar 2026 13:57:15 +0100 Subject: [PATCH] Fix incorrect check in cache_unsigned_tx_pieces `self.tx is not None` is always true because the constructor sets `self.tx = CTransaction()` when `None` is passed, which causes a call to `setup_from_tx` also for PSBT version 2, contrarily to the function's stated intent in the documentation. --- hwilib/psbt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hwilib/psbt.py b/hwilib/psbt.py index 28b5e1888..ca226d617 100644 --- a/hwilib/psbt.py +++ b/hwilib/psbt.py @@ -1047,7 +1047,7 @@ def cache_unsigned_tx_pieces(self) -> None: """ # To make things easier, we split up the global transaction # and use the PSBTv2 fields for PSBTv0 - if self.tx is not None: + if self.version == 0: self.setup_from_tx(self.tx) def setup_from_tx(self, tx: CTransaction):