diff --git a/src/interfaces/init.h b/src/interfaces/init.h index b909c9e6f6b..463d43e7c2e 100644 --- a/src/interfaces/init.h +++ b/src/interfaces/init.h @@ -39,6 +39,7 @@ public: virtual Ipc* ipc() { return nullptr; } virtual bool canListenIpc() { return false; } virtual const char* exeName() { return nullptr; } + virtual void makeMiningOld2() { throw std::runtime_error("Old mining interface (@2) not supported. Please update your client!"); } }; //! Return implementation of Init interface for the node process. If the argv diff --git a/src/ipc/capnp/init.capnp b/src/ipc/capnp/init.capnp index 64a7bf9b2b4..a20ef2fcaf3 100644 --- a/src/ipc/capnp/init.capnp +++ b/src/ipc/capnp/init.capnp @@ -19,5 +19,8 @@ using Mining = import "mining.capnp"; interface Init $Proxy.wrap("interfaces::Init") { construct @0 (threadMap: Proxy.ThreadMap) -> (threadMap :Proxy.ThreadMap); makeEcho @1 (context :Proxy.Context) -> (result :Echo.Echo); - makeMining @2 (context :Proxy.Context) -> (result :Mining.Mining); + makeMining @3 (context :Proxy.Context) -> (result :Mining.Mining); + + # DEPRECATED: no longer supported; server returns an error. + makeMiningOld2 @2 () -> (); } diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py index f2c75f6e09f..2fc4497a426 100755 --- a/test/functional/interface_ipc.py +++ b/test/functional/interface_ipc.py @@ -68,9 +68,23 @@ class IPCInterfaceTest(BitcoinTestFramework): asyncio.run(capnp.run(async_routine())) + def run_deprecated_mining_test(self): + self.log.info("Running deprecated mining interface test") + async def async_routine(): + ctx, init = await make_capnp_init_ctx(self) + self.log.debug("Calling deprecated makeMiningOld2 should raise an error") + try: + await init.makeMiningOld2() + raise AssertionError("makeMiningOld2 unexpectedly succeeded") + except capnp.KjException as e: + assert_equal(e.description, "remote exception: std::exception: Old mining interface (@2) not supported. Please update your client!") + assert_equal(e.type, "FAILED") + asyncio.run(capnp.run(async_routine())) + def run_test(self): self.run_echo_test() self.run_mining_test() + self.run_deprecated_mining_test() if __name__ == '__main__': IPCInterfaceTest(__file__).main()