Is the same source code compiled (into CorDapps) at different times considered different versions?

时间:2017-12-18 07:41:33

标签: corda

Something that was highlighted in a discussion today. The same CorDapp (same source code no difference) was deployed in both Party A and B. However, the CorDapp in party A was compiled a week ago. When party B tried to create a transaction with A, it doesn't work and you get an exception as net.corda.core.contracts.TransactionverificationException$ContractCOnstraintRejection@: Contract constraints failed for net-corda.training.contract.IOUContract, transaction: tx hash. Is this a valid observation?

The log outputs the following exception using the IOUContract as an example: public class VisaTypeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { Context context; private List<VisaType> visaTypeList; int selected_position; public VisaTypeAdapter(Context context, List<VisaType> visaTypeList) { this.context = context; this.visaTypeList = visaTypeList; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.visa_type_row, parent, false); return new jp.workjapan.adapters.VisaTypeAdapter.ViewHolder(view); } @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { final VisaType a = visaTypeList.get(position); final jp.workjapan.adapters.VisaTypeAdapter.ViewHolder viewHolder = (jp.workjapan.adapters.VisaTypeAdapter.ViewHolder) holder; viewHolder.visa_eng.setText(a.getName_en()); viewHolder.visa_jp.setText(a.getName_jp()); final long id = a.getId(); if (id == AppSingleTon.visaType) { viewHolder.visa_layout.setSelected(true); } else { viewHolder.visa_layout.setSelected(false); } viewHolder.visa_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (viewHolder.visa_layout.isSelected()) { viewHolder.visa_layout.setSelected(false); } else { viewHolder.visa_layout.setSelected(true); AppSingleTon.visaType = id; selected_position = position; } } }); } }

2 个答案:

答案 0 :(得分:1)

一个遗漏的问题是:

同一个cordapp-jar分配给两台机器吗?通过这个我并不意味着相同的源代码分布,然后独立编译,我的意思是一个编译,然后在两个节点上运行的结果。在Corda达到电线稳定性之前,编译环境中的任何差异(无论多么微小)都可能导致错误,例如您遇到的错误。

答案 1 :(得分:0)

正如Richard所说,对于一组给定的CorDapp源文件,生成的CorDapp JAR的哈希值不确定。

一个关键原因是JAR仍然包含时间戳。请参阅https://docs.corda.net/head/cordapp-build-systems.html#creating-the-cordapp-jar