forked from Qortal/qortal
Reordered code in Block.mint() to fix potential issue after mempow activates.
This commit is contained in:
parent
b99b1f5d57
commit
84d42b93e1
@ -368,16 +368,17 @@ public class Block {
|
|||||||
|
|
||||||
// Fetch our list of online accounts
|
// Fetch our list of online accounts
|
||||||
List<OnlineAccountData> onlineAccounts = OnlineAccountsManager.getInstance().getOnlineAccounts(onlineAccountsTimestamp);
|
List<OnlineAccountData> onlineAccounts = OnlineAccountsManager.getInstance().getOnlineAccounts(onlineAccountsTimestamp);
|
||||||
if (onlineAccounts.isEmpty()) {
|
|
||||||
LOGGER.error("No online accounts - not even our own?");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If mempow is active, remove any legacy accounts that are missing a nonce
|
// If mempow is active, remove any legacy accounts that are missing a nonce
|
||||||
if (timestamp >= BlockChain.getInstance().getOnlineAccountsMemoryPoWTimestamp()) {
|
if (timestamp >= BlockChain.getInstance().getOnlineAccountsMemoryPoWTimestamp()) {
|
||||||
onlineAccounts.removeIf(a -> a.getNonce() == null || a.getNonce() < 0);
|
onlineAccounts.removeIf(a -> a.getNonce() == null || a.getNonce() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (onlineAccounts.isEmpty()) {
|
||||||
|
LOGGER.error("No online accounts - not even our own?");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Load sorted list of reward share public keys into memory, so that the indexes can be obtained.
|
// Load sorted list of reward share public keys into memory, so that the indexes can be obtained.
|
||||||
// This is up to 100x faster than querying each index separately. For 4150 reward share keys, it
|
// This is up to 100x faster than querying each index separately. For 4150 reward share keys, it
|
||||||
// was taking around 5000ms to query individually, vs 50ms using this approach.
|
// was taking around 5000ms to query individually, vs 50ms using this approach.
|
||||||
|
Loading…
Reference in New Issue
Block a user