-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Change Wallet API get_transaction to use wallet_id parameter. Add test. #17594
Conversation
By the way, I don't mind if we want to do away with the wallet_id parameter entirely, as it is not currently giving us any security (we would have to test API requests against the "currently logged in" key to be able to reject requests for other wallets than the current one. As long as the expected API behaviour is specified. |
This is the actual change being tested. |
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.
Is there an issue or something this was fixing? I don't see the wallet parameter being used prior to this change so this is technically breaking backwards compatibility.
I rely on this api and i do not send the wallet_id in the request as that was never required, as such this would be a breaking change indeed. I can't imagine i'm the only one using it. |
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.
I think what wallet_rpc_client does in adding the wallet_id to the JSON is what is wrong and we should just change that - that is, go in the other direction from this PR. So it's a simple one-line change in wallet_rpc_client::get_transaction
to fix up that call.
See #17598 |
Thanks for your input. Ironically, I chose this implementation because I thought it was the most conservative for people who were using the I prefer the implementation in #17598 |
Thanks. That's what I wanted to do originally, but was trying to reduce surprises introduced during the fix. |
Purpose:
WalletRpcApi.get_transaction()
would never look at thewallet_id
parameter, therefore returned Transactions were never filtered bywallet_id
.Breaking Change! See below.
Current Behavior:
Would always return requested transaction, regardless of requested wallet.
New Behavior:
Will only return the transaction if it belongs to the
Fails if an invalid
wallet_id
parameter is supplied, or ifwallet_id
is missingSecurity Notes
checking the
wallet_id
does not confer any security benefits. Anyone with access to the wallet API likely has access to the wallet db.Design Notes
Personally, I would remove the
wallet_id
parameter entirely. Its only use currently is a sanity check, and that check could be built into the RPC receiver. AllTransactionRecord
s contain theirwallet_id
.We need to get rid of the local
wallet_id
int for wallet identity purposes. One of the many issues this causes us is that wallet "IDs" can change after a wallet rebuild or chain reorg.Code notes
I'm guessing
get_transaction
was introduced as a quick to implement alternative to extendingget_transactions
If that is correct, and it is not used in many places, we might consider deprecating
get_transaction
, especially if all the current use is in-house.We might want to consider folding this into
get_transactions
. I'll link the PR for that.Testing Notes: