Skip to content

Commit 89aeb8e

Browse files
committed
add witness schedule unit test
1 parent c390212 commit 89aeb8e

10 files changed

Lines changed: 231 additions & 235 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private AccountStore(String dbName) {
2121
super(dbName);
2222
}
2323

24-
public void destroy() {
24+
public static void destroy() {
2525
instance = null;
2626
}
2727

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private AssetIssueStore(String dbName) {
1515
super(dbName);
1616
}
1717

18-
public void destroy() {
18+
public static void destroy() {
1919
instance = null;
2020
}
2121

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@Slf4j
1515
public class DynamicPropertiesStore extends TronStoreWithRevoking<BytesCapsule> {
1616

17-
private static final long MAINTENANCE_TIME_INTERVAL = 24 * 3600 * 1000;// (ms)
17+
private static final long MAINTENANCE_TIME_INTERVAL = 300 * 1000;// (ms)
1818
private static final long MAINTENANCE_SKIP_SLOTS = 2;
1919

2020
private static final byte[] LATEST_BLOCK_HEADER_TIMESTAMP = "latest_block_header_timestamp"
@@ -94,7 +94,7 @@ public boolean has(byte[] key) {
9494

9595
private static DynamicPropertiesStore instance;
9696

97-
public void destroy() {
97+
public static void destroy() {
9898
instance = null;
9999
}
100100

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,14 @@ public Set<Node> readNeighbours() {
212212
}
213213

214214
public void destory() {
215-
getAccountStore().destroy();
216-
getTransactionStore().destroy();
217-
getBlockStore().destroy();
218-
getWitnessStore().destory();
219-
getAssetIssueStore().destroy();
220-
getDynamicPropertiesStore().destroy();
215+
AccountStore.destroy();
216+
TransactionStore.destroy();
217+
BlockStore.destroy();
218+
WitnessStore.destory();
219+
AssetIssueStore.destroy();
220+
DynamicPropertiesStore.destroy();
221+
WitnessScheduleStore.destroy();
222+
BlockIndexStore.destroy();
221223
}
222224

223225
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static void destory() {
3838
instance = null;
3939
}
4040

41-
void destroy() {
41+
public static void destroy() {
4242
instance = null;
4343
}
4444

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.google.protobuf.ByteString;
44
import java.util.ArrayList;
55
import java.util.List;
6-
import java.util.StringTokenizer;
76
import java.util.Optional;
87
import lombok.extern.slf4j.Slf4j;
98
import org.tron.common.utils.ByteArray;
@@ -38,7 +37,7 @@ public boolean has(byte[] key) {
3837

3938
private static WitnessScheduleStore instance;
4039

41-
public void destroy() {
40+
public static void destroy() {
4241
instance = null;
4342
}
4443

‎src/main/resources/config.conf‎

Lines changed: 34 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
net {
2-
# type = mainnet
2+
// type = mainnet
33
type = testnet
44
}
55

6+
67
storage {
78
# Directory for storing persistent data
89
directory = "database"
@@ -16,10 +17,8 @@ node.discovery = {
1617
}
1718

1819
node {
19-
# trust node for solidity node
20-
trustNode = "47.254.16.55:50051"
21-
22-
listen.port = 18888
20+
trustNode = ""
21+
listen.port = 9001
2322

2423
connection.timeout = 2
2524

@@ -31,23 +30,12 @@ node {
3130
# port = 30303
3231
# nodeId = e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c
3332
# }
34-
"47.254.16.55:18888",
35-
"47.254.18.49:18888",
36-
"18.188.111.53:18888",
37-
"54.219.41.56:18888",
38-
"35.169.113.187:18888",
39-
"34.214.241.188:18888",
40-
"47.254.146.147:18888",
41-
"47.254.144.25:18888",
42-
"47.91.246.252:18888",
43-
"47.91.216.69:18888",
44-
"39.106.220.120:18888"
4533
]
4634

4735
maxActiveNodes = 30
4836

4937
p2p {
50-
version = 50 # 50: testnet; 101: debug
38+
version = 9 # 46: testnet; 101: debug
5139
}
5240

5341
}
@@ -65,17 +53,6 @@ seed.node = {
6553
# "ip:port"
6654
# ]
6755
ip.list = [
68-
"47.254.16.55:18888",
69-
"47.254.18.49:18888",
70-
"18.188.111.53:18888",
71-
"54.219.41.56:18888",
72-
"35.169.113.187:18888",
73-
"34.214.241.188:18888",
74-
"47.254.146.147:18888",
75-
"47.254.144.25:18888",
76-
"47.91.246.252:18888",
77-
"47.91.216.69:18888",
78-
"39.106.220.120:18888"
7956
]
8057
}
8158

@@ -91,96 +68,70 @@ genesis.block = {
9168
{
9269
accountName = "Devaccount"
9370
accountType = "AssetIssue"
94-
address = "a099357684bc659f5166046b56c95a0e99f1265cbd"
95-
balance = "10000000000000000"
71+
address = "a0cafbff74a6eb34597ed4ea65d92e3a2cf0fa900b"
72+
balance = "10000"
9673
},
74+
# the account of foundation.
9775
{
9876
accountName = "Zion"
9977
accountType = "AssetIssue"
100-
address = "a0b4750e2cd76e19dca331bf5d089b71c3c2798548"
101-
balance = "15000000000000000"
78+
address = "a055ddae14564f82d5b94c7a131b5fcfd31ad6515a"
79+
balance = "25000000000000000"
10280
},
81+
82+
# the account of payment
10383
{
10484
accountName = "Sun"
10585
accountType = "AssetIssue"
106-
address = "a025a3aae39b24a257f95769c701e8d6978ebe9fc5"
86+
address = "a04948c2e8a756d9437037dcd8c7e0c73d560ca38d"
10787
balance = "10000000000000000"
10888
},
89+
90+
# the account of coin burn
10991
{
11092
accountName = "Blackhole"
11193
accountType = "AssetIssue"
112-
address = "a0559ccf55fadffdf814a42aff331de9688c132612"
94+
address = "a0548794500882809695a8a687866e76d4271a146a"
11395
balance = "-9223372036854775808"
11496
}
11597
]
11698

11799
witnesses = [
118100
{
119-
address: a0904fe896536f4bebc64c95326b5054a2c3d27df6
120-
url = "http://Mercury.org",
121-
voteCount = 105
122-
},
123-
{
124-
address: a0807337f180b62a77576377c1d0c9c24df5c0dd62
125-
url = "http://Venus.org",
126-
voteCount = 104
127-
},
128-
{
129-
address: a05430a3f089154e9e182ddd6fe136a62321af22a7
130-
url = "http://Earth.org",
131-
voteCount = 103
132-
},
133-
{
134-
address: a08beaa1a8e2d45367af7bae7c490b9932a4fa4301
135-
url = "http://Mars.org",
136-
voteCount = 102
137-
},
138-
{
139-
address: a0b070b2b58f4328e293dc9d6012f59c263d3a1df6
140-
url = "http://Jupiter.org",
101+
# privKey:c4e7abd0b1f2e4ab38c98b98ad8e81184ac4a3fa30b75e8b8e397ce362ae0c26
102+
address: a03e489e58ab3fe7e4a6a9fa70c8e8b006c868cf48
103+
url = "http://nanfengpo1.org"
141104
voteCount = 101
142105
},
143106
{
144-
address: a00a9309758508413039e4bc5a3d113f3ecc55031d
145-
url = "http://Saturn.org",
146-
voteCount = 100
147-
},
148-
{
149-
address: a06a17a49648a8ad32055c06f60fa14ae46df94cc1
150-
url = "http://Uranus.org",
151-
voteCount = 99
152-
},
153-
{
154-
address: a0ec6525979a351a54fa09fea64beb4cce33ffbb7a
155-
url = "http://Neptune.org",
156-
voteCount = 98
157-
},
158-
{
159-
address: a0fab5fbf6afb681e4e37e9d33bddb7e923d6132e5
160-
url = "http://Pluto.org",
161-
voteCount = 97
107+
# privKey:6de7aa0610f877a215429c5d359845b97c3385a929da436edb1d26ebee73bde3
108+
address: a0a09b16db113869d0a88eea6e91227122486f84a2
109+
url = "http://nanfengpo2.org"
110+
voteCount = 102
162111
},
163112
{
164-
address: a014eebe4d30a6acb505c8b00b218bdc4733433c68
165-
url = "http://Altair.org",
166-
voteCount = 96
113+
# privKey:fe734333466c7a7078c54091f1df02b0a92c75b864f82bb6b1dce6801afb352c
114+
address: a0e1a64afb81cdf5054387517ac7c3a7a55ab966ed
115+
url = "http://nanfengpo3.org"
116+
voteCount = 103
167117
},
168118
{
169-
address: a04711bf7afbdf44557defbdf4c4e7aa6138c6331f
170-
url = "http://AlphaLyrae.org",
171-
voteCount = 95
119+
# privKey:8595b427940f3235bdfe6657610cd98cbc9e5b90c00cfa51c035d49e7659bcf1
120+
address: a0cafbff74a6eb34597ed4ea65d92e3a2cf0fa900b
121+
url = "http://nanfengpo4.org"
122+
voteCount = 104
172123
}
173124
]
174125

175-
timestamp = "0" #2017-8-26 12:00:00
126+
timestamp = "9" #2017-8-26 12:00:00
176127

177128
parentHash = "0x0000000000000000000000000000000000000000000000000000000000000000"
178129
}
179130

180131
localwitness = [
181-
132+
c4e7abd0b1f2e4ab38c98b98ad8e81184ac4a3fa30b75e8b8e397ce362ae0c26
182133
]
183134

184135
block = {
185-
needSyncCheck = true # first node : false, other : true
136+
needSyncCheck = false # first node : false, other : true
186137
}

0 commit comments

Comments
 (0)