2017-09-29 14 views
0

我正在使用一组Hyperledger 1.0.2泊坞窗图像和作曲家0.11.3 我使用的练习网络是basic-sample-network,它附带SampleParticipant和SampleAsset。 我能够使用作曲家参与者添加以及JSON片段从命令行部署参与者。 我还没有找到等效的命令行方法将SampleAsset插入到资产注册表中。当我使用的作曲家,其余服务器张贴JSON片断定义SampleAsset,它返回以下错误从命令行添加资产

Error: Peer has rejected transaction '4d2...91f' with cdoe MVCC_READ_CONFLICT 

上BatchTimeout和锁,我没有修改为阅读评论后,我再重新提交我是婴儿连锁店的单一用户。第二次,其余服务器返回

Error: Failed to add object with ID 'assetId:1' as the object already exists) 

我可以确认资产登记处与作曲家网络列表更新:

name:  basic-sample-network 
models: 
    - org.hyperledger.composer.system 
    - org.acme.sample 
scripts: 
    - lib/sample.js 
registries: 
    org.acme.sample.SampleAsset: 
    id:   org.acme.sample.SampleAsset 
    name:   Asset registry for org.acme.sample.SampleAsset 
    registryType: Asset 
    assets: 
     assetId:1: 
     $class: org.acme.sample.SampleAsset 
     assetId: assetId:1 
     owner: resource:org.acme.sample.SampleParticipant#Toby 
     value: new value 
    org.acme.sample.SampleParticipant: 
    id:   org.acme.sample.SampleParticipant 
    name:   Participant registry for org.acme.sample.SampleParticipant 
    registryType: Participant 
    assets: 
     Toby: 
     $class:  org.acme.sample.SampleParticipant 
     participantId: Toby 
     firstName:  Tobias 
     lastName:  Hunter 

为什么从REST服务器这一奇怪的行为与MVCC_READ_CONFLICT抱怨,但尚未插入记录,有没有一种方法我错过了从命令行插入SampleAsset?

回答

0

嗯,不知道你为什么会得到一个MVCC错误(正如你所说,不可能与你真正添加的资产有关,正如你所示)。

composer transaction submit是一个事务提交给方法(比如说)添加从命令行资产 - 在文档的例子(“实施例命令”)和下面的另一:

https://hyperledger.github.io/composer/reference/composer.transaction.submit.html

https://gist.github.com/jt-nti/137a039eb21992136c3f3e54c5c50fa5#file-org-hyperledger-composer-system-addasset-txt