-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
RpcClient apps must configure ProtocolSettings with the correct magic value for tx/block hashes to match the between client and server. However, ProtocolSettings can only be specified once / process and can never be changed. So it's impossible to create multiple RpcClients that can send raw transactions to different blockchains.
Additionally, RpcClient won't be able to send raw transactions to any blockchain except the one with the hardcoded default unless the developer explicitly configures it - either with a protocol.json file or by calling ProtocolSettings.Initialize.
Ideally, RpcClient would accept a magic value in it's constructor so you could write something like this:
var mainNetRpcClient = new RpcClient("http://main.network"); // magic value defaults to MainNet value
var testNetRpcClient = new RpcClient("http://test.network", TEST_NET_MAGIC); magic value explicitly setHowever, because of the way ProtocolSettings is managed + the intrinsic manner in Neo.Network.P2P.Helper.GetHashData retrieves the magic value, this type of initialization is impossible.