Skip to content

Commit 3ab8b1e

Browse files
Merge branch 'master' of https://github.com/dashevo/dashj into feature-coinjoin
2 parents ae0987a + ef7d3cc commit 3ab8b1e

File tree

7 files changed

+39
-11
lines changed

7 files changed

+39
-11
lines changed

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'maven-publish'
55
apply plugin: 'jacoco'
66
apply plugin: 'signing'
77

8-
version = '20.0.0-CJ-SNAPSHOT'
8+
version = '20.0.1-CJ-SNAPSHOT'
99
archivesBaseName = 'dashj-core'
1010
eclipse.project.name = 'dashj-core'
1111

core/src/main/java/org/bitcoinj/core/Block.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ public static Coin getBlockInflation(NetworkParameters params, int height, long
269269
}
270270

271271
// Hard fork to reduce the block reward by 10 extra percent (allowing budget/superblocks)
272-
Coin nSuperblockPart = (nPrevHeight > params.getBudgetPaymentsStartBlock()) ? nSubsidy.div(10) : Coin.ZERO;
272+
int treasuryPart = params.isV20Active(nPrevHeight) ? 20 : 10; // parts per 100, 20 is 20%
273+
Coin nSuperblockPart = (nPrevHeight > params.getBudgetPaymentsStartBlock()) ? nSubsidy.multiply(treasuryPart).div(100) : Coin.ZERO;
273274

274275
return fSuperblockPartOnly ? nSuperblockPart : nSubsidy.minus(nSuperblockPart);
275276
}

core/src/main/java/org/bitcoinj/core/VersionMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
public class VersionMessage extends Message {
4545

4646
/** The version of this library release, as a string. */
47-
public static final String BITCOINJ_VERSION = "20.0.0-CJ-SNAPSHOT";
47+
public static final String BITCOINJ_VERSION = "20.0.1-CJ-SNAPSHOT";
4848
/** The value that is prepended to the subVer field of this application. */
4949
public static final String LIBRARY_SUBVER = "/DashJ:" + BITCOINJ_VERSION + "/";
5050

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,10 @@ Sha256Hash getHashModifier(LLMQParameters llmqParams, StoredBlock quorumBaseBloc
857857
}
858858
return LLMQUtils.buildLLMQBlockHash(llmqParams.getType(), quorumBaseBlock.getHeader().getHash());
859859
}
860+
861+
public void close() {
862+
// reset the state of any sync operation
863+
initChainTipSyncComplete = false;
864+
waitingForMNListDiff = false;
865+
}
860866
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,22 @@ public Sha256Hash getConfirmedHashWithProRegTxHash() {
206206
return confirmedHashWithProRegTxHash;
207207
}
208208

