Skip to content

Commit

Permalink
Fixed issues in commit f5c8dfe
Browse files Browse the repository at this point in the history
  • Loading branch information
archived-2 committed Aug 2, 2023
1 parent 94d3664 commit 33cfd02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/qortal/controller/BlockMinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ private static void addUnconfirmedTransactions(Repository repository, Block newB
// Sign to create block's signature, needed by Block.isValid()
newBlock.sign();

// User-defined limit per block
int limit = Settings.getInstance().getMaxTransactionsPerBlock();

// Attempt to add transactions until block is full, or we run out
// If a transaction makes the block invalid then skip it and it'll either expire or be in next block.
for (TransactionData transactionData : unconfirmedTransactions) {
Expand All @@ -496,6 +499,12 @@ private static void addUnconfirmedTransactions(Repository repository, Block newB
LOGGER.debug(() -> String.format("Skipping invalid transaction %s during block minting", Base58.encode(transactionData.getSignature())));
newBlock.deleteTransaction(transactionData);
}

// User-defined limit per block
List<Transaction> transactions = newBlock.getTransactions();
if (transactions != null && transactions.size() >= limit) {
break;
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/qortal/transaction/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ public static List<TransactionData> getUnconfirmedTransactions(Repository reposi
BlockData latestBlockData = repository.getBlockRepository().getLastBlock();

EnumSet<TransactionType> excludedTxTypes = EnumSet.of(TransactionType.CHAT, TransactionType.PRESENCE);
int limit = Settings.getInstance().getMaxTransactionsPerBlock();
List<TransactionData> unconfirmedTransactions = repository.getTransactionRepository().getUnconfirmedTransactions(excludedTxTypes, limit);
List<TransactionData> unconfirmedTransactions = repository.getTransactionRepository().getUnconfirmedTransactions(excludedTxTypes, null);

unconfirmedTransactions.sort(getDataComparator());

Expand Down

0 comments on commit 33cfd02

Please sign in to comment.