-
Notifications
You must be signed in to change notification settings - Fork 267
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
add eth_pendingTransactions() support #2227
Conversation
@Override | ||
public TransactionResultDTO[] eth_pendingTransactions() { | ||
JsonNode content = txPoolModule.content(); | ||
JsonNode pendingTransactionsNode = content.get(TxPoolModuleImpl.PENDING); |
Check notice
Code scanning / CodeQL
Use of default toString() Note
return new TransactionResultDTO[0]; | ||
} | ||
|
||
List<TransactionResultDTO> transactionDTOs = new ArrayList<>(); |
Check notice
Code scanning / CodeQL
Use of default toString() Note
List<Transaction> pendingTransactions = web3InformationRetriever.getTransactions("pending"); | ||
|
||
// get list of accounts managed by the node | ||
Set<String> managedAccountSet = new HashSet<>(Arrays.asList(personalModule.listAccounts())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personalModule.listAccounts()
throws an exception if personal wallet is disabled.
Alternatively, we could add a new pendingTransactions()
method to EthModuleWallet
interface and properly implement in derived classes, and then make use of it in this eth_pendingTransactions()
like this getEthModule().pendingTransactions()
, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are still using personalModule.listAccounts()
in this context which would throw an error if the personal module is disabled - eg by default in Testnet and Mainnet. What about moving this stuff to EthModuleWallet
as was suggested in he previous comment?
List<Transaction> pendingTransactions = web3InformationRetriever.getTransactions("pending"); | ||
|
||
// get list of accounts managed by the node | ||
Set<String> managedAccountSet = new HashSet<>(Arrays.asList(personalModule.listAccounts())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are still using personalModule.listAccounts()
in this context which would throw an error if the personal module is disabled - eg by default in Testnet and Mainnet. What about moving this stuff to EthModuleWallet
as was suggested in he previous comment?
rskj-core/src/main/java/co/rsk/rpc/modules/eth/EthModuleWallet.java
Outdated
Show resolved
Hide resolved
pipeline:run |
1 similar comment
pipeline:run |
@@ -1863,7 +1863,7 @@ private EthModuleWallet getEthModuleWallet() { | |||
if (wallet == null) { | |||
ethModuleWallet = new EthModuleWalletDisabled(); | |||
} else { | |||
ethModuleWallet = new EthModuleWalletEnabled(wallet); | |||
ethModuleWallet = new EthModuleWalletEnabled(wallet, transactionPool); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ethModuleWallet = new EthModuleWalletEnabled(wallet, transactionPool); | |
ethModuleWallet = new EthModuleWalletEnabled(wallet, getTransactionPool()); |
better to use the getter
instead of the field
rskj-core/src/main/java/co/rsk/rpc/modules/eth/EthModuleWalletEnabled.java
Outdated
Show resolved
Hide resolved
297cf4b
to
5b7754c
Compare
Quality Gate passedIssues Measures |
Description
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: