Skip to content

Commit

Permalink
Merge branch 'dev' of github.com-qoire:aionnetwork/aion into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
qoire committed Apr 5, 2018
2 parents 48e70b8 + 9ca06f7 commit 5fef797
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,13 @@ public synchronized List<AionTransaction> addPendingTransactions(List<AionTransa
Map<BigInteger,AionTransaction> cache = pendingTxCache.geCacheTx(tx.getFrom());

int limit = 0;
if (!pendingTxCache.getCacheTxAccount().isEmpty()) {
limit = pendingTxCache.getTxRtnLimit() / pendingTxCache.getCacheTxAccount().size();
Set<Address> addr = pendingTxCache.getCacheTxAccount();
if (!addr.isEmpty()) {
limit = pendingTxCache.getTxRtnLimit() / addr.size();

if (limit == 0) {
limit = 1;
}
}

if (LOG.isTraceEnabled()) {
Expand Down
12 changes: 10 additions & 2 deletions modAionImpl/src/org/aion/zero/impl/blockchain/PendingTxCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,16 @@ public boolean isInCache(Address addr , BigInteger nonce) {
return false;
}

Set<Address> getCacheTxAccount() {
return new HashSet<>(this.cacheTxMap.keySet());
Set<Address> getCacheTxAccount()
{
Set<Address> acc = new HashSet<>();
for (Map.Entry<Address, TreeMap<BigInteger,AionTransaction>> e : this.cacheTxMap.entrySet()) {
if (!e.getValue().isEmpty()) {
acc.add(e.getKey());
}
}

return acc;
}

Map<BigInteger,AionTransaction> geCacheTx(Address from) {
Expand Down

0 comments on commit 5fef797

Please sign in to comment.