Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTQ rpc call, v3.18.0 again #1776

Merged
merged 9 commits into from
Jan 10, 2024
2 changes: 2 additions & 0 deletions libethereum/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class Client : public ClientBase, protected Worker {
/// Retrieve pending transactions
Transactions pending() const override;

Transactions debugGetFutureTransactions() const { return m_tq.debugGetFutureTransactions(); }

/// Queues a block for import.
ImportResult queueBlock( bytes const& _block, bool _isSafe = false );

Expand Down
11 changes: 11 additions & 0 deletions libethereum/TransactionQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,3 +537,14 @@ void TransactionQueue::verifierBody() {
MICROPROFILE_LEAVE();
}
}

Transactions TransactionQueue::debugGetFutureTransactions() const {
Transactions res;
ReadGuard l( m_lock );
for ( auto addressAndMap : m_future ) {
for ( auto nonceAndTransaction : addressAndMap.second ) {
res.push_back( nonceAndTransaction.second.transaction );
} // for nonce
} // for address
return res;
}
2 changes: 2 additions & 0 deletions libethereum/TransactionQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class TransactionQueue {
template < class... Args >
Transactions topTransactionsSync( unsigned _limit, Args... args );

Transactions debugGetFutureTransactions() const;

/// Get a hash set of transactions in the queue
/// @returns A hash set of all transactions in the queue
const h256Hash knownTransactions() const;
Expand Down
7 changes: 7 additions & 0 deletions libweb3jsonrpc/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,10 @@ uint64_t Debug::debug_doBlocksDbCompaction() {

return boost::chrono::duration_cast< boost::chrono::milliseconds >( t2 - t1 ).count();
}

Json::Value Debug::debug_getFutureTransactions() {
auto res = toJson( m_eth.debugGetFutureTransactions() );
for ( auto& t : res )
t.removeMember( "data" );
return res;
}
2 changes: 2 additions & 0 deletions libweb3jsonrpc/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Debug : public DebugFace {
virtual uint64_t debug_doStateDbCompaction() override;
virtual uint64_t debug_doBlocksDbCompaction() override;

virtual Json::Value debug_getFutureTransactions() override;

private:
eth::Client const& m_eth;
SkaleDebugInterface* m_debugInterface = nullptr;
Expand Down
10 changes: 10 additions & 0 deletions libweb3jsonrpc/DebugFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class DebugFace : public ServerInterface< DebugFace > {
this->bindAndAddMethod( jsonrpc::Procedure( "debug_doBlocksDbCompaction",
jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL ),
&dev::rpc::DebugFace::debug_doBlocksDbCompactionI );

this->bindAndAddMethod( jsonrpc::Procedure( "debug_getFutureTransactions",
jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL ),
&dev::rpc::DebugFace::debug_getFutureTransactionsI );
}
inline virtual void debug_accountRangeAtI( const Json::Value& request, Json::Value& response ) {
response = this->debug_accountRangeAt( request[0u].asString(), request[1u].asInt(),
Expand Down Expand Up @@ -179,6 +183,10 @@ class DebugFace : public ServerInterface< DebugFace > {
response = this->debug_doBlocksDbCompaction();
}

virtual void debug_getFutureTransactionsI( const Json::Value&, Json::Value& response ) {
response = this->debug_getFutureTransactions();
}

virtual Json::Value debug_accountRangeAt(
const std::string& param1, int param2, const std::string& param3, int param4 ) = 0;
virtual Json::Value debug_traceTransaction(
Expand Down Expand Up @@ -206,6 +214,8 @@ class DebugFace : public ServerInterface< DebugFace > {

virtual uint64_t debug_doStateDbCompaction() = 0;
virtual uint64_t debug_doBlocksDbCompaction() = 0;

virtual Json::Value debug_getFutureTransactions() = 0;
};

} // namespace rpc
Expand Down
Loading