经过几天的试验,我找到了解决此问题的方法。以下代码序列使用在v0.15版本中创建的PeerAdmin卡。我导入该卡,并在adminConnect之后,更新卡的元数据中的businessNetwork元素,然后在重新导入卡后,部署并连接到业务网络。
describe('Finance Network', function () { this.timeout(_timeout); let businessNetworkConnection; let peerName = 'PeerAdmin@hlfv1'; before(function () { const adminConnection = new AdminConnection(); let idPeer; return hlc_idCard.fromDirectory(_home+'/.composer/cards/'+peerName) .then ((_idPeer) => { idPeer = _idPeer; return adminConnection.importCard(peerName, idPeer); }) .then(() => { return adminConnection.connect(peerName); }) .then(() => { return BusinessNetworkDefinition.fromDirectory(path.resolve(__dirname, '..')); }) .then((businessNetworkDefinition) => { idPeer.metadata.businessNetwork = network; return adminConnection.importCard(peerName, idPeer) .then(() => { return adminConnection.deploy(businessNetworkDefinition,{'card': idPeer}); }); }) .then(() => { businessNetworkConnection = new BusinessNetworkConnection(); return businessNetworkConnection.connect(peerName); }); });
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)