Hyperledger fabric &引用;错误:找不到任何要为事务执行的函数;

Hyperledger fabric &引用;错误:找不到任何要为事务执行的函数;,hyperledger-fabric,hyperledger,blockchain,hyperledger-composer,Hyperledger Fabric,Hyperledger,Blockchain,Hyperledger Composer,我正在构建一个网络,允许“医院”将自己的公钥和数据哈希添加到“患者”资产的数组中,但当我测试时,它给了我 错误:找不到任何要为事务执行的函数 我正在使用在线作曲家游乐场,这是我第一次建立网络。我认为在这个网络中,我需要参与者、资产和事务,我将患者设置为一组医院的资产,patientshospital是一个具有数据散列和公钥的参与者,一个事务和一个由该事务调用的函数,我不知道哪里出错,但当我测试时,它返回我以下错误: “TypeError:无法读取未定义的属性'state'” 及 “错误:找不到任

我正在构建一个网络,允许“医院”将自己的公钥和数据哈希添加到“患者”资产的数组中,但当我测试时,它给了我

错误:找不到任何要为事务执行的函数

我正在使用在线作曲家游乐场,这是我第一次建立网络。我认为在这个网络中,我需要参与者、资产和事务,我将患者设置为一组医院的资产,
patientshospital
是一个具有数据散列和公钥的参与者,一个事务和一个由该事务调用的函数,我不知道哪里出错,但当我测试时,它返回我以下错误:

“TypeError:无法读取未定义的属性'state'”

“错误:找不到任何要为transaction>org.acme.patientchain.AddHospitalToPatient执行的函数#bdd6ca0b-d0d9-4003-b6c3-05b818b3fc96”

我还尝试将
patienthhospital
设置为资产而不是参与者,但仍然给出了相同的错误

我如何解决这个问题

My model.cto文件:

namespace org.acme.patientchain
 asset Patient identified by pubKeyPatient {
  o String pubKeyPatient
  o PatientHospital[] hospitals
}

participant PatientHospital identified by pubKeyHospital {
  o String pubKeyHospital
  o String dataHash
 // --> Hospital hospital
}

transaction AddHospitalToPatient {
  --> Patient patient
  o PatientHospital newHospital

 }
My js文件中的函数:

function addHospitalToPatient(AddHospitalToPatient){
 AddHospitalToPatient.patient.hospitals.push(AddHospitalToPatient.newHospital);
  return getAssetRegistry('org.acme.patientchain.Patient')
  .then(function (assetRegistry) {
    return assetRegistry.update(patient.hospitals);
  });

}

根据我的理解,您需要更新
患者
资产,新值为
PatientHospital
参与者

logic.js更改:

async function addHospitalToPatient(AddHospitalToPatient){
 AddHospitalToPatient.patient.hospitals.push(AddHospitalToPatient.newHospital);
  return getAssetRegistry('org.acme.patientchain.Patient')
  .then(function (assetRegistry) {
    return assetRegistry.update(AddHospitalToPatient.patient);
  });
}

根据我的理解,您需要更新
患者
资产,新值为
PatientHospital
参与者

logic.js更改:

async function addHospitalToPatient(AddHospitalToPatient){
 AddHospitalToPatient.patient.hospitals.push(AddHospitalToPatient.newHospital);
  return getAssetRegistry('org.acme.patientchain.Patient')
  .then(function (assetRegistry) {
    return assetRegistry.update(AddHospitalToPatient.patient);
  });
}