Merge bitcoin/bitcoin#33420: test: Avoid interface_ipc.py Duplicate ID errors

e9c52272eb test: Avoid interface_ipc.py Duplicate ID errors (Ryan Ofsky)

Pull request description:

  This change should fix issue https://github.com/bitcoin/bitcoin/issues/33417 reported by zaidmstrr. It's possible to reproduce the `mp/proxy.capnp:0: failed: Duplicate ID @0xcc316e3f71a040fb` error by installing libmultiprocess system-wide, or to one of the locations listed in the python test's `imports` list before the local libmultiprocess subtree, and then running the test.

ACKs for top commit:
  zaidmstrr:
    Tested ACK [e9c5227](e9c52272eb)

Tree-SHA512: 5df7fe767989b91245ce96f7c43b6767b7af49ec6c7007175e462341ffd69e161f21632697804060ce286b3e102a8d141a57a53f7e0e32299ef9a3a69ca8794a
This commit is contained in:
merge-script 2025-09-18 11:34:44 +01:00
commit 74fa028da1
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
1 changed files with 6 additions and 1 deletions

View File

@ -35,7 +35,12 @@ class IPCInterfaceTest(BitcoinTestFramework):
capnp_dir = Path(capnp.__path__[0]).parent
src_dir = Path(self.config['environment']['SRCDIR']) / "src"
mp_dir = src_dir / "ipc" / "libmultiprocess" / "include"
imports = [str(capnp_dir), str(src_dir), str(mp_dir)]
# List of import directories. Note: it is important for mp_dir to be
# listed first, in case there are other libmultiprocess installations on
# the system, to ensure that `import "/mp/proxy.capnp"` lines load the
# same file as capnp.load() loads directly below, and there are not
# "failed: Duplicate ID @0xcc316e3f71a040fb" errors.
imports = [str(mp_dir), str(capnp_dir), str(src_dir)]
return {
"proxy": capnp.load(str(mp_dir / "mp" / "proxy.capnp"), imports=imports),
"init": capnp.load(str(src_dir / "ipc" / "capnp" / "init.capnp"), imports=imports),