@ -307,7 +307,7 @@ public class TransactionPoolTest {
. gasPrice ( Wei . of ( 1 ) )
. createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( eq ( transaction ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( eq ( transaction ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( ValidationResult . valid ( ) ) ;
final ValidationResult < TransactionInvalidReason > result =
@ -319,7 +319,7 @@ public class TransactionPoolTest {
@Test
public void shouldNotAddRemoteTransactionsThatAreInvalidAccordingToInvariantChecks ( ) {
givenTransactionIsValid ( transaction2 ) ;
when ( transactionValidator . validate ( eq ( transaction1 ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( eq ( transaction1 ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( ValidationResult . invalid ( NONCE_TOO_LOW ) ) ;
transactionPool . addRemoteTransactions ( asList ( transaction1 , transaction2 ) ) ;
@ -332,7 +332,8 @@ public class TransactionPoolTest {
@Test
public void shouldNotAddRemoteTransactionsThatAreInvalidAccordingToStateDependentChecks ( ) {
givenTransactionIsValid ( transaction2 ) ;
when ( transactionValidator . validate ( eq ( transaction1 ) , any ( Optional . class ) ) ) . thenReturn ( valid ( ) ) ;
when ( transactionValidator . validate ( eq ( transaction1 ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender ( transaction1 , null , true ) )
. thenReturn ( ValidationResult . invalid ( NONCE_TOO_LOW ) ) ;
@ -350,7 +351,7 @@ public class TransactionPoolTest {
final Transaction transaction2 = builder . nonce ( 2 ) . createTransaction ( KEY_PAIR1 ) ;
final Transaction transaction3 = builder . nonce ( 3 ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction1 ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
@ -379,7 +380,7 @@ public class TransactionPoolTest {
final Transaction transaction2 = builder . nonce ( 2 ) . createTransaction ( KEY_PAIR1 ) ;
final Transaction transaction3 = builder . nonce ( 3 ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction1 ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
@ -435,7 +436,7 @@ public class TransactionPoolTest {
final Transaction transaction2 =
builder . nonce ( 1 ) . gasPrice ( Wei . of ( 5 ) ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction1 ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
@ -460,7 +461,7 @@ public class TransactionPoolTest {
final Transaction transaction2 =
builder . nonce ( 1 ) . gasPrice ( Wei . of ( 5 ) ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction1 ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
@ -519,7 +520,7 @@ public class TransactionPoolTest {
when ( peerPendingTransactionTracker . isPeerSupported ( peer , EthProtocol . ETH65 ) ) . thenReturn ( false ) ;
when ( peerPendingTransactionTracker . isPeerSupported ( validPeer , EthProtocol . ETH65 ) )
. thenReturn ( true ) ;
when ( transactionValidator . validate ( any ( ) , any ( Optional . class ) ) ) . thenReturn ( valid ( ) ) ;
when ( transactionValidator . validate ( any ( ) , any ( Optional . class ) , any ( ) ) ) . thenReturn ( valid ( ) ) ;
transactionPool . addTransactionHash ( transaction1 . getHash ( ) ) ;
transactionPool . handleConnect ( peer ) ;
verify ( peerPendingTransactionTracker , never ( ) ) . addToPeerSendQueue ( peer , transaction1 . getHash ( ) ) ;
@ -562,7 +563,7 @@ public class TransactionPoolTest {
final Transaction transaction2 = builder . nonce ( 2 ) . createTransaction ( KEY_PAIR1 ) ;
final Transaction transaction3 = builder . nonce ( 3 ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction1 ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
@ -589,7 +590,7 @@ public class TransactionPoolTest {
final Transaction transaction2 = builder . nonce ( 2 ) . createTransaction ( KEY_PAIR1 ) ;
final Transaction transaction3 = builder . nonce ( 3 ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction1 ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
@ -632,7 +633,7 @@ public class TransactionPoolTest {
final TransactionTestFixture builder = new TransactionTestFixture ( ) ;
final Transaction transactionLocal = builder . nonce ( 1 ) . createTransaction ( KEY_PAIR1 ) ;
final Transaction transactionRemote = builder . nonce ( 2 ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
any ( Transaction . class ) ,
@ -655,7 +656,8 @@ public class TransactionPoolTest {
public void shouldCallValidatorWithExpectedValidationParameters ( ) {
final ArgumentCaptor < TransactionValidationParams > txValidationParamCaptor =
ArgumentCaptor . forClass ( TransactionValidationParams . class ) ;
when ( transactionValidator . validate ( eq ( transaction1 ) , any ( Optional . class ) ) ) . thenReturn ( valid ( ) ) ;
when ( transactionValidator . validate ( eq ( transaction1 ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender ( any ( ) , any ( ) , txValidationParamCaptor . capture ( ) ) )
. thenReturn ( valid ( ) ) ;
@ -689,7 +691,7 @@ public class TransactionPoolTest {
metricsSystem ,
Optional . empty ( ) ,
ImmutableTransactionPoolConfiguration . builder ( ) . txFeeCap ( Wei . ZERO ) . build ( ) ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
any ( Transaction . class ) ,
@ -727,7 +729,7 @@ public class TransactionPoolTest {
metricsSystem ,
Optional . empty ( ) ,
ImmutableTransactionPoolConfiguration . builder ( ) . txFeeCap ( Wei . ONE ) . build ( ) ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
any ( Transaction . class ) ,
@ -770,7 +772,7 @@ public class TransactionPoolTest {
metricsSystem ,
Optional . of ( new EIP1559 ( 100 ) ) ,
ImmutableTransactionPoolConfiguration . builder ( ) . txFeeCap ( Wei . ONE ) . build ( ) ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
any ( Transaction . class ) ,
@ -819,7 +821,7 @@ public class TransactionPoolTest {
final Transaction transactionLocal =
builder . nonce ( 1 ) . gasPrice ( twoEthers . add ( Wei . of ( 1 ) ) ) . createTransaction ( KEY_PAIR1 ) ;
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) ) )
when ( transactionValidator . validate ( any ( Transaction . class ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
any ( Transaction . class ) ,
@ -920,7 +922,8 @@ public class TransactionPoolTest {
}
private void givenTransactionIsValid ( final Transaction transaction ) {
when ( transactionValidator . validate ( eq ( transaction ) , any ( Optional . class ) ) ) . thenReturn ( valid ( ) ) ;
when ( transactionValidator . validate ( eq ( transaction ) , any ( Optional . class ) , any ( ) ) )
. thenReturn ( valid ( ) ) ;
when ( transactionValidator . validateForSender (
eq ( transaction ) , nullable ( Account . class ) , any ( TransactionValidationParams . class ) ) )
. thenReturn ( valid ( ) ) ;