Search in sources :

Example 6 with TxResponseMessage

use of com.jd.blockchain.transaction.TxResponseMessage in project jdchain-core by blockchain-jd-com.

the class ParticipantManagerService4Raft method submitNodeStateChangeTx.

@Override
public TransactionResponse submitNodeStateChangeTx(ParticipantContext context, int activeID, TransactionRequest txRequest, List<NodeSettings> origConsensusNodes) {
    if (origConsensusNodes.isEmpty()) {
        throw new IllegalStateException("current consensus node list is empty");
    }
    createRpcClient(context);
    SubmitTxRequest submitTxRequest = new SubmitTxRequest();
    submitTxRequest.setTx(BinaryProtocol.encode(txRequest, TransactionRequest.class));
    RpcResponse rpcResponse = shuffleInvoke(context, origConsensusNodes, submitTxRequest);
    LOGGER.info("submit node state change tx response: {}", rpcResponse);
    TxResponseMessage responseMessage;
    if (!rpcResponse.isSuccess()) {
        responseMessage = new TxResponseMessage();
        responseMessage.setExecutionState(TransactionState.TIMEOUT);
    } else {
        responseMessage = new TxResponseMessage(BinaryProtocol.decode(rpcResponse.getResult()), null);
    }
    return responseMessage;
}
Also used : TxResponseMessage(com.jd.blockchain.transaction.TxResponseMessage)

Aggregations

TxResponseMessage (com.jd.blockchain.transaction.TxResponseMessage)6 ServiceProxy (bftsmart.tom.ServiceProxy)1 BftsmartConsensusViewSettings (com.jd.blockchain.consensus.bftsmart.BftsmartConsensusViewSettings)1 DefaultMessageTransmitter (com.jd.blockchain.consensus.mq.client.DefaultMessageTransmitter)1 ExtendMessage (com.jd.blockchain.consensus.mq.event.ExtendMessage)1 ExtendMessageResult (com.jd.blockchain.consensus.mq.event.ExtendMessageResult)1 TransactionRequest (com.jd.blockchain.ledger.TransactionRequest)1 TransactionResponse (com.jd.blockchain.ledger.TransactionResponse)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1