Skip to content

Commit

Permalink
#1994 format code
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Jan 16, 2025
1 parent 0ae45c3 commit 7ae83b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
38 changes: 16 additions & 22 deletions libethereum/ClientBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,10 @@ BlockDetails ClientBase::blockDetails( h256 _hash ) const {
Transaction ClientBase::transaction( h256 _transactionHash ) const {
// allow invalid!
auto tl = bc().transactionLocation( _transactionHash );
auto blockTimestamp = blockInfo( numberFromHash( tl.first ) - 1 ).timestamp();
return Transaction( bc().transaction( _transactionHash ), CheckTransaction::Cheap, true,
EIP1559TransactionsPatch::isEnabledWhen(
blockInfo( numberFromHash( tl.first ) - 1 ).timestamp() ),
MaxFeePerGasPatch::isEnabledWhen(
blockInfo( numberFromHash( tl.first ) - 1 ).timestamp() ) );
EIP1559TransactionsPatch::isEnabledWhen( blockTimestamp ),
MaxFeePerGasPatch::isEnabledWhen( blockTimestamp ) );
}

LocalisedTransaction ClientBase::localisedTransaction( h256 const& _transactionHash ) const {
Expand All @@ -375,24 +374,22 @@ LocalisedTransaction ClientBase::localisedTransaction( h256 const& _transactionH
Transaction ClientBase::transaction( h256 _blockHash, unsigned _i ) const {
auto bl = bc().block( _blockHash );
RLP b( bl );
auto blockTimestamp = blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp();
if ( _i < b[1].itemCount() )
// allow invalid
return Transaction( b[1][_i].data(), CheckTransaction::Cheap, true,
EIP1559TransactionsPatch::isEnabledWhen(
blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp() ),
MaxFeePerGasPatch::isEnabledWhen(
blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp() ) );
EIP1559TransactionsPatch::isEnabledWhen( blockTimestamp ),
MaxFeePerGasPatch::isEnabledWhen( blockTimestamp ) );
else
return Transaction();
}

LocalisedTransaction ClientBase::localisedTransaction( h256 const& _blockHash, unsigned _i ) const {
auto blockTimestamp = blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp();
// allow invalid
Transaction t = Transaction( bc().transaction( _blockHash, _i ), CheckTransaction::Cheap, true,
EIP1559TransactionsPatch::isEnabledWhen(
blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp() ),
MaxFeePerGasPatch::isEnabledWhen(
blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp() ) );
EIP1559TransactionsPatch::isEnabledWhen( blockTimestamp ),
MaxFeePerGasPatch::isEnabledWhen( blockTimestamp ) );
return LocalisedTransaction( t, _blockHash, _i, numberFromHash( _blockHash ) );
}

Expand All @@ -403,13 +400,11 @@ TransactionReceipt ClientBase::transactionReceipt( h256 const& _transactionHash
LocalisedTransactionReceipt ClientBase::localisedTransactionReceipt(
h256 const& _transactionHash ) const {
std::pair< h256, unsigned > tl = bc().transactionLocation( _transactionHash );
auto blockTimestamp = blockInfo( numberFromHash( tl.first ) - 1 ).timestamp();
// allow invalid
Transaction t =
Transaction( bc().transaction( tl.first, tl.second ), CheckTransaction::Cheap, true,
EIP1559TransactionsPatch::isEnabledWhen(
blockInfo( numberFromHash( tl.first ) - 1 ).timestamp() ),
MaxFeePerGasPatch::isEnabledWhen(
blockInfo( numberFromHash( tl.first ) - 1 ).timestamp() ) );
Transaction t = Transaction( bc().transaction( tl.first, tl.second ), CheckTransaction::Cheap,
true, EIP1559TransactionsPatch::isEnabledWhen( blockTimestamp ),
MaxFeePerGasPatch::isEnabledWhen( blockTimestamp ) );
TransactionReceipt tr = bc().transactionReceipt( tl.first, tl.second );
u256 gasUsed = tr.cumulativeGasUsed();
if ( tl.second > 0 )
Expand Down Expand Up @@ -440,13 +435,12 @@ Transactions ClientBase::transactions( h256 _blockHash ) const {
auto bl = bc().block( _blockHash );
RLP b( bl );
Transactions res;
auto blockTimestamp = blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp();
for ( unsigned i = 0; i < b[1].itemCount(); i++ ) {
auto txRlp = b[1][i];
res.emplace_back( bytesRefFromTransactionRlp( txRlp ), CheckTransaction::Cheap, true,
EIP1559TransactionsPatch::isEnabledWhen(
blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp() ),
MaxFeePerGasPatch::isEnabledWhen(
blockInfo( numberFromHash( _blockHash ) - 1 ).timestamp() ) );
EIP1559TransactionsPatch::isEnabledWhen( blockTimestamp ),
MaxFeePerGasPatch::isEnabledWhen( blockTimestamp ) );
}
return res;
}
Expand Down
3 changes: 2 additions & 1 deletion libethereum/SkaleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ void SkaleHost::createBlock( const ConsensusExtFace::transactions_vector& _appro
LOG( m_traceLogger ) << "Arrived txn: " << sha;

Transaction t( data, CheckTransaction::Everything, true,
EIP1559TransactionsPatch::isEnabledInWorkingBlock() );
EIP1559TransactionsPatch::isEnabledInWorkingBlock(),
MaxFeePerGasPatch::isEnabledInWorkingBlock() );
t.checkOutExternalGas(
m_client.chainParams(), latestInfo.timestamp(), m_client.number() );

Expand Down

0 comments on commit 7ae83b6

Please sign in to comment.