Class: BSV::Transaction::FeeModel

Inherits:
Object
  • Object
show all
Defined in:
lib/bsv/transaction/fee_model.rb

Overview

Base class for fee models that compute transaction fees.

Fee models determine how many satoshis a transaction should pay in fees based on its size or other properties. Subclasses must implement #compute_fee.

Examples:

Implementing a custom fee model

class FixedFee < BSV::Transaction::FeeModel
  def compute_fee(_transaction)
    1000
  end
end

Instance Method Summary collapse

Instance Method Details

#compute_fee(_transaction) ⇒ Integer

Compute the fee for a transaction.

Parameters:

  • transaction (Transaction)

    the transaction to compute the fee for

Returns:

  • (Integer)

    the fee in satoshis

Raises:

  • (NotImplementedError)

    if not overridden by a subclass



23
24
25
# File 'lib/bsv/transaction/fee_model.rb', line 23

def compute_fee(_transaction)
  raise NotImplementedError, "#{self.class}#compute_fee must be implemented"
end