class AccountPermissioningController {

  public boolean isPermitted(final Transaction transaction, final boolean includeOnChainCheck) {
    final Hash transactionHash = transaction.getHash();
    final Address sender = transaction.getSender();

    LOG.trace("Account permissioning: Checking transaction {}", transactionHash);

    boolean permitted;
    if (includeOnChainCheck) {
      permitted =
          accountLocalConfigPermissioningController
                  .map(c -> c.isPermitted(transaction))
                  .orElse(true)
              && transactionSmartContractPermissioningController
                  .map(c -> c.isPermitted(transaction))
                  .orElse(true);
    } else {
      permitted =
          accountLocalConfigPermissioningController
              .map(c -> c.isPermitted(transaction))
              .orElse(true);
    }

    if (permitted) {
      LOG.trace("Account permissioning: Permitted transaction {} from {}", transactionHash, sender);
    } else {
      LOG.trace("Account permissioning: Rejected transaction {} from {}", transactionHash, sender);
    }

    return permitted;
  }

  public  AccountPermissioningController(
      final Optional<AccountLocalConfigPermissioningController>
          accountLocalConfigPermissioningController,
      final Optional<TransactionSmartContractPermissioningController>
          transactionSmartContractPermissioningController);

}