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

Bug/bug 1198 dont ignore params eth block number #1677

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libweb3jsonrpc/Eth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@
return toJson( m_ethAccounts.allAccounts() );
}

string Eth::eth_blockNumber() {
string Eth::eth_blockNumber( const Json::Value& request ) {
if ( !request.empty() ) {
BOOST_THROW_EXCEPTION( JsonRpcException( Errors::ERROR_RPC_INVALID_PARAMS ) );

Check warning on line 115 in libweb3jsonrpc/Eth.cpp

View check run for this annotation

Codecov / codecov/patch

libweb3jsonrpc/Eth.cpp#L115

Added line #L115 was not covered by tests
DmytroNazarenko marked this conversation as resolved.
Show resolved Hide resolved
}
return toJS( client()->number() );
}

Expand Down
2 changes: 1 addition & 1 deletion libweb3jsonrpc/Eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Eth : public dev::rpc::EthFace, public skutils::json_config_file_accessor
virtual bool eth_mining() override;
virtual std::string eth_gasPrice() override;
virtual Json::Value eth_accounts() override;
virtual std::string eth_blockNumber() override;
virtual std::string eth_blockNumber( const Json::Value& request ) override;
virtual std::string eth_getBalance(
std::string const& _address, std::string const& _blockNumber ) override;
virtual std::string eth_getStorageAt( std::string const& _address, std::string const& _position,
Expand Down
5 changes: 2 additions & 3 deletions libweb3jsonrpc/EthFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ class EthFace : public ServerInterface< EthFace > {
response = this->eth_accounts();
}
inline virtual void eth_blockNumberI( const Json::Value& request, Json::Value& response ) {
( void ) request;
response = this->eth_blockNumber();
response = this->eth_blockNumber( request );
}
inline virtual void eth_getBalanceI( const Json::Value& request, Json::Value& response ) {
response = this->eth_getBalance( request[0u].asString(), request[1u].asString() );
Expand Down Expand Up @@ -432,7 +431,7 @@ class EthFace : public ServerInterface< EthFace > {
virtual bool eth_mining() = 0;
virtual std::string eth_gasPrice() = 0;
virtual Json::Value eth_accounts() = 0;
virtual std::string eth_blockNumber() = 0;
virtual std::string eth_blockNumber( const Json::Value& request ) = 0;
virtual std::string eth_getBalance( const std::string& param1, const std::string& param2 ) = 0;
virtual std::string eth_getStorageAt(
const std::string& param1, const std::string& param2, const std::string& param3 ) = 0;
Expand Down
Loading