From 8d213d5e31dd47f0c179475e32f5eb86c3773770 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 24 Oct 2023 16:38:35 +0200 Subject: [PATCH] qa: correct create_spend functional test Both transactions may not spend the same coins. We need to compare the set of all der paths across inputs. --- tests/test_rpc.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_rpc.py b/tests/test_rpc.py index a2dbc614..3bb82c3a 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -398,11 +398,15 @@ def test_create_spend(lianad, bitcoind): res_spend = lianad.rpc.createspend(destinations, outpoints, 1) res_reco = lianad.rpc.createrecovery(bitcoind.rpc.getnewaddress(), 2) - # The two PSBTs don't share any BIP32 derivation paths in their input. + # The two PSBTs don't share any BIP32 derivation paths in their inputs. res_spend_psbt = PSBT.from_base64(res_spend["psbt"]) + res_spend_keys = set() + for i in res_spend_psbt.i: + res_spend_keys = res_spend_keys | set(i.map[PSBT_IN_BIP32_DERIVATION]) res_reco_psbt = PSBT.from_base64(res_reco["psbt"]) - res_spend_keys = set(res_spend_psbt.i[0].map[PSBT_IN_BIP32_DERIVATION]) - res_reco_keys = set(res_reco_psbt.i[0].map[PSBT_IN_BIP32_DERIVATION]) + res_reco_keys = set() + for i in res_reco_psbt.i: + res_reco_keys = res_reco_keys | set(i.map[PSBT_IN_BIP32_DERIVATION]) assert res_spend_keys.intersection(res_reco_keys) == set()