Browse Source

When validating online accounts, enforce mempow if the online account's timestamp is after the feature trigger.

BLOCK_SUMMARIES_V2
CalDescent 2 years ago
parent
commit
ea4f4d949b
  1. 8
      src/main/java/org/qortal/controller/OnlineAccountsManager.java

8
src/main/java/org/qortal/controller/OnlineAccountsManager.java

@ -325,8 +325,9 @@ public class OnlineAccountsManager {
return false;
}
// Validate mempow if feature trigger is active
if (now >= BlockChain.getInstance().getOnlineAccountsMemoryPoWTimestamp()) {
// Validate mempow if feature trigger is active (or if online account's timestamp is past the trigger timestamp)
long memoryPoWStartTimestamp = BlockChain.getInstance().getOnlineAccountsMemoryPoWTimestamp();
if (now >= memoryPoWStartTimestamp || onlineAccountTimestamp >= memoryPoWStartTimestamp) {
if (!getInstance().verifyMemoryPoW(onlineAccountData, now)) {
LOGGER.trace(() -> String.format("Rejecting online reward-share for account %s due to invalid PoW nonce", mintingAccount.getAddress()));
return false;
@ -628,7 +629,8 @@ public class OnlineAccountsManager {
}
public boolean verifyMemoryPoW(OnlineAccountData onlineAccountData, Long timestamp) {
if (!isMemoryPoWActive(timestamp)) {
long memoryPoWStartTimestamp = BlockChain.getInstance().getOnlineAccountsMemoryPoWTimestamp();
if (timestamp < memoryPoWStartTimestamp && onlineAccountData.getTimestamp() < memoryPoWStartTimestamp) {
// Not active yet, so treat it as valid
return true;
}

Loading…
Cancel
Save