re: #29409 (review)
In 1c9dcf2
This assert is dead code only because ChainClient is not exposed by this PR.
ChainClient is actually exposed by this PR. But depending on what we want the goal of this PR it doesn't need to be. I tried to describe purpose of ChainClient better in a recent comment #29409 (review), but basically it is not something you would implement if you are an external process connecting to the node, it is only something you would implement if you are implementing a process you would want to be started by the node. In #10102, bitcoin-node spawns a bitcoin-wallet process, and bitcoin-wallet implements the ChainClient interfaces, so the node can manage it and forward RPCs and shut it down.
Original goal of this PR was to add chain.capnp to the codebase so #10102 is easier to review. But if the goal of this PR is now really to expose the Chain interface over IPC, the ChainClient capnproto definition can be dropped from this.
The comment says it is overridden by WalletLoader::start, but would this not still abort if ever called?
I don't think there is a realistic way this could ever be called. This is here as workaround for the fact the libmultiprocess (and capnproto) don't have separate options for generating client and server classes. So if you declare any interface, client and server classes will be produced and they need to compile. Libmultiprocess can't generate ChainClient::start server method that compiles because it takes a CScheduler& argument and there isn't a way to share schedulers across processes. In #10102, the WalletLoader implementation of start just creates a separate scheduler for the wallet process to use.
More ideally, there might be a way to mark ChainClient as an abstract class that is allowed to be called but never implemented directly as a server object, only inherited from and implement that way. Capnproto doesn't provide this but libmultiprocess could define it's own $Abstract annotation that would do this.
Why not omit start from the exposed base interface or make this throw a protocol error instead of asserting.
This could throw an exception instead of assert. It shouldn't matter very much because I don't think there's a way this could be accidentally called.
Another way to get rid of this might be drop the CScheduler parameter and just have the wallet and node use different schedulers instead of the same one.