209+
public int getType() {
210+
return type;
211+
}
212+
213+
public boolean isHPMN() {
214+
return type == MasternodeType.HIGHPERFORMANCE.index;
215+
}
216+
217+
public int getPlatformHTTPPort() {
218+
return platformHTTPPort;
219+
}
220+
221+
public KeyId getPlatformNodeId() {
222+
return platformNodeId;
223+
}
224+
209225
void updateConfirmedHashWithProRegTxHash() {
210226
try {
211227
UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(64);

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ public void close() {
411411
quorumState.removeEventListeners(blockChain.getBlockChain(), peerGroup);
412412
quorumRotationState.removeEventListeners(blockChain.getBlockChain(), peerGroup);
413413
// reset state of chain sync
414-
quorumState.initChainTipSyncComplete = false;
415-
quorumRotationState.initChainTipSyncComplete = false;
414+
quorumState.close();
415+
quorumRotationState.close();
416416

417417
try {
418418
threadPool.shutdown();
@@ -450,12 +450,14 @@ public boolean isQuorumRotationEnabled(LLMQParameters.LLMQType type) {
450450
return params.getLlmqDIP0024InstantSend() == type && quorumRotationActive;
451451
}
452452

453-
// TODO: this needs an argument for LLMQType
454453
public SimplifiedMasternodeList getListAtChainTip() {
455-
return getMasternodeList();
454+
if (quorumState.getMasternodeListAtTip() != null) {
455+
return quorumState.getMasternodeListAtTip();
456+
} else {
457+
return quorumRotationState.getMnListAtH();
458+
}
456459
}
457460

458-
// TODO: this needs an argument for LLMQType
459461
public SimplifiedQuorumList getQuorumListAtTip(LLMQParameters.LLMQType llmqType) {
460462
if (!isQuorumRotationEnabled(llmqType)) {
461463
return quorumState.quorumList;

core/src/test/java/org/bitcoinj/evolution/SimplifiedMasternodeListEntryTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ public void readBytesV1Test() {
3838
byte[] smle = Utils.HEX.decode("318c32ec1598fa8f38dc76e28d15c00c20553c7020161a4c64742524a18465c39b2d789571a3b223a5365fbde69b3fe7143c4f9ebc6293afb84d340f0000000000000000000000000000ffff23a3e2204e1f08b4c1a8b9c1402ea84afe7c47f7e98d657df873b9747a0e4a497120ec62c81f314ad91a6f3384648e7e60f2734554f7f4c0fe75eec22907d6b043edb0df74ccc7b85a4500");
3939
SimplifiedMasternodeListEntry entry = new SimplifiedMasternodeListEntry(UNITTEST, smle, 0, NetworkParameters.ProtocolVersion.BLS_LEGACY.getBitcoinProtocolVersion());
4040
assertEquals(1, entry.version);
41-
assertEquals(0, entry.type);
41+
assertEquals(0, entry.getType());
4242
assertEquals("c36584a1242574644c1a1620703c55200cc0158de276dc388ffa9815ec328c31", entry.proRegTxHash.toString());
4343
assertEquals("000000000f344db8af9362bc9e4f3c14e73f9be6bd5f36a523b2a37195782d9b", entry.confirmedHash.toString());
4444
assertEquals(new MasternodeAddress("35.163.226.32", 19999), entry.service);
4545
assertEquals("yidavU3B2BUNzaUv3gW6nmV4ojLNwPeazt", Address.fromPubKeyHash(UNITTEST, entry.keyIdVoting.getBytes()).toString());
4646
assertEquals(new BLSLazyPublicKey(UNITTEST, Utils.HEX.decode("08b4c1a8b9c1402ea84afe7c47f7e98d657df873b9747a0e4a497120ec62c81f314ad91a6f3384648e7e60f2734554f7"), 0, false), entry.pubKeyOperator);
4747
assertFalse(entry.isValid); // this masternode is not valid
48+
assertFalse(entry.isHPMN());
4849
assertEquals(Sha256Hash.wrap("a7fc065ab65f453c4b57c597467f4d126188d5807f08cfab6b1f6d52e30e067e"), entry.getHash());
4950
}
5051

@@ -53,13 +54,15 @@ public void readBytesV2Test() {
5354
byte[] smle = Utils.HEX.decode("0200e7aef4f585df3def44b855219ae93d6e8cc49a8c96658c5cc0813c48f5384c33e2999069d702d61d852a74b1e07d6f58101e0352d84043e866ff7946bdf5987f00000000000000000000ffff7f0000012f3197fe8172fd3207d71125a053ff32266e11110c06c1184d5be0a8118d0131d6119b138ec4d0398e7eacc5e16a75f718ed796c3a4cab668936c1f6d0945a7b97d7c0fee7cf0101002caa114755a4648d422a5caa5c915597f8c733b8e146");
5455
SimplifiedMasternodeListEntry entry = new SimplifiedMasternodeListEntry(UNITTEST, smle, 0, NetworkParameters.ProtocolVersion.CURRENT.getBitcoinProtocolVersion());
5556
assertEquals(2, entry.version);
56-
assertEquals(1, entry.type);
57+
assertEquals(1, entry.getType());
5758
assertEquals("334c38f5483c81c05c8c65968c9ac48c6e3de99a2155b844ef3ddf85f5f4aee7", entry.proRegTxHash.toString());
5859
assertEquals("7f98f5bd4679ff66e84340d852031e10586f7de0b1742a851dd602d7699099e2", entry.confirmedHash.toString());
5960
assertEquals(new MasternodeAddress("127.0.0.1", 12081), entry.service);
6061
assertEquals("yXPUGD63qih1Hzgxy7gY9LFKof2KqBf3hU", Address.fromPubKeyHash(UNITTEST, entry.keyIdVoting.getBytes()).toString());
6162
assertEquals(new BLSLazyPublicKey(UNITTEST, Utils.HEX.decode("97fe8172fd3207d71125a053ff32266e11110c06c1184d5be0a8118d0131d6119b138ec4d0398e7eacc5e16a75f718ed"), 0, false), entry.pubKeyOperator);
62-
assertEquals(KeyId.fromString("46e1b833c7f89755915caa5c2a428d64a4554711"), entry.platformNodeId);
63+
assertEquals(KeyId.fromString("46e1b833c7f89755915caa5c2a428d64a4554711"), entry.getPlatformNodeId());
64+
assertEquals(43564, entry.getPlatformHTTPPort());
65+
assertTrue(entry.isHPMN());
6366
assertTrue(entry.isValid);
6467
}
6568
}

0 commit comments

Comments
 (0)