Topics

invoke failed

Roxana Danger
 

Hello,

I have a chaincode with two contracts such that the second contract invoke a transaction of the first one as follows:

class ContractA implements ContractInterface{
     .....
     @Transaction
     public boolean trans1(MyContext ctx, String data) {
         ...
         return result;
     }
}

class ContractB implements ContractInterface{
     .....
     @Transaction
     public boolean trans2(MyContext ctx, String data) {
         ...
         Chaincode.Response response = ctx.getStub().invokeChaincode(chaincodeId,
                    new String[]{ContractA:trans1, "data"});
         ...
     }
}

During the execution of trans2, the invokeChaincode fails with the error: "INVOKE_CHAINCODE failed: transaction ID exists". According to the documentation, no other transaction will be created by calling invokeChaincode, therefore, it is correct that the invocation is created with the same transaction ID.

Is it a bug or am I doing something incorrect in my design?

Many thanks in advance,

Roxana

Matthew White
 

Hello;
 
What's the relationship between ContractA and ContractB?  

Are they within the same chaincode?  
 
Different chaincode, same channel?
 
Or completely different channel?
 
 
Regards, Matthew.
Matthew B White  IBM Blockchain Solutions Architect
 
Email me at WHITEMAT@...
Find me on StackOverflow, and generally at  calanais.me.uk
 
Note: restricted availability for meetings 14:30 to 17:00 UK Tuesday 
IBM United Kingdom Limited, Hursley Park, Winchester, Hampshire, SO21 2JN

"The wrong answers are the ones you go looking for when the right answers stare you in the face"
 
 
 
----- Original message -----
From: "Roxana Danger" <roxana.danger@...>
Sent by: fabric@...
To: fabric@...
Cc:
Subject: [EXTERNAL] [Hyperledger Fabric] invoke failed
Date: Thu, Jul 9, 2020 12:44 PM
 

Hello,

I have a chaincode with two contracts such that the second contract invoke a transaction of the first one as follows:

class ContractA implements ContractInterface{
     .....
     @Transaction
     public boolean trans1(MyContext ctx, String data) {
         ...
         return result;
     }
}

class ContractB implements ContractInterface{
     .....
     @Transaction
     public boolean trans2(MyContext ctx, String data) {
         ...
         Chaincode.Response response = ctx.getStub().invokeChaincode(chaincodeId,
                    new String[]{ContractA:trans1, "data"});
         ...
     }
}

During the execution of trans2, the invokeChaincode fails with the error: "INVOKE_CHAINCODE failed: transaction ID exists". According to the documentation, no other transaction will be created by calling invokeChaincode, therefore, it is correct that the invocation is created with the same transaction ID.

Is it a bug or am I doing something incorrect in my design?

Many thanks in advance,

Roxana

 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU