Merge branch 'master' into fix-unit-tests

This commit is contained in:
QuickMythril 2024-01-21 08:36:41 -05:00 committed by GitHub
commit 9c62740f44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 24 additions and 23 deletions

10
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.qortal</groupId>
<artifactId>qortal</artifactId>
<version>4.4.1</version>
<version>4.4.2</version>
<packaging>jar</packaging>
<properties>
<skipTests>true</skipTests>
@ -21,7 +21,7 @@
<dagger.version>1.2.2</dagger.version>
<extendedset.version>0.12.3</extendedset.version>
<git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version>
<grpc.version>1.60.1</grpc.version>
<grpc.version>1.61.0</grpc.version>
<guava.version>33.0.0-jre</guava.version>
<hamcrest-library.version>2.2</hamcrest-library.version>
<homoglyph.version>1.2.1</homoglyph.version>
@ -34,16 +34,16 @@
<jetty.version>9.4.53.v20231009</jetty.version>
<json-simple.version>1.1.1</json-simple.version>
<json.version>20231013</json.version>
<jsoup.version>1.17.1</jsoup.version>
<jsoup.version>1.17.2</jsoup.version>
<junit-jupiter-engine.version>5.10.0</junit-jupiter-engine.version>
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
<log4j.version>2.22.0</log4j.version>
<log4j.version>2.22.1</log4j.version>
<mail.version>1.5.0-b01</mail.version>
<maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-shade-plugin.version>3.5.1</maven-shade-plugin.version>
<maven-surefire-plugin.version>3.2.3</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<package-info-maven-plugin.version>1.1.0</package-info-maven-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<protobuf.version>3.25.1</protobuf.version>

View File

