Skip to content

Commit

Permalink
Fix issue 5824 - Duplicate key errors in EthScheduler-Transactions (h…
Browse files Browse the repository at this point in the history
…yperledger#5857)

Fix issue 5824 - Duplicate key errors in EthScheduler-Transactions

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
  • Loading branch information
ahamlat authored Sep 11, 2023
1 parent 25c2065 commit 7fd7224
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- Layered transaction pool implementation is now stable and enabled by default. If you want still to use the legacy implementation, use `--tx-pool=legacy` [#5772](https://github.com/hyperledger/besu)

### Bug Fixes
- do not create ignorable storage on revert storage-variables subcommand [#5830](https://github.com/hyperledger/besu/pull/5830)
- fix duplicate key errors in EthScheduler-Transactions [#5857](https://github.com/hyperledger/besu/pull/5857)
- do not create ignorable storage on revert storage-variables subcommand [#5830](https://github.com/hyperledger/besu/pull/5830)

### Download Links
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ public Map<Hash, ValidationResult<TransactionInvalidReason>> addRemoteTransactio
addedTransactions.add(transaction);
}
return result;
}));
},
(transaction1, transaction2) -> transaction1));

LOG_FOR_REPLAY
.atTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.mockito.Mockito.when;

import org.hyperledger.besu.config.StubGenesisConfigOptions;
Expand Down Expand Up @@ -54,6 +55,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

@SuppressWarnings("unchecked")
public class TransactionPoolLondonTest extends AbstractTransactionPoolTest {

private static final Wei BASE_FEE_FLOOR = Wei.of(7L);
Expand Down Expand Up @@ -253,6 +255,25 @@ public void shouldAcceptLocal1559TxsWhenMaxFeePerGasIsAtLeastEqualToMinMinGasPri
.isEqualTo(1);
}

@Test
public void addRemoteTransactionsShouldAllowDuplicates() {
final Transaction transaction1 = createTransaction(1, Wei.of(7L));
final Transaction transaction2 = createTransaction(2, Wei.of(7L));
final Transaction transaction3 = createTransaction(2, Wei.of(7L));
final Transaction transaction4 = createTransaction(3, Wei.of(7L));

givenTransactionIsValid(transaction1);
givenTransactionIsValid(transaction2);
givenTransactionIsValid(transaction3);
givenTransactionIsValid(transaction4);

assertThatCode(
() ->
transactionPool.addRemoteTransactions(
List.of(transaction1, transaction2, transaction3, transaction4)))
.doesNotThrowAnyException();
}

private int add1559TxAndGetPendingTxsCount(
final Wei genesisBaseFee,
final Wei minGasPrice,
Expand Down

0 comments on commit 7fd7224

Please sign in to comment.