Skip to content

Commit ec226ba

Browse files
authored
Merge pull request tronprotocol#1081 from tronprotocol/release
Release
2 parents 93d7820 + a7a1b6c commit ec226ba

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/org/tron/core/actuator/WithdrawBalanceActuator.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
import com.google.protobuf.Any;
55
import com.google.protobuf.ByteString;
66
import com.google.protobuf.InvalidProtocolBufferException;
7+
import java.util.Arrays;
78
import lombok.extern.slf4j.Slf4j;
89
import org.tron.common.utils.StringUtil;
910
import org.tron.core.Wallet;
1011
import org.tron.core.capsule.AccountCapsule;
1112
import org.tron.core.capsule.TransactionResultCapsule;
13+
import org.tron.core.config.args.Args;
1214
import org.tron.core.db.Manager;
1315
import org.tron.core.exception.ContractExeException;
1416
import org.tron.core.exception.ContractValidateException;
@@ -84,12 +86,20 @@ public boolean validate() throws ContractValidateException {
8486
"Account[" + readableOwnerAddress + "] not exists");
8587
}
8688

89+
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
8790
if (!dbManager.getWitnessStore().has(ownerAddress)) {
88-
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
8991
throw new ContractValidateException(
9092
"Account[" + readableOwnerAddress + "] is not a witnessAccount");
9193
}
9294

95+
boolean isGP = Args.getInstance().getGenesisBlock().getWitnesses().stream().anyMatch(witness ->
96+
Arrays.equals(ownerAddress, witness.getAddress()));
97+
if (isGP) {
98+
throw new ContractValidateException(
99+
"Account[" + readableOwnerAddress
100+
+ "] is a guard representative and is not allowed to withdraw Balance");
101+
}
102+
93103
long latestWithdrawTime = accountCapsule.getLatestWithdrawTime();
94104
long now = dbManager.getHeadBlockTimeStamp();
95105
long witnessAllowanceFrozenTime =

src/main/java/org/tron/core/witness/WitnessController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ private Map<ByteString, Long> countVote(VotesStore votesStore) {
258258
// .getVoteRewardRate());
259259
//account.setBalance(account.getBalance() + reward);
260260
//accountStore.put(account.createDbKey(), account);
261+
261262
votes.getOldVotes().forEach(vote -> {
262263
//TODO validate witness //active_witness
263264
ByteString voteAddress = vote.getVoteAddress();
@@ -279,6 +280,7 @@ private Map<ByteString, Long> countVote(VotesStore votesStore) {
279280
}
280281
});
281282

283+
282284
sizeCount++;
283285
votesStore.delete(next.getKey());
284286
}

0 commit comments

Comments
 (0)