rpc: Fix for duplicate external signers case

In case of multiple external signers, with some duplicates,
de-duplicate them: keep one signer per fingerprint, and
keep all non-duplicates as well. Add a new test check.
This commit is contained in:
optout
2026-05-09 10:57:08 +02:00
parent b796bf44f3
commit f05b1a3532
2 changed files with 14 additions and 1 deletions

View File

@@ -72,6 +72,19 @@ class RPCSignerTest(BitcoinTestFramework):
)
self.clear_mock_result(self.nodes[1])
# Duplicate fingerprints
self.set_mock_result(self.nodes[1],
'0 ['
'{"fingerprint": "00000001", "type": "trezor", "model": "trezor_t"}, '
'{"fingerprint": "00000001", "type": "trezor", "model": "trezor_t"}, '
'{"fingerprint": "00000002", "type": "trezor", "model": "trezor_one"}'
']')
assert_equal(self.nodes[1].enumeratesigners(), {"signers": [
{"fingerprint": "00000001", "name": "trezor_t"},
{"fingerprint": "00000002", "name": "trezor_one"},
]})
self.clear_mock_result(self.nodes[1])
assert_equal({'fingerprint': '00000001', 'name': 'trezor_t'} in self.nodes[1].enumeratesigners()['signers'], True)
if __name__ == '__main__':