@ -2,6 +2,7 @@ package org.qortal.account;
import org.qortal.api.resource.TransactionsResource;
import org.qortal.asset.Asset;
import org.qortal.block.BlockChain;
import org.qortal.data.account.AccountData;
import org.qortal.data.naming.NameData;
import org.qortal.data.transaction.*;
@ -26,6 +27,7 @@ public class SelfSponsorshipAlgoV1 {
private int consolidationCount = 0;
private int bulkIssuanceCount = 0;
private int recentSponsorshipCount = 0;
private int transferAssetsCount = 0;
private List<RewardShareTransactionData> sponsorshipRewardShares = new ArrayList<>();
private final Map<String, List<TransactionData>> paymentsByAddress = new HashMap<>();
@ -33,6 +35,7 @@ public class SelfSponsorshipAlgoV1 {
private Set<String> consolidatedAddresses = new LinkedHashSet<>();
private final Set<String> zeroTransactionAddreses = new LinkedHashSet<>();
private final Set<String> penaltyAddresses = new LinkedHashSet<>();
private final Set<String> transferAssetsByAddress = new LinkedHashSet<>();
public SelfSponsorshipAlgoV1(Repository repository, String address, long snapshotTimestamp, boolean override) throws DataException {
this.repository = repository;
@ -67,6 +70,7 @@ public class SelfSponsorshipAlgoV1 {
this.findBulkIssuance();
this.findRegisteredNameCount();
this.findRecentSponsorshipCount();
this.transferAssetsCount = this.transferAssetsByAddress.size();
int score = this.calculateScore();
if (score <= 0 && !override) {
@ -221,7 +225,9 @@ public class SelfSponsorshipAlgoV1 {
}
private void findRecentSponsorshipCount() {
final long referenceTimestamp = this.snapshotTimestamp - (365 * 24 * 60 * 60 * 1000L);
long snapshotTimestampBefore = BlockChain.getInstance().getSelfSponsorshipAlgoV1SnapshotTimestamp();
long diffTimeBetween = this.snapshotTimestamp - snapshotTimestampBefore;
final long referenceTimestamp = this.snapshotTimestamp - diffTimeBetween;
int recentSponsorshipCount = 0;
for (RewardShareTransactionData rewardShare : sponsorshipRewardShares) {
if (rewardShare.getTimestamp() >= referenceTimestamp) {
@ -232,12 +238,13 @@ public class SelfSponsorshipAlgoV1 {
}
private int calculateScore() {
final int transferAssetsMultiplier = (this.transferAssetsCount >= 5) ? 10 : 1;
final int suspiciousMultiplier = (this.suspiciousCount >= 100) ? this.suspiciousPercent : 1;
final int nameMultiplier = (this.sponsees.size() >= 50 && this.registeredNameCount == 0) ? 2 : 1;
final int consolidationMultiplier = Math.max(this.consolidationCount, 1);
final int bulkIssuanceMultiplier = Math.max(this.bulkIssuanceCount / 2, 1);
final int offset = 9;
return suspiciousMultiplier * nameMultiplier * consolidationMultiplier * bulkIssuanceMultiplier - offset;
return transferAssetsMultiplier * suspiciousMultiplier * nameMultiplier * consolidationMultiplier * bulkIssuanceMultiplier - offset;
}
private void fetchSponsorshipRewardShares() throws DataException {
@ -322,6 +329,7 @@ public class SelfSponsorshipAlgoV1 {
if (!Objects.equals(transferAssetTransactionData.getRecipient(), address)) {
// Outgoing payment from this account
outgoingPaymentRecipients.add(transferAssetTransactionData.getRecipient());
this.transferAssetsByAddress.add(transferAssetTransactionData.getRecipient());
}
}
break;
@ -363,5 +371,4 @@ public class SelfSponsorshipAlgoV1 {
return transactionDataList;
}
}
}

View File

@ -1548,12 +1548,14 @@ public class Block {
processBlockRewards();
}
if (this.blockData.getHeight() == 212937)
if (this.blockData.getHeight() == 212937) {
// Apply fix for block 212937
Block212937.processFix(this);
}
else if (this.blockData.getHeight() == BlockChain.getInstance().getSelfSponsorshipAlgoV1Height())
if (this.blockData.getHeight() == BlockChain.getInstance().getUnconfirmableRewardSharesHeight()) {
SelfSponsorshipAlgoV1Block.processAccountPenalties(this);
}
}
// We're about to (test-)process a batch of transactions,
@ -2542,5 +2544,4 @@ public class Block {
LOGGER.info(() -> String.format("Unable to log block debugging info: %s", e.getMessage()));
}
}
}
}

View File

@ -64,7 +64,7 @@ public final class SelfSponsorshipAlgoV1Block {
}
public static Set<AccountPenaltyData> getAccountPenalties(Repository repository, int penalty) throws DataException {
final long snapshotTimestamp = BlockChain.getInstance().getSelfSponsorshipAlgoV1SnapshotTimestamp();
final long snapshotTimestamp = System.currentTimeMillis() - 10000;
Set<AccountPenaltyData> penalties = new LinkedHashSet<>();
List<String> addresses = repository.getTransactionRepository().getConfirmedRewardShareCreatorsExcludingSelfShares();
for (String address : addresses) {
@ -132,5 +132,4 @@ public final class SelfSponsorshipAlgoV1Block {
Collections.sort(penaltyAddresses);
return Base58.encode(Crypto.digest(StringUtils.join(penaltyAddresses).getBytes(StandardCharsets.UTF_8)));
}
}

View File

@ -52,7 +52,6 @@ public class Litecoin extends Bitcoiny {
new Server("electrum1.cipig.net", Server.ConnectionType.SSL, 20063),
new Server("electrum2.cipig.net", Server.ConnectionType.SSL, 20063),
new Server("electrum3.cipig.net", Server.ConnectionType.SSL, 20063),
new Server("electrum4-ltc.qortal.online", Server.ConnectionType.SSL, 20002),
new Server("ltc.rentonrisk.com", Server.ConnectionType.SSL, 50002)
);
}

View File

@ -51,10 +51,6 @@ public class PirateChain extends Bitcoiny {
public Collection<Server> getServers() {
return Arrays.asList(
// Servers chosen on NO BASIS WHATSOEVER from various sources!
new Server("wallet-arrr2.qortal.online", Server.ConnectionType.SSL, 443),
new Server("wallet-arrr3.qortal.online", Server.ConnectionType.SSL, 443),
new Server("wallet-arrr4.qortal.online", Server.ConnectionType.SSL, 443),
new Server("wallet-arrr5.qortal.online", Server.ConnectionType.SSL, 443),
new Server("lightd.pirate.black", Server.ConnectionType.SSL, 443)
);
}

View File

@ -272,8 +272,7 @@ public class Settings {
private String[] bootstrapHosts = new String[] {
"http://bootstrap.qortal.org",
"http://bootstrap2.qortal.org",
"http://bootstrap3.qortal.org",
"http://bootstrap.qortal.online"
"http://bootstrap3.qortal.org"
};
// Auto-update sources

View File

@ -96,7 +96,7 @@
"feeValidationFixTimestamp": 1671918000000,
"chatReferenceTimestamp": 1674316800000,
"arbitraryOptionalFeeTimestamp": 1680278400000,
"unconfirmableRewardSharesHeight": 99999500
"unconfirmableRewardSharesHeight": 1575500
},
"checkpoints": [
{ "height": 1136300, "signature": "3BbwawEF2uN8Ni5ofpJXkukoU8ctAPxYoFB7whq9pKfBnjfZcpfEJT4R95NvBDoTP8WDyWvsUvbfHbcr9qSZuYpSKZjUQTvdFf6eqznHGEwhZApWfvXu6zjGCxYCp65F4jsVYYJjkzbjmkCg5WAwN5voudngA23kMK6PpTNygapCzXt" }