Class NonInitialResponseBuilder<Request extends NonInitialTransactionRequest<Response>,​Response extends NonInitialTransactionResponse>

  • All Implemented Interfaces:
    ResponseBuilder<Request,​Response>

    public abstract class NonInitialResponseBuilder<Request extends NonInitialTransactionRequest<Response>,​Response extends NonInitialTransactionResponse>
    extends io.hotmoka.local.internal.transactions.AbstractResponseBuilder<Request,​Response>
    The creator of the response for a non-initial transaction. Non-initial transactions consume gas, have a payer a nonce and a chain identifier and are signed. The constructor of this class checks the validity of all these elements.
    • Field Detail

      • logger

        protected static final org.slf4j.Logger logger
      • gasCostModel

        protected final GasCostModel gasCostModel
        The cost model of the node for which the transaction is being built.
    • Constructor Detail

      • NonInitialResponseBuilder

        protected NonInitialResponseBuilder​(TransactionReference reference,
                                            Request request,
                                            io.hotmoka.local.internal.NodeInternal node)
                                     throws TransactionRejectedException
        Creates a the builder of the response.
        Parameters:
        reference - the reference to the transaction that is building the response
        request - the request of the transaction
        node - the node that is creating the response
        Throws:
        TransactionRejectedException - if the builder cannot be built
    • Method Detail

      • transactionIsSigned

        protected boolean transactionIsSigned()
        Determines if the transaction is signed.
        Returns:
        true if and only if the request is signed and the transaction is not a view transaction
      • minimalGasRequiredForTransaction

        protected BigInteger minimalGasRequiredForTransaction()
        Computes a minimal threshold of gas that is required for the transaction. Below this threshold, the response builder cannot be created.
        Returns:
        the minimal threshold
      • ignoreGasPrice

        protected boolean ignoreGasPrice()
        Determine if the response can be executed without checking if the offered gas price is at least as large as the current gas price. Normally, this only occurs if the consensus specifies to ignore the gas price. But this might also be the case for specific calls, such as those for creating accounts in the account ledger or for minting and burning coins, if the consensus allows it.
        Returns:
        true if the gas price must be ignored
      • getPayerFromRequest

        protected StorageReference getPayerFromRequest()
        Extracts the payer from the request. Normally, this is its caller, but subclasses might redefine.
        Returns:
        the payer
      • gasForStoringFailedResponse

        protected abstract BigInteger gasForStoringFailedResponse()
        Yields the cost for storage a failed response for the transaction that is being built.
        Returns:
        the cost