mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 01:36:13 +00:00
ipc mining: break compatibility with existing clients (version bump)
This increments the field number of the `Init.makeMining` method and makes the old `makeMining` method return an error, so existing IPC mining clients not using the latest schema file will get an error and not be able to access the Mining interface. Normally, there shouldn't be a need to break compatibility this way, but the mining interface has evolved a lot since it was first introduced, with old clients using the original methods less stable and performant than newer clients. So now is a good time to introduce a cutoff, drop deprecated methods, and stop supporting old clients which can't function as well. Bumping the field number is also an opportunity to make other improvements that would be awkward to implement compatibly, so a few of these were implemented in commits immediately preceding this one. Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
parent
70de5cc2d2
commit
9453c15361
@ -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
|
||||
|
||||
@ -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 () -> ();
|
||||
}
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user