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;
}
Aggregations