阅读背景:

xxxx

来源:互联网 
/**
 * @param {org.example.mynetwork.TransactionCar} transactionCar
 * @transaction
 */
async function transactionCarFun(transactionCar){
     const factory = getFactory();
      const NS = "org.example.mynetwork";
    
        const registry = await getParticipantRegistry(NS + '.Person');
        const assetRegistry = await getAssetRegistry(NS+".Car");

    
      const from =await registry.get( transactionCar.from); 
    const to =await registry.get( transactionCar.to); 
      const price = transactionCar.price;
  
      from.balance = from.balance + price;
      to.balance  = to.balance - price;
  
      const partRegistry = await getParticipantRegistry(NS+'.Person')
      await partRegistry.update(from);
      await partRegistry.update(to);
      debugger
      const car =await assetRegistry.get(transactionCar.car);
      car.personId = to.id;
      if(!car.transactionCars){
           car.transactionCars = []  
      }  
      car.transactionCars.push(transactionCar)
      await assetRegistry.update(car);
  }/**
 * @param {org.example.mynetwork.Tran



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: