corda - 使用网络地图服务更改 Corda 网络参数
问题描述
我已经在我的虚拟机上运行了 corda 的网络地图服务。当我更改白名单文件时,网络地图服务会重建网络地图以及网络参数。
如果网络参数文件被更改并且不再匹配网络地图服务所宣传的内容,那么节点将自动关闭。
在我的情况下,所有节点都会按预期关闭。启动时收到消息“节点正在使用带有哈希的参数:X,但网络地图正在广告:Y”。删除网络参数后,它会正常启动。
根据此处提到的文档,要手动接受更新的网络参数并将参数批准发送回区域运营商,必须使用更新中的 parametersHash 调用 RPC 方法 fun acceptNewNetworkParameters(parametersHash: SecureHash)。
我从corda shell调用了上述函数,如下所示:
run acceptNewNetworkParameters parametersHash: "ba19fc1b9e9c1c7cbea712efda5f78b53ae4e5d123c89d02c9da44ec50e9c17d"
我收到错误“RPC 失败:java.lang.IllegalArgumentException:参数类型不匹配”。
我需要弄清楚corda节点如何从网络地图服务接受更新的网络参数,以及如何防止corda节点在获取新参数后被关闭。
注意:使用具有以下配置更改的网络地图服务:
缓存超时:2 秒参数更新延迟:10 秒网络映射延迟:1 秒
08:35:13.664 [vert.x-eventloop-thread-3] ERROR i.c.n.s.NetworkMapServiceProcessor - failed during processParamUpdate
io.vertx.core.file.FileSystemException: java.nio.file.NoSuchFileException: /data/corda-workspace/network-map-service-v0.3.0/network-map/parameters-update/next-params-update
at io.vertx.core.file.impl.FileSystemImpl$10.perform(FileSystemImpl.java:638)
at io.vertx.core.file.impl.FileSystemImpl$10.perform(FileSystemImpl.java:615)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:275)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.file.NoSuchFileException: /data/corda-workspace/network-map-service-v0.3.0/network-map/parameters-update/next-params-update
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
at java.nio.file.Files.readAttributes(Files.java:1737)
at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
at java.nio.file.Files.walkFileTree(Files.java:2662)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at io.vertx.core.file.impl.FileSystemImpl$10.perform(FileSystemImpl.java:620)
... 7 common frames omitted
我已经尝试了多次网络参数更改以及 NMS,几次在节点中获取网络参数更新文件,并且很少遇到以下问题:
Couldn't find parameters update for the hash: <Hash>
Refused to accept parameters with hash <Hash> because network map advertises update with hash <Hash>. Please check newest version
解决方案
Corda 3.2/3.3 有一个错误,shell 无法将字符串反序列化为SecureHash
对象。修复在这里:https ://github.com/corda/corda/pull/3248 。它将在 Corda 4 中可用。
同时,您应该使用 RPC 客户端来接受新的网络参数。例如:
public class AcceptNetworkParams {
public static void main(String[] args) {
// Create an RPC connection to the node.
if (args.length != 4)
throw new IllegalArgumentException("Usage: Client <node address> <rpc username> <rpc password> <network params hash");
final NetworkHostAndPort nodeAddress = parse(args[0]);
final String rpcUsername = args[1];
final String rpcPassword = args[2];
final CordaRPCClient client = new CordaRPCClient(nodeAddress);
final CordaRPCOps proxy = client.start(rpcUsername, rpcPassword).getProxy();
// Accept the new network parameters.
final String networkParamsHashString = args[3];
final SecureHash networkParamsHash = SecureHash.parse(networkParamsHashString);
proxy.acceptNewNetworkParameters(networkParamsHash);
}
}
推荐阅读
- django - django返回404上传媒体文件
- django - 针对 Auth0 使用 social-auth-app-django 对 Django 站点进行身份验证的用户的管理员权限
- python - Pandas - 从 csv 计算相对时间
- html - 如何在 HTML 中制作这个特定的布局?右下角/正文包裹的文本
- jmeter - 在 Jmeter 中每 10 秒执行一次循环控制器
- c++ - 共享指针继承,无需先显式转换
- c# - windows 域外的应用程序服务器可以验证该域的用户吗?
- rabbitmq - centos7上无法启动rabbitmq-server
- android - Recyclerview 点击事件不适用于数据绑定和 livedata
- javascript - 在 for...of 对象循环中使用变量