Skip to content

Commit

Permalink
name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
forfreeday committed Jan 13, 2021
1 parent f09bedb commit 08e8544
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean execute(Object object) throws ContractExeException {
accountStore.put(ownerAddress, account);

Commons.adjustBalance(accountStore, ownerAddress, -fee);
if (chainBaseManager.getDynamicPropertiesStore().supportOptimizeBlackHole()) {
if (chainBaseManager.getDynamicPropertiesStore().supportBlackHoleOptimization()) {
chainBaseManager.getDynamicPropertiesStore().burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public boolean execute(Object result) throws ContractExeException {
}

Commons.adjustBalance(accountStore, ownerAddress, -fee);
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);//send to blackhole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public boolean execute(Object result)
Commons
.adjustBalance(accountStore, accountCreateContract.getOwnerAddress().toByteArray(), -fee);
// Add to blackhole address
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public boolean execute(Object object) throws ContractExeException {

accountStore.put(accountCapsule.createDbKey(), accountCapsule);
dynamicStore.saveLatestExchangeNum(id);
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public boolean execute(Object object) throws ContractExeException {

// fee
accountCapsule.setBalance(accountCapsule.getBalance() - fee);
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public boolean execute(Object object) throws ContractExeException {
// fee
accountCapsule.setBalance(accountCapsule.getBalance() - fee);
// add to blackhole address
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public boolean execute(Object object) throws ContractExeException {
}

Commons.adjustBalance(accountStore, ownerAddress, -(Math.addExact(fee, amount)));
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public boolean execute(Object result) throws ContractExeException {
accountStore.put(toAddress, toAccountCapsule);

Commons.adjustBalance(accountStore, ownerAccountCapsule, -fee);
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private void createWitness(final WitnessCreateContract witnessCreateContract)
long cost = dynamicStore.getAccountUpgradeCost();
Commons
.adjustBalance(accountStore, witnessCreateContract.getOwnerAddress().toByteArray(), -cost);
if (dynamicStore.supportOptimizeBlackHole()) {
if (dynamicStore.supportBlackHoleOptimization()) {
dynamicStore.burnTrx(cost);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole(), +cost);
Expand Down
4 changes: 2 additions & 2 deletions actuator/src/main/java/org/tron/core/utils/ProposalUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore,
}
break;
}
case ALLOW_OPTIMIZE_BLACKHOLE: {
case ALLOW_BLACKHOLE_OPTIMIZATION: {
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_1_2)) {
throw new ContractValidateException(
"Bad chain parameter id [ALLOW_REMOVE_BLACKHOLE]");
Expand Down Expand Up @@ -487,7 +487,7 @@ public enum ProposalType { // current value, value range
MARKET_CANCEL_FEE(46), // 0 [0,10_000_000_000]
MAX_FEE_LIMIT(47), // [0, 10_000_000_000]
ALLOW_TRANSACTION_FEE_POOL(48), // 0, 1
ALLOW_OPTIMIZE_BLACKHOLE(49);// 0,1
ALLOW_BLACKHOLE_OPTIMIZATION(49);// 0,1

private long code;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private void payEnergyBill(
if (dynamicPropertiesStore.supportTransactionFeePool() &&
!contractResult.equals(contractResult.OUT_OF_TIME)) {
dynamicPropertiesStore.addTransactionFeePool(energyFee);
} else if (dynamicPropertiesStore.supportOptimizeBlackHole()) {
} else if (dynamicPropertiesStore.supportBlackHoleOptimization()) {
dynamicPropertiesStore.burnTrx(energyFee);
} else {
//send to blackHole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected boolean consumeFeeForBandwidth(AccountCapsule accountCapsule, long fee
Commons.adjustBalance(accountStore, accountCapsule, -fee);
if (dynamicPropertiesStore.supportTransactionFeePool()) {
dynamicPropertiesStore.addTransactionFeePool(fee);
} else if (dynamicPropertiesStore.supportOptimizeBlackHole()) {
} else if (dynamicPropertiesStore.supportBlackHoleOptimization()) {
dynamicPropertiesStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole().createDbKey(), +fee);
Expand All @@ -92,7 +92,7 @@ protected boolean consumeFeeForNewAccount(AccountCapsule accountCapsule, long fe
long latestOperationTime = dynamicPropertiesStore.getLatestBlockHeaderTimestamp();
accountCapsule.setLatestOperationTime(latestOperationTime);
Commons.adjustBalance(accountStore, accountCapsule, -fee);
if (dynamicPropertiesStore.supportOptimizeBlackHole()) {
if (dynamicPropertiesStore.supportBlackHoleOptimization()) {
dynamicPropertiesStore.burnTrx(fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole().createDbKey(), +fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public class DynamicPropertiesStore extends TronStoreWithRevoking<BytesCapsule>

private static final byte[] MAX_FEE_LIMIT = "MAX_FEE_LIMIT".getBytes();
private static final byte[] BURN_TRX_AMOUNT = "BURN_TRX_AMOUNT".getBytes();
private static final byte[] ALLOW_OPTIMIZE_BLACKHOLE = "ALLOW_OPTIMIZE_BLACKHOLE".getBytes();
private static final byte[] ALLOW_BLACKHOLE_OPTIMIZATION = "ALLOW_BLACKHOLE_OPTIMIZATION".getBytes();

@Autowired
private DynamicPropertiesStore(@Value("properties") String dbName) {
Expand Down Expand Up @@ -724,9 +724,9 @@ private DynamicPropertiesStore(@Value("properties") String dbName) {
}

try {
this.getAllowOptimizeBlackHole();
this.getAllowBlackHoleOptimization();
} catch (IllegalArgumentException e) {
this.saveAllowOptimizeBlackHole(CommonParameter.getInstance().getAllowOptimizeBlackHole());
this.saveAllowBlackHoleOptimization(CommonParameter.getInstance().getAllowBlackHoleOptimization());
}

}
Expand Down Expand Up @@ -2151,20 +2151,20 @@ private void saveBurnTrx(long amount) {
this.put(BURN_TRX_AMOUNT, new BytesCapsule(ByteArray.fromLong(amount)));
}

public boolean supportOptimizeBlackHole() {
return getAllowOptimizeBlackHole() == 1L;
public boolean supportBlackHoleOptimization() {
return getAllowBlackHoleOptimization() == 1L;
}

public void saveAllowOptimizeBlackHole(long value) {
this.put(ALLOW_OPTIMIZE_BLACKHOLE, new BytesCapsule(ByteArray.fromLong(value)));
public void saveAllowBlackHoleOptimization(long value) {
this.put(ALLOW_BLACKHOLE_OPTIMIZATION, new BytesCapsule(ByteArray.fromLong(value)));
}

public long getAllowOptimizeBlackHole() {
return Optional.ofNullable(getUnchecked(ALLOW_OPTIMIZE_BLACKHOLE))
public long getAllowBlackHoleOptimization() {
return Optional.ofNullable(getUnchecked(ALLOW_BLACKHOLE_OPTIMIZATION))
.map(BytesCapsule::getData)
.map(ByteArray::toLong)
.orElseThrow(
() -> new IllegalArgumentException("not found ALLOW_OPTIMIZE_BLACKHOLE"));
() -> new IllegalArgumentException("not found ALLOW_BLACKHOLE_OPTIMIZATION"));
}

private static class DynamicResourceProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public class CommonParameter {

@Getter
@Setter
public long allowOptimizeBlackHole;
public long allowBlackHoleOptimization;

// @Getter
// @Setter
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/org/tron/core/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public class Constant {
public static final String COMMITTEE_ALLOW_TVM_ASSETISSUE = "committee.allowTvmAssetIssue";

public static final String COMMITTEE_ALLOW_TRANSACTION_FEE_POOL = "committee.allowTransactionFeePool";
public static final String COMMITTEE_ALLOW_OPTIMIZE_BLACK_HOLE = "committee.allowOptimizeBlackHole";
public static final String COMMITTEE_ALLOW_BLACK_HOLE_OPTIMIZATION = "committee.allowBlackHoleOptimization";

public static final String METRICS_STORAGE_ENABLE = "node.metrics.storageEnable";
public static final String METRICS_INFLUXDB_IP = "node.metrics.influxdb.ip";
Expand Down
2 changes: 1 addition & 1 deletion framework/src/main/java/org/tron/core/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ public Protocol.ChainParameters getChainParameters() {

builder.addChainParameter(Protocol.ChainParameters.ChainParameter.newBuilder()
.setKey("getAllowOptimizeBlackHole")
.setValue(dbManager.getDynamicPropertiesStore().getAllowOptimizeBlackHole())
.setValue(dbManager.getDynamicPropertiesStore().getAllowBlackHoleOptimization())
.build());

return builder.build();
Expand Down
8 changes: 4 additions & 4 deletions framework/src/main/java/org/tron/core/config/args/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static void clearParam() {
PARAMETER.allowShieldedTRC20Transaction = 0;
PARAMETER.allowMarketTransaction = 0;
PARAMETER.allowTransactionFeePool = 0;
PARAMETER.allowOptimizeBlackHole = 0;
PARAMETER.allowBlackHoleOptimization = 0;
PARAMETER.allowTvmIstanbul = 0;
PARAMETER.allowTvmStake = 0;
PARAMETER.allowTvmAssetIssue = 0;
Expand Down Expand Up @@ -633,9 +633,9 @@ public static void setParam(final String[] args, final String confFileName) {
config.hasPath(Constant.COMMITTEE_ALLOW_TRANSACTION_FEE_POOL) ? config
.getInt(Constant.COMMITTEE_ALLOW_TRANSACTION_FEE_POOL) : 0;

PARAMETER.allowOptimizeBlackHole =
config.hasPath(Constant.COMMITTEE_ALLOW_OPTIMIZE_BLACK_HOLE) ? config
.getInt(Constant.COMMITTEE_ALLOW_OPTIMIZE_BLACK_HOLE) : 0;
PARAMETER.allowBlackHoleOptimization =
config.hasPath(Constant.COMMITTEE_ALLOW_BLACK_HOLE_OPTIMIZATION) ? config
.getInt(Constant.COMMITTEE_ALLOW_BLACK_HOLE_OPTIMIZATION) : 0;

PARAMETER.allowTvmIstanbul =
config.hasPath(Constant.COMMITTEE_ALLOW_TVM_ISTANBUL) ? config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ public static boolean process(Manager manager, ProposalCapsule proposalCapsule)
manager.getDynamicPropertiesStore().saveAllowTransactionFeePool(entry.getValue());
break;
}
case ALLOW_OPTIMIZE_BLACKHOLE: {
manager.getDynamicPropertiesStore().saveAllowOptimizeBlackHole(entry.getValue());
case ALLOW_BLACKHOLE_OPTIMIZATION: {
manager.getDynamicPropertiesStore().saveAllowBlackHoleOptimization(entry.getValue());
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion framework/src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ public void consumeMultiSignFee(TransactionCapsule trx, TransactionTrace trace)
if (accountCapsule != null) {
adjustBalance(getAccountStore(), accountCapsule, -fee);

if (getDynamicPropertiesStore().supportOptimizeBlackHole()) {
if (getDynamicPropertiesStore().supportBlackHoleOptimization()) {
getDynamicPropertiesStore().burnTrx(fee);
} else {
adjustBalance(getAccountStore(), this.getAccountStore().getBlackhole(), +fee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.tron.common.parameter.CommonParameter;
import org.tron.core.config.args.Args;
import org.tron.core.services.filter.LiteFnQueryHttpFilter;
import org.tron.core.services.http.GetBurnTrxServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet;
Expand Down Expand Up @@ -144,6 +145,9 @@ public class HttpApiOnSolidityService implements Service {
@Autowired
private LiteFnQueryHttpFilter liteFnQueryHttpFilter;

@Autowired
private GetBurnTrxServlet getBurnTrxServlet;

@Override
public void init() {

Expand Down Expand Up @@ -239,6 +243,7 @@ public void start() {
context.addServlet(new ServletHolder(getNodeInfoOnSolidityServlet), "/wallet/getnodeinfo");
context.addServlet(new ServletHolder(getBrokerageServlet), "/walletsolidity/getBrokerage");
context.addServlet(new ServletHolder(getRewardServlet), "/walletsolidity/getReward");
context.addServlet(new ServletHolder(getBurnTrxServlet), "/walletsolidity/getburntrx");

// filters the specified APIs
// when node is lite fullnode and openHistoryQueryWhenLiteFN is false
Expand Down

0 comments on commit 08e8544

Please sign in to comment.