Skip to content

Commit 5c0feb3

Browse files
authored
Merge pull request tronprotocol#1049 from tronprotocol/feature/send_fee_into_block_hole_account
send fee into blackHoleAccount
2 parents 3ac41ed + 8844ab7 commit 5c0feb3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/main/java/org/tron/core/db/BandwidthProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ private boolean consumeFee(AccountCapsule accountCapsule, long fee) {
128128
long latestOperationTime = dbManager.getHeadBlockTimeStamp();
129129
accountCapsule.setLatestOperationTime(latestOperationTime);
130130
dbManager.adjustBalance(accountCapsule, -fee);
131+
dbManager.adjustBalance(this.dbManager.getAccountStore().getBlackhole().createDbKey(), +fee);
131132
return true;
132133
} catch (BalanceInsufficientException e) {
133134
return false;

src/test/java/org/tron/core/BandwidthTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,17 @@ public void testConsumeOwner() throws Exception {
299299

300300
@Test
301301
public void testUsingFee() throws Exception {
302+
303+
Args.getInstance().getGenesisBlock().getAssets().forEach(account -> {
304+
AccountCapsule capsule =
305+
new AccountCapsule(
306+
ByteString.copyFromUtf8(""),
307+
ByteString.copyFrom(account.getAddress()),
308+
AccountType.AssetIssue,
309+
100L);
310+
dbManager.getAccountStore().put(account.getAddress(), capsule);
311+
});
312+
302313
dbManager.getDynamicPropertiesStore().saveLatestBlockHeaderTimestamp(1526647838000L);
303314
dbManager.getDynamicPropertiesStore().saveFreeNetLimit(0L);
304315

0 commit comments

Comments
 (0)