Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including Magic in hash makes RpcClient unusable for multiple blockchains #1900

Closed
devhawk opened this issue Sep 3, 2020 · 0 comments · Fixed by #1902
Closed

Including Magic in hash makes RpcClient unusable for multiple blockchains #1900

devhawk opened this issue Sep 3, 2020 · 0 comments · Fixed by #1902

Comments

@devhawk
Copy link
Contributor

devhawk commented Sep 3, 2020

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 set

However, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant