Search in sources :

Example 1 with GoQuorumEnclave

use of org.hyperledger.besu.enclave.GoQuorumEnclave in project besu by hyperledger.

the class GraphQLDataFetchers method updatePrivatePayload.

private TransactionAdapter updatePrivatePayload(final Transaction transaction) {
    final GoQuorumEnclave enclave = goQuorumPrivacyParameters.get().enclave();
    Bytes enclavePayload;
    try {
        // Retrieve the payload from the enclave
        enclavePayload = Bytes.wrap(enclave.receive(transaction.getPayload().toBase64String()).getPayload());
    } catch (final Exception ex) {
        LOG.debug("An error occurred while retrieving the GoQuorum transaction payload: ", ex);
        enclavePayload = Bytes.EMPTY;
    }
    // Return a new transaction containing the retrieved payload
    return new TransactionAdapter(new TransactionWithMetadata(new Transaction(transaction.getNonce(), transaction.getGasPrice(), transaction.getMaxPriorityFeePerGas(), transaction.getMaxFeePerGas(), transaction.getGasLimit(), transaction.getTo(), transaction.getValue(), transaction.getSignature(), enclavePayload, transaction.getSender(), transaction.getChainId(), Optional.ofNullable(transaction.getV()))));
}
Also used : GoQuorumEnclave(org.hyperledger.besu.enclave.GoQuorumEnclave) Bytes(org.apache.tuweni.bytes.Bytes) Transaction(org.hyperledger.besu.ethereum.core.Transaction) TransactionWithMetadata(org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata) TransactionAdapter(org.hyperledger.besu.ethereum.api.graphql.internal.pojoadapter.TransactionAdapter) RLPException(org.hyperledger.besu.ethereum.rlp.RLPException)

Aggregations

Bytes (org.apache.tuweni.bytes.Bytes)1 GoQuorumEnclave (org.hyperledger.besu.enclave.GoQuorumEnclave)1 TransactionAdapter (org.hyperledger.besu.ethereum.api.graphql.internal.pojoadapter.TransactionAdapter)1 TransactionWithMetadata (org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata)1 Transaction (org.hyperledger.besu.ethereum.core.Transaction)1 RLPException (org.hyperledger.besu.ethereum.rlp.RLPException)1