diff --git a/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java b/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java index 4319ee5ee16..dbef330a357 100644 --- a/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java +++ b/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java @@ -400,6 +400,19 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore, } break; } + case ALLOW_TRANSACTION_FEE_POOL: { + if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_1)) {//todo, set later + throw new ContractValidateException( + "Bad chain parameter id [ALLOW_TRANSACTION_FEE_POOL]"); + } + if (value != 1 && value != 0) { + throw new ContractValidateException( + "This value[ALLOW_TRANSACTION_FEE_POOL] is only allowed to be 1 or 0"); + } + break; + } + + default: break; } @@ -449,7 +462,8 @@ public enum ProposalType { // current value, value range ALLOW_TVM_STAKE(43), // 0, 1 ALLOW_MARKET_TRANSACTION(44), // {0, 1} MARKET_SELL_FEE(45), // 0 [0,10_000_000_000] - MARKET_CANCEL_FEE(46); // 0 [0,10_000_000_000] + MARKET_CANCEL_FEE(46), // 0 [0,10_000_000_000] + ALLOW_TRANSACTION_FEE_POOL(50); // 0, 1 private long code; diff --git a/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java b/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java index 34fa4c591d6..baf8a92442f 100644 --- a/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java +++ b/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java @@ -467,6 +467,13 @@ private DynamicPropertiesStore(@Value("properties") String dbName) { this.saveMarketQuantityLimit(1_000_000_000_000_000L); } + + try { + this.getAllowTransactionFeePool(); + } catch (IllegalArgumentException e) { + this.saveAllowTransactionFeePool(0L); + } + try { this.getTotalTransactionCost(); } catch (IllegalArgumentException e) { diff --git a/framework/src/main/java/org/tron/core/consensus/ProposalService.java b/framework/src/main/java/org/tron/core/consensus/ProposalService.java index d5e11ff3f23..cc63e14e671 100644 --- a/framework/src/main/java/org/tron/core/consensus/ProposalService.java +++ b/framework/src/main/java/org/tron/core/consensus/ProposalService.java @@ -230,6 +230,10 @@ public static boolean process(Manager manager, ProposalCapsule proposalCapsule) manager.getDynamicPropertiesStore().saveMarketCancelFee(entry.getValue()); break; } + case ALLOW_TRANSACTION_FEE_POOL: { + manager.getDynamicPropertiesStore().saveAllowTransactionFeePool(entry.getValue()); + break; + } default: find = false; break; diff --git a/framework/src/main/java/org/tron/core/db/Manager.java b/framework/src/main/java/org/tron/core/db/Manager.java index 0d6e43c1b2f..a5ae1ccdb65 100644 --- a/framework/src/main/java/org/tron/core/db/Manager.java +++ b/framework/src/main/java/org/tron/core/db/Manager.java @@ -1365,6 +1365,14 @@ private void payReward(BlockCapsule block) { AccountCapsule account = getAccountStore().get(witness); account.setAllowance(account.getAllowance() + chainBaseManager.getDynamicPropertiesStore().getWitnessPayPerBlock()); + + if (chainBaseManager.getDynamicPropertiesStore().supportTransactionFeePool()) { + long transactionFeeReward = Math + .floorDiv(chainBaseManager.getDynamicPropertiesStore().getTransactionFeePool(), + Constant.TRANSACTION_FEE_POOL_PERIOD); + account.setAllowance(account.getAllowance() + transactionFeeReward); + } + getAccountStore().put(account.createDbKey(), account); }