Skip to content

Commit b45bf28

Browse files
fix: improve instantsend processing in background thread and optimize wallet loading (#293)
* chore: update idea test configuration file * fix: support processing islocks on the background thread by default * fix: add parallelization to Wallet protobuf reading * fix: reduce processing for non-wallet transactions * fix: add DashSystem.removeWallet * fix: allow OP_RETURN with 0.00 value in DefaultRiskAnalysis.isOutputStandard * fix: use CopyOnWriteArrayList for wallet list in InstantSendManager * fix: add parallelization to reading a wallet (protobuf) * fix: update Testnet masternode lists and add a masternode update python script * fix: decrease logging of quorum lists * fix: improve InstantSend lock processing * tests: fix CoinJoinSessionTest intermittent failures * feat: ad CoinJoinForwardingService example that simulates a large coinjoin wallet * fix: more InstantSendManager improvements * fix: improve CoinJoinForwardingService * fix: improve WalletProtobufSerializer.readWallet * fix: add forceMerge to MasternodeSeedPeers * fix: update hp masternode list * fix: update PortOpen to check seeds and masternode lists of the network * fix: prevent divide by zero bug in PortOpen * fix: handle edge cases to ensure locks are set in the tx confidence * fix: coderabbit fixes
1 parent 3377cdb commit b45bf28

16 files changed

Lines changed: 1182 additions & 370 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ checkpoints-krupnik.txt
2525
/*.chainlocks
2626
*.gobjects
2727
/*.log
28-
.DS_Store
28+
.DS_Store
29+
*.inventory

.run/Tests in 'dashj-master-three.core.test'.run.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
</option>
1111
<option name="taskNames">
1212
<list>
13-
<option value=":core:test" />
13+
<option value=":dashj-core:test" />
1414
</list>
1515
</option>
1616
<option name="vmOptions" />
1717
</ExternalSystemSettings>
1818
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
1919
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
2020
<DebugAllEnabled>false</DebugAllEnabled>
21+
<RunAsTest>false</RunAsTest>
2122
<method v="2" />
2223
</configuration>
2324
</component>

core/src/main/java/org/bitcoinj/evolution/QuorumRotationState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ public SimplifiedMasternodeList getMnListAtH() {
10751075

10761076
public SimplifiedQuorumList getQuorumListAtH() {
10771077
SimplifiedQuorumList topList = getTopActiveQuorumList();
1078-
log.warn("obtaining this quorum list: {} from {} quorum lists", topList, activeQuorumLists.size());
1078+
log.debug("obtaining this quorum list: {} from {} quorum lists", topList, activeQuorumLists.size());
10791079
return topList;
10801080
}
10811081

@@ -1106,7 +1106,7 @@ public SimplifiedQuorumList getQuorumListForBlock(StoredBlock block) {
11061106
if (topList.getHeight() == -1) {
11071107
topList = getTopActiveQuorumList();
11081108
}
1109-
log.warn("obtaining quorum list {}: {} from {} quorum lists", block.getHeight(), topList, activeQuorumLists.size());
1109+
log.debug("obtaining quorum list {}: {} from {} quorum lists", block.getHeight(), topList, activeQuorumLists.size());
11101110
return topList;
11111111
}
11121112

core/src/main/java/org/bitcoinj/manager/DashSystem.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void initDash(boolean liteMode, boolean allowInstantX, @Nullable EnumSet<
142142
signingManager = new SigningManager(context, recoveredSigsDB, quorumManager, masternodeSync);
143143

144144
instantSendDB = new SPVInstantSendDatabase(context);
145-
instantSendManager = new InstantSendManager(context, instantSendDB, signingManager);
145+
instantSendManager = new InstantSendManager(context, instantSendDB, signingManager, false);
146146
chainLockHandler = new ChainLocksHandler(context);
147147
llmqBackgroundThread = new LLMQBackgroundThread(context, instantSendManager, chainLockHandler, signingManager, masternodeListManager);
148148
masternodeMetaDataManager = new MasternodeMetaDataManager(context);
@@ -444,4 +444,8 @@ public void triggerMnListDownloadComplete() {
444444
public void addWallet(Wallet wallet) {
445445
instantSendManager.addWallet(wallet);
446446
}
447+
448+
public void removeWallet(Wallet wallet) {
449+
instantSendManager.removeWallet(wallet);
450+
}
447451
}

core/src/main/java/org/bitcoinj/net/discovery/MasternodeSeedPeers.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class MasternodeSeedPeers implements PeerDiscovery {
3838
private int pnseedIndex;
3939

4040
// if there are more than 20 masternodes, then don't use HP masternodes in peer discovery
41-
private static String[] mergeArrays(String[] masternodeArray, String[] hpMasternodeArray) {
42-
if (masternodeArray.length > ENOUGH_MASTERNODES || hpMasternodeArray.length == 0) {
41+
private static String[] mergeArrays(String[] masternodeArray, String[] hpMasternodeArray, boolean forceMerge) {
42+
if (!forceMerge && (masternodeArray.length > ENOUGH_MASTERNODES || hpMasternodeArray.length == 0)) {
4343
return masternodeArray;
4444
} else {
4545
String[] result = Arrays.copyOf(masternodeArray, masternodeArray.length + hpMasternodeArray.length);
@@ -53,7 +53,17 @@ private static String[] mergeArrays(String[] masternodeArray, String[] hpMastern
5353
* @param params Network parameters to be used for port information.
5454
*/
5555
public MasternodeSeedPeers(NetworkParameters params) {
56-
this(mergeArrays(params.getDefaultMasternodeList(), params.getDefaultHPMasternodeList()), params);
56+
this(mergeArrays(params.getDefaultMasternodeList(), params.getDefaultHPMasternodeList(), false), params);
57+
}
58+
59+
/**
60+
* Supports finding peers by IP addresses
61+
*
62+
* @param params Network parameters to be used for port information.
63+
* @param forceMerge forces merging of all masternode lists
64+
*/
65+
public MasternodeSeedPeers(NetworkParameters params, boolean forceMerge) {
66+
this(mergeArrays(params.getDefaultMasternodeList(), params.getDefaultHPMasternodeList(), forceMerge), params);
5767
}
5868

5969
/**

core/src/main/java/org/bitcoinj/params/TestNet3Params.java

Lines changed: 82 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -177,122 +177,91 @@ public String getPaymentProtocolId() {
177177
}
178178

179179
public static String[] MASTERNODES = {
180-
"54.213.94.216",
181-
"35.165.156.159",
182-
"35.90.157.206",
183-
"35.91.197.218",
184-
"54.212.91.148",
185-
"54.202.231.195",
186-
"35.88.122.202",
187-
"54.186.145.18",
188-
"35.90.193.169",
189-
"34.212.161.186",
190-
"34.220.155.3",
191-
"54.212.138.75",
192-
"54.188.69.89",
193-
"54.190.131.8",
194-
"34.220.194.253",
195-
"54.191.28.44",
196-
"35.87.238.118",
197-
"35.90.217.208",
198-
"34.220.243.24",
199-
"35.161.222.74",
200-
"54.190.61.70",
201-
"34.210.26.195",
202-
"34.217.191.164",
203-
"54.189.125.235",
204-
"34.220.175.29",
205-
"52.36.20.123",
206-
"54.185.69.133",
207-
"54.68.48.149",
208-
"34.210.84.163",
209-
"54.202.190.181",
210-
"35.91.239.75",
211-
"34.222.21.14",
212-
"34.220.134.30",
213-
"35.90.252.3",
214-
"35.89.166.118",
215-
"18.237.170.32",
216-
"35.162.18.116",
217-
"35.91.208.56",
218-
"34.219.33.231",
219-
"52.34.250.214",
220-
"35.91.134.89",
221-
"50.112.58.114",
222-
"54.191.146.137",
223-
"34.218.66.37",
224-
"34.221.196.103",
225-
"35.91.157.30",
226-
"34.221.102.51",
227-
"18.237.165.242",
228-
"52.37.61.9",
229-
"54.212.89.127",
230-
"34.209.238.228",
231-
"35.92.143.7",
232-
"35.89.113.195",
233-
"52.12.54.89",
234-
"34.219.153.30",
235-
"34.215.171.237",
236-
"54.70.243.3",
237-
"54.184.126.25",
238-
"34.222.85.18",
239-
"34.221.252.179",
240-
"35.85.33.152",
241-
"54.200.220.105",
242-
"54.245.75.47",
243-
"54.214.59.174",
244-
"35.164.77.177",
245-
"35.89.66.84",
246-
"35.91.150.34",
247-
"35.92.219.124",
248-
"34.222.82.127",
249-
"34.220.171.156",
250-
"35.90.42.64",
251-
"35.89.53.128",
252-
"35.93.151.188",
253-
"34.211.172.212",
254-
"34.220.118.79",
255-
"34.220.187.233",
256-
"34.220.85.81",
257-
"35.167.165.224",
258-
"34.210.26.93",
259-
"35.90.53.180",
180+
"68.67.122.30",
181+
"68.67.122.31",
182+
"68.67.122.32",
183+
"68.67.122.33",
184+
"68.67.122.34",
185+
"68.67.122.35",
186+
"68.67.122.36",
187+
"68.67.122.37",
188+
"68.67.122.38",
189+
"68.67.122.39",
190+
"68.67.122.40",
191+
"68.67.122.41",
192+
"68.67.122.42",
193+
"68.67.122.43",
194+
"68.67.122.44",
195+
"68.67.122.45",
196+
"68.67.122.46",
197+
"68.67.122.47",
198+
"68.67.122.48",
199+
"68.67.122.49",
200+
"68.67.122.50",
201+
"68.67.122.51",
202+
"68.67.122.52",
203+
"68.67.122.53",
204+
"68.67.122.54",
205+
"68.67.122.55",
206+
"68.67.122.56",
207+
"68.67.122.57",
208+
"68.67.122.58",
209+
"68.67.122.59",
210+
"68.67.122.60",
211+
"68.67.122.61",
212+
"68.67.122.62",
213+
"68.67.122.63",
214+
"68.67.122.64",
215+
"68.67.122.65",
216+
"68.67.122.66",
217+
"68.67.122.67",
218+
"68.67.122.68",
219+
"68.67.122.69",
220+
"68.67.122.70",
221+
"68.67.122.71",
222+
"68.67.122.72",
223+
"68.67.122.73",
224+
"68.67.122.74",
225+
"68.67.122.75",
226+
"68.67.122.76",
227+
"68.67.122.77",
228+
"68.67.122.78",
229+
"68.67.122.79",
230+
"68.67.122.80",
231+
"68.67.122.81",
232+
"68.67.122.82"
260233
};
261234

262235
public String [] HP_MASTERNODES = {
263-
"34.214.48.68",
264-
"35.166.18.166",
265-
"35.165.50.126",
266-
"52.42.202.128",
267-
"52.12.176.90",
268-
"44.233.44.95",
269-
"35.167.145.149",
270-
"52.34.144.50",
271-
"44.240.98.102",
272-
"54.201.32.131",
273-
"52.10.229.11",
274-
"52.13.132.146",
275-
"44.228.242.181",
276-
"35.82.197.197",
277-
"52.40.219.41",
278-
"44.239.39.153",
279-
"54.149.33.167",
280-
"35.164.23.245",
281-
"52.33.28.47",
282-
"52.43.86.231",
283-
"52.43.13.92",
284-
"35.163.144.230",
285-
"52.89.154.48",
286-
"52.24.124.162",
287-
"44.227.137.77",
288-
"35.85.21.179",
289-
"54.187.14.232",
290-
"54.68.235.201",
291-
"52.13.250.182",
292-
"35.82.49.196",
293-
"44.232.196.6",
294-
"54.189.164.39",
295-
"54.213.204.85",
236+
"68.67.122.1",
237+
"68.67.122.2",
238+
"68.67.122.3",
239+
"68.67.122.4",
240+
"68.67.122.5",
241+
"68.67.122.6",
242+
"68.67.122.7",
243+
"68.67.122.8",
244+
"68.67.122.9",
245+
"68.67.122.10",
246+
"68.67.122.11",
247+
"68.67.122.12",
248+
"68.67.122.13",
249+
"68.67.122.14",
250+
"68.67.122.15",
251+
"68.67.122.16",
252+
"68.67.122.17",
253+
"68.67.122.18",
254+
"68.67.122.19",
255+
"68.67.122.20",
256+
"68.67.122.21",
257+
"68.67.122.22",
258+
"68.67.122.23",
259+
"68.67.122.24",
260+
"68.67.122.25",
261+
"68.67.122.26",
262+
"68.67.122.27",
263+
"68.67.122.28",
264+
"68.67.122.29"
296265
};
297266

298267
@Override

0 commit comments

Comments
 (0)