Class TransactionFeeCalculator
- java.lang.Object
-
- com.h2tcoin.takamakachain.transactions.fee.TransactionFeeCalculator
-
public class TransactionFeeCalculator extends Object
- Author:
- Giovanni Antino
-
-
Constructor Summary
Constructors Constructor Description TransactionFeeCalculator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canPayFee(TransactionBox tbox, BalanceBean payer)
For transactions that do not move money but have a cost that is assessed based on the structure alone.static FeeBean
getFeeBean(TransactionBox tbox)
static RewardBean
getPayBeanAndApplyToBalanceThePay(TransactionBox tbox, BalanceBean payer)
This function alters the payer's balance sheet.static BigInteger
totalFee(FeeBean fb)
-
-
-
Method Detail
-
getFeeBean
public static FeeBean getFeeBean(TransactionBox tbox)
-
getPayBeanAndApplyToBalanceThePay
public static RewardBean getPayBeanAndApplyToBalanceThePay(TransactionBox tbox, BalanceBean payer)
This function alters the payer's balance sheet. This function must be called only after verifying that the payer can afford to execute the transaction. The verification is carried out throughcanPayFee == true
. If the function is called on a payer with an unsustainable balance sheet, it will give rise to a negative balance sheet.- Parameters:
tbox
-payer
-- Returns:
- the reward due to the node for the execution of the current transaction
-
canPayFee
public static boolean canPayFee(TransactionBox tbox, BalanceBean payer)
For transactions that do not move money but have a cost that is assessed based on the structure alone. These include stake, stake_undo, all register assignments and deregisters.- Parameters:
tbox
-payer
-- Returns:
-
totalFee
public static BigInteger totalFee(FeeBean fb)
-
-