Skip to content

Commit 00a4e8b

Browse files
committed
remove votestore index
1 parent c22b286 commit 00a4e8b

3 files changed

Lines changed: 4 additions & 28 deletions

File tree

‎src/main/java/org/tron/core/db/Manager.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ public void setWitnessScheduleStore(final WitnessScheduleStore witnessScheduleSt
141141
this.witnessScheduleStore = witnessScheduleStore;
142142
}
143143

144+
public VotesStore getVotesStore() {
145+
return this.votesStore;
146+
}
147+
144148
public List<TransactionCapsule> getPendingTransactions() {
145149
return this.pendingTransactions;
146150
}
@@ -358,10 +362,6 @@ public AccountStore getAccountStore() {
358362
return this.accountStore;
359363
}
360364

361-
public VotesStore getVotesStore() {
362-
return this.votesStore;
363-
}
364-
365365
/**
366366
* judge balance.
367367
*/

‎src/main/java/org/tron/core/db/VotesStore.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ public boolean has(byte[] key) {
5858
@Override
5959
public void put(byte[] key, VotesCapsule item) {
6060
super.put(key, item);
61-
if (indexHelper != null) {
62-
indexHelper.update(item.getInstance());
63-
}
6461
}
6562

6663
/**

‎src/main/java/org/tron/core/db/api/IndexHelper.java‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
import org.tron.core.capsule.AssetIssueCapsule;
88
import org.tron.core.capsule.BlockCapsule;
99
import org.tron.core.capsule.TransactionCapsule;
10-
import org.tron.core.capsule.VotesCapsule;
1110
import org.tron.core.capsule.WitnessCapsule;
1211
import org.tron.core.db.api.index.Index;
1312
import org.tron.protos.Contract.AssetIssueContract;
1413
import org.tron.protos.Protocol.Account;
1514
import org.tron.protos.Protocol.Block;
1615
import org.tron.protos.Protocol.Transaction;
17-
import org.tron.protos.Protocol.Votes;
1816
import org.tron.protos.Protocol.Witness;
1917

2018
@Slf4j
@@ -35,9 +33,6 @@ public class IndexHelper {
3533
@Getter
3634
@Resource
3735
private Index.Iface<AssetIssueContract> assetIssueIndex;
38-
@Getter
39-
@Resource
40-
private Index.Iface<Votes> votesIndex;
4136

4237
private <T> void add(Index.Iface<T> index, byte[] bytes) {
4338
index.add(bytes);
@@ -63,10 +58,6 @@ public void add(AssetIssueContract a) {
6358
add(assetIssueIndex, getKey(a));
6459
}
6560

66-
public void add(Votes v) {
67-
add(votesIndex, getKey(v));
68-
}
69-
7061
private <T> void update(Index.Iface<T> index, byte[] bytes) {
7162
index.update(bytes);
7263
}
@@ -91,10 +82,6 @@ public void update(AssetIssueContract a) {
9182
update(assetIssueIndex, getKey(a));
9283
}
9384

94-
public void update(Votes v) {
95-
update(votesIndex, getKey(v));
96-
}
97-
9885
private <T> void remove(Index.Iface<T> index, byte[] bytes) {
9986
index.remove(bytes);
10087
}
@@ -119,10 +106,6 @@ public void remove(AssetIssueContract a) {
119106
remove(assetIssueIndex, getKey(a));
120107
}
121108

122-
public void remove(Votes v) {
123-
remove(votesIndex, getKey(v));
124-
}
125-
126109
private byte[] getKey(Transaction t) {
127110
return new TransactionCapsule(t).getTransactionId().getBytes();
128111
}
@@ -142,8 +125,4 @@ private byte[] getKey(Account a) {
142125
private byte[] getKey(AssetIssueContract a) {
143126
return new AssetIssueCapsule(a).getName().toByteArray();
144127
}
145-
146-
private byte[] getKey(Votes v) {
147-
return new VotesCapsule(v).createDbKey();
148-
}
149128
}

0 commit comments

Comments
 (0)