From 747b1a4f9de3e3c126fde60082b00f10de817d3e Mon Sep 17 00:00:00 2001 From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:28:27 +0100 Subject: [PATCH] Update dependencies --- pom.xml | 8 ++++---- .../org/qortal/account/SelfSponsorshipAlgoV1.java | 15 +++++++++++---- src/main/java/org/qortal/block/Block.java | 9 +++++---- .../qortal/block/SelfSponsorshipAlgoV1Block.java | 3 +-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 4f2304bd..42177e54 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.2.2 0.12.3 4.9.10 - 1.60.1 + 1.61.0 33.0.0-jre 2.2 1.2.1 @@ -34,16 +34,16 @@ 9.4.53.v20231009 1.1.1 20231013 - 1.17.1 + 1.17.2 5.10.0 1.0.0 - 2.22.0 + 2.22.1 1.5.0-b01 3.12.1 3.3.0 3.3.1 3.5.1 - 3.2.3 + 3.2.5 1.1.0 UTF-8 3.25.1 diff --git a/src/main/java/org/qortal/account/SelfSponsorshipAlgoV1.java b/src/main/java/org/qortal/account/SelfSponsorshipAlgoV1.java index 725e53f5..2ed57f34 100644 --- a/src/main/java/org/qortal/account/SelfSponsorshipAlgoV1.java +++ b/src/main/java/org/qortal/account/SelfSponsorshipAlgoV1.java @@ -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 sponsorshipRewardShares = new ArrayList<>(); private final Map> paymentsByAddress = new HashMap<>(); @@ -33,6 +35,7 @@ public class SelfSponsorshipAlgoV1 { private Set consolidatedAddresses = new LinkedHashSet<>(); private final Set zeroTransactionAddreses = new LinkedHashSet<>(); private final Set penaltyAddresses = new LinkedHashSet<>(); + private final Set 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; } - -} +} \ No newline at end of file diff --git a/src/main/java/org/qortal/block/Block.java b/src/main/java/org/qortal/block/Block.java index af99e34e..475de70a 100644 --- a/src/main/java/org/qortal/block/Block.java +++ b/src/main/java/org/qortal/block/Block.java @@ -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())); } } - -} +} \ No newline at end of file diff --git a/src/main/java/org/qortal/block/SelfSponsorshipAlgoV1Block.java b/src/main/java/org/qortal/block/SelfSponsorshipAlgoV1Block.java index c3c374d1..cea97593 100644 --- a/src/main/java/org/qortal/block/SelfSponsorshipAlgoV1Block.java +++ b/src/main/java/org/qortal/block/SelfSponsorshipAlgoV1Block.java @@ -64,7 +64,7 @@ public final class SelfSponsorshipAlgoV1Block { } public static Set getAccountPenalties(Repository repository, int penalty) throws DataException { - final long snapshotTimestamp = BlockChain.getInstance().getSelfSponsorshipAlgoV1SnapshotTimestamp(); + final long snapshotTimestamp = System.currentTimeMillis() - 10000; Set penalties = new LinkedHashSet<>(); List 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))); } - }