@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.EnclavePublicKeyProvider ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.EnclavePublicKeyProvider ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse ;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse ;
@ -146,8 +147,7 @@ public class EeaSendRawTransaction implements JsonRpcMethod {
. addLocalTransaction ( privacyMarkerTransaction )
. addLocalTransaction ( privacyMarkerTransaction )
. either (
. either (
( ) - > new JsonRpcSuccessResponse ( id , privacyMarkerTransaction . getHash ( ) . toString ( ) ) ,
( ) - > new JsonRpcSuccessResponse ( id , privacyMarkerTransaction . getHash ( ) . toString ( ) ) ,
errorReason - >
errorReason - > getJsonRpcErrorResponse ( id , errorReason ) ) ;
new JsonRpcErrorResponse ( id , convertTransactionInvalidReason ( errorReason ) ) ) ;
} catch ( final MultiTenancyValidationException e ) {
} catch ( final MultiTenancyValidationException e ) {
LOG . error ( "Unauthorized privacy multi-tenancy rpc request. {}" , e . getMessage ( ) ) ;
LOG . error ( "Unauthorized privacy multi-tenancy rpc request. {}" , e . getMessage ( ) ) ;
return new JsonRpcErrorResponse ( id , ENCLAVE_ERROR ) ;
return new JsonRpcErrorResponse ( id , ENCLAVE_ERROR ) ;
@ -158,6 +158,14 @@ public class EeaSendRawTransaction implements JsonRpcMethod {
}
}
}
}
JsonRpcErrorResponse getJsonRpcErrorResponse (
final Object id , final TransactionInvalidReason errorReason ) {
if ( errorReason . equals ( TransactionInvalidReason . INTRINSIC_GAS_EXCEEDS_GAS_LIMIT ) ) {
return new JsonRpcErrorResponse ( id , JsonRpcError . PMT_FAILED_INTRINSIC_GAS_EXCEEDS_LIMIT ) ;
}
return new JsonRpcErrorResponse ( id , convertTransactionInvalidReason ( errorReason ) ) ;
}
private String buildCompoundKey (
private String buildCompoundKey (
final String enclaveKey , final Optional < String > addPayloadEnclaveKey ) {
final String enclaveKey , final Optional < String > addPayloadEnclaveKey ) {
return addPayloadEnclaveKey . isPresent ( )
return addPayloadEnclaveKey . isPresent ( )