@ -62,9 +62,9 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
private final Wei gasPrice ;
private final Wei gasPrice ;
private final Wei gasPremium ;
private final Wei maxPriorityFeePerGas ;
private final Wei feeCap ;
private final Wei maxFeePerGas ;
private final long gasLimit ;
private final long gasLimit ;
@ -111,8 +111,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
* @param transactionType the transaction type
* @param transactionType the transaction type
* @param nonce the nonce
* @param nonce the nonce
* @param gasPrice the gas price
* @param gasPrice the gas price
* @param gasPremium the gas premium
* @param maxPriorityFeePerGas the max priorty fee per gas
* @param feeCap the fee cap
* @param maxFeePerGas the max fee per gas
* @param gasLimit the gas limit
* @param gasLimit the gas limit
* @param to the transaction recipient
* @param to the transaction recipient
* @param value the value being transferred to the recipient
* @param value the value being transferred to the recipient
@ -134,8 +134,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
final TransactionType transactionType ,
final TransactionType transactionType ,
final long nonce ,
final long nonce ,
final Wei gasPrice ,
final Wei gasPrice ,
final Wei gasPremium ,
final Wei maxPriorityFeePerGas ,
final Wei feeCap ,
final Wei maxFeePerGas ,
final long gasLimit ,
final long gasLimit ,
final Optional < Address > to ,
final Optional < Address > to ,
final Wei value ,
final Wei value ,
@ -164,8 +164,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
this . transactionType = transactionType ;
this . transactionType = transactionType ;
this . nonce = nonce ;
this . nonce = nonce ;
this . gasPrice = gasPrice ;
this . gasPrice = gasPrice ;
this . gasPremium = gasPremium ;
this . maxPriorityFeePerGas = maxPriorityFeePerGas ;
this . feeCap = feeCap ;
this . maxFeePerGas = maxFeePerGas ;
this . gasLimit = gasLimit ;
this . gasLimit = gasLimit ;
this . to = to ;
this . to = to ;
this . value = value ;
this . value = value ;
@ -180,8 +180,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
public Transaction (
public Transaction (
final long nonce ,
final long nonce ,
final Wei gasPrice ,
final Wei gasPrice ,
final Wei gasPremium ,
final Wei maxPriorityFeePerGas ,
final Wei feeCap ,
final Wei maxFeePerGas ,
final long gasLimit ,
final long gasLimit ,
final Optional < Address > to ,
final Optional < Address > to ,
final Wei value ,
final Wei value ,
@ -194,8 +194,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
TransactionType . FRONTIER ,
TransactionType . FRONTIER ,
nonce ,
nonce ,
gasPrice ,
gasPrice ,
gasPremium ,
maxPriorityFeePerGas ,
feeCap ,
maxFeePerGas ,
gasLimit ,
gasLimit ,
to ,
to ,
value ,
value ,
@ -301,23 +301,23 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
}
}
/ * *
/ * *
* Return the transaction gas premium .
* Return the transaction max priority per gas .
*
*
* @return the transaction gas premium
* @return the transaction max priority per gas
* /
* /
@Override
@Override
public Optional < Quantity > getGasPremium ( ) {
public Optional < Quantity > getMaxPriorityFeePerGas ( ) {
return Optional . ofNullable ( gasPremium ) ;
return Optional . ofNullable ( maxPriorityFeePerGas ) ;
}
}
/ * *
/ * *
* Return the transaction fee cap .
* Return the transaction max fee per gas .
*
*
* @return the transaction fee cap
* @return the transaction max fee per gas
* /
* /
@Override
@Override
public Optional < Quantity > getFeeCap ( ) {
public Optional < Quantity > getMaxFeePerGas ( ) {
return Optional . ofNullable ( feeCap ) ;
return Optional . ofNullable ( maxFeePerGas ) ;
}
}
/ * *
/ * *
@ -447,8 +447,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
transactionType ,
transactionType ,
nonce ,
nonce ,
gasPrice ,
gasPrice ,
gasPremium ,
maxPriorityFeePerGas ,
feeCap ,
maxFeePerGas ,
gasLimit ,
gasLimit ,
to ,
to ,
value ,
value ,
@ -573,8 +573,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
final TransactionType transactionType ,
final TransactionType transactionType ,
final long nonce ,
final long nonce ,
final Wei gasPrice ,
final Wei gasPrice ,
final Wei gasPremium ,
final Wei maxPriorityFeePerGas ,
final Wei feeCap ,
final Wei maxFeePerGas ,
final long gasLimit ,
final long gasLimit ,
final Optional < Address > to ,
final Optional < Address > to ,
final Wei value ,
final Wei value ,
@ -589,7 +589,15 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
case EIP1559 :
case EIP1559 :
preimage =
preimage =
eip1559Preimage (
eip1559Preimage (
nonce , gasPremium , feeCap , gasLimit , to , value , payload , chainId , accessList ) ;
nonce ,
maxPriorityFeePerGas ,
maxFeePerGas ,
gasLimit ,
to ,
value ,
payload ,
chainId ,
accessList ) ;
break ;
break ;
case ACCESS_LIST :
case ACCESS_LIST :
preimage =
preimage =
@ -641,8 +649,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
private static Bytes eip1559Preimage (
private static Bytes eip1559Preimage (
final long nonce ,
final long nonce ,
final Wei gasPremium ,
final Wei maxPriorityFeePerGas ,
final Wei feeCap ,
final Wei maxFeePerGas ,
final long gasLimit ,
final long gasLimit ,
final Optional < Address > to ,
final Optional < Address > to ,
final Wei value ,
final Wei value ,
@ -655,8 +663,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
rlpOutput . startList ( ) ;
rlpOutput . startList ( ) ;
rlpOutput . writeBigIntegerScalar ( chainId . orElseThrow ( ) ) ;
rlpOutput . writeBigIntegerScalar ( chainId . orElseThrow ( ) ) ;
rlpOutput . writeLongScalar ( nonce ) ;
rlpOutput . writeLongScalar ( nonce ) ;
rlpOutput . writeUInt256Scalar ( gasPremium ) ;
rlpOutput . writeUInt256Scalar ( maxPriorityFeePerGas ) ;
rlpOutput . writeUInt256Scalar ( feeCap ) ;
rlpOutput . writeUInt256Scalar ( maxFeePerGas ) ;
rlpOutput . writeLongScalar ( gasLimit ) ;
rlpOutput . writeLongScalar ( gasLimit ) ;
rlpOutput . writeBytes ( to . map ( Bytes : : copy ) . orElse ( Bytes . EMPTY ) ) ;
rlpOutput . writeBytes ( to . map ( Bytes : : copy ) . orElse ( Bytes . EMPTY ) ) ;
rlpOutput . writeUInt256Scalar ( value ) ;
rlpOutput . writeUInt256Scalar ( value ) ;
@ -696,8 +704,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
return Objects . equals ( this . chainId , that . chainId )
return Objects . equals ( this . chainId , that . chainId )
& & Objects . equals ( this . gasLimit , that . gasLimit )
& & Objects . equals ( this . gasLimit , that . gasLimit )
& & Objects . equals ( this . gasPrice , that . gasPrice )
& & Objects . equals ( this . gasPrice , that . gasPrice )
& & Objects . equals ( this . gasPremium , that . gasPremium )
& & Objects . equals ( this . maxPriorityFeePerGas , that . maxPriorityFeePerGas )
& & Objects . equals ( this . feeCap , that . feeCap )
& & Objects . equals ( this . maxFeePerGas , that . maxFeePerGas )
& & Objects . equals ( this . nonce , that . nonce )
& & Objects . equals ( this . nonce , that . nonce )
& & Objects . equals ( this . payload , that . payload )
& & Objects . equals ( this . payload , that . payload )
& & Objects . equals ( this . signature , that . signature )
& & Objects . equals ( this . signature , that . signature )
@ -709,7 +717,17 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
@Override
@Override
public int hashCode ( ) {
public int hashCode ( ) {
return Objects . hash (
return Objects . hash (
nonce , gasPrice , gasPremium , feeCap , gasLimit , to , value , payload , signature , chainId , v ) ;
nonce ,
gasPrice ,
maxPriorityFeePerGas ,
maxFeePerGas ,
gasLimit ,
to ,
value ,
payload ,
signature ,
chainId ,
v ) ;
}
}
@Override
@Override
@ -719,9 +737,9 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
sb . append ( "type=" ) . append ( getType ( ) ) . append ( ", " ) ;
sb . append ( "type=" ) . append ( getType ( ) ) . append ( ", " ) ;
sb . append ( "nonce=" ) . append ( getNonce ( ) ) . append ( ", " ) ;
sb . append ( "nonce=" ) . append ( getNonce ( ) ) . append ( ", " ) ;
sb . append ( "gasPrice=" ) . append ( getGasPrice ( ) ) . append ( ", " ) ;
sb . append ( "gasPrice=" ) . append ( getGasPrice ( ) ) . append ( ", " ) ;
if ( getGasPremium ( ) . isPresent ( ) & & getFeeCap ( ) . isPresent ( ) ) {
if ( getMaxPriorityFeePerGas ( ) . isPresent ( ) & & getMaxFeePerGas ( ) . isPresent ( ) ) {
sb . append ( "gasPremium =" ) . append ( getGasPremium ( ) ) . append ( ", " ) ;
sb . append ( "maxPriorityFeePerGas =" ) . append ( getMaxPriorityFeePerGas ( ) ) . append ( ", " ) ;
sb . append ( "feeCap =" ) . append ( getFeeCap ( ) ) . append ( ", " ) ;
sb . append ( "maxFeePerGas =" ) . append ( getMaxFeePerGas ( ) ) . append ( ", " ) ;
}
}
sb . append ( "gasLimit=" ) . append ( getGasLimit ( ) ) . append ( ", " ) ;
sb . append ( "gasLimit=" ) . append ( getGasLimit ( ) ) . append ( ", " ) ;
if ( getTo ( ) . isPresent ( ) ) sb . append ( "to=" ) . append ( getTo ( ) . get ( ) ) . append ( ", " ) ;
if ( getTo ( ) . isPresent ( ) ) sb . append ( "to=" ) . append ( getTo ( ) . get ( ) ) . append ( ", " ) ;
@ -751,9 +769,9 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
protected Wei gasPrice ;
protected Wei gasPrice ;
protected Wei gasPremium ;
protected Wei maxPriorityFeePerGas ;
protected Wei feeCap ;
protected Wei maxFeePerGas ;
protected long gasLimit = - 1L ;
protected long gasLimit = - 1L ;
@ -793,13 +811,13 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
return this ;
return this ;
}
}
public Builder gasPremium ( final Wei gasPremium ) {
public Builder maxPriorityFeePerGas ( final Wei maxPriorityFeePerGas ) {
this . gasPremium = gasPremium ;
this . maxPriorityFeePerGas = maxPriorityFeePerGas ;
return this ;
return this ;
}
}
public Builder feeCap ( final Wei feeCap ) {
public Builder maxFeePerGas ( final Wei maxFeePerGas ) {
this . feeCap = feeCap ;
this . maxFeePerGas = maxFeePerGas ;
return this ;
return this ;
}
}
@ -844,7 +862,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
}
}
public Builder guessType ( ) {
public Builder guessType ( ) {
if ( gasPremium ! = null | | feeCap ! = null ) {
if ( maxPriorityFeePerGas ! = null | | maxFeePerGas ! = null ) {
transactionType = TransactionType . EIP1559 ;
transactionType = TransactionType . EIP1559 ;
} else if ( accessList . isPresent ( ) ) {
} else if ( accessList . isPresent ( ) ) {
transactionType = TransactionType . ACCESS_LIST ;
transactionType = TransactionType . ACCESS_LIST ;
@ -859,8 +877,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
transactionType ,
transactionType ,
nonce ,
nonce ,
gasPrice ,
gasPrice ,
gasPremium ,
maxPriorityFeePerGas ,
feeCap ,
maxFeePerGas ,
gasLimit ,
gasLimit ,
to ,
to ,
value ,
value ,
@ -887,8 +905,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
transactionType ,
transactionType ,
nonce ,
nonce ,
gasPrice ,
gasPrice ,
gasPremium ,
maxPriorityFeePerGas ,
feeCap ,
maxFeePerGas ,
gasLimit ,
gasLimit ,
to ,
to ,
value ,
value ,