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
      • 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