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.
This commit is contained in:
Antoine Poinsot 2023-10-24 16:38:35 +02:00
parent cf33228b0d
commit 8d213d5e31
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -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()