Skip to content

RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest#8775

Merged
laanwj merged 9 commits intobitcoin:masterfrom
luke-jr:multiwallet_prefactor_rpc
Mar 3, 2017
Merged

RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest#8775
laanwj merged 9 commits intobitcoin:masterfrom
luke-jr:multiwallet_prefactor_rpc

Conversation

@luke-jr
Copy link
Member

@luke-jr luke-jr commented Sep 21, 2016

Part of the refactorings needed for basic multiwallet (#8694)

@jonasschnelli
Copy link
Contributor

I don't like the coupling and the #ifdef ENABLE_WALLET in rpc/server.cpp|.h.
I'd recommend to keep the CRPCRequestInfo wallet-free.

I think we should pack the request path (URI) into the CRPCRequestInfo and or informations about the authentication (in case we want to distinct wallets based on authentication).
Then I think there should be a method in wallet.cpp (or in rpcwallet.cpp) that maps a CWallet * pointer from a given URI, Auth-Info or the complete CRPCRequestInfo instance.

Instead of the CWallet *& pwallet = reqinfo.wallet; there could be then something like CWallet *pwallet = CWallets::getWalletFromRequest(reqinfo)

@jonasschnelli
Copy link
Contributor

General ConceptACK on a CRPCRequestInfo for the RPC table commands.
Maybe it could also include the UniValue params and fHelp?

src/rpc/misc.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*&?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pwallet is an alias to reqinfo.wallet which is of type CWallet*.

@luke-jr
Copy link
Member Author

luke-jr commented Sep 21, 2016

I think we should pack the request path (URI) into the CRPCRequestInfo and or informations about the authentication (in case we want to distinct wallets based on authentication).
Then I think there should be a method in wallet.cpp (or in rpcwallet.cpp) that maps a CWallet * pointer from a given URI, Auth-Info or the complete CRPCRequestInfo instance.

That sounds nice, but greatly complicates the implementation. :(

@maflcko
Copy link
Member

maflcko commented Oct 19, 2016

I think this can be closed after #8788?

@jonasschnelli
Copy link
Contributor

Closing in favor of merged #8788

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Wrapped in CRPCRequestInfo to avoid gratuitous #ifdef ENABLE_WALLET everywhere

Github-Pull: bitcoin#8775
Rebased-From: 80f4ab7b5f404d20bed41ec70182e6fc0990205b
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8775
Rebased-From: 9279b515815e58df5bd796b0570e388ff42fb84b
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
…nique per CWallet

Github-Pull: bitcoin#8775
Rebased-From: 041f4e06a664b7e31ba77bbfbb2f7bc8d04174ca
@laanwj laanwj reopened this Oct 25, 2016
@luke-jr luke-jr force-pushed the multiwallet_prefactor_rpc branch 2 times, most recently from 06bd5d0 to ab5ce98 Compare October 25, 2016 08:50
@luke-jr
Copy link
Member Author

luke-jr commented Oct 25, 2016

Rebased and refactored based on @jonasschnelli 's idea.

@laanwj
Copy link
Member

laanwj commented Oct 25, 2016

Makes sense, utACK ab5ce98

src/rpc/misc.cpp Outdated

using namespace std;

CWallet *GetWalletForJSONRPCRequest(const JSONRPCRequest&);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this can pass the build w/ --disable-wallet, but this should be bracketed with #ifdef ENABLE_WALLET

@luke-jr luke-jr force-pushed the multiwallet_prefactor_rpc branch 2 times, most recently from 5cce71a to d6bc295 Compare November 12, 2016 01:44
@luke-jr
Copy link
Member Author

luke-jr commented Nov 12, 2016

Rebased and addressed nit

@luke-jr luke-jr changed the title RPC refactoring: Never access wallet directly, only via new CRPCRequestInfo RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest Nov 12, 2016
@luke-jr luke-jr force-pushed the multiwallet_prefactor_rpc branch from d6bc295 to 7de5573 Compare December 29, 2016 13:20
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Dec 31, 2016
Github-Pull: bitcoin#8775
Similar-To: 7de55733c5690350c48ec94660b5be56fbb5eb39
@instagibbs
Copy link
Member

utACK 7de55733c5690350c48ec94660b5be56fbb5eb39

@luke-jr luke-jr force-pushed the multiwallet_prefactor_rpc branch from 7de5573 to 7c65786 Compare January 5, 2017 22:52
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
…RPCRunLater job name

The job name is logged, and could pose as an information leak to someone attacking the process, helping them counteract ASLR protections

Github-Pull: bitcoin#8775
Rebased-From: 9756be3
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 7, 2017
@jtimon
Copy link
Contributor

jtimon commented Mar 23, 2017

By the way, I reviewed this partially after merged when rebasing #9845 (making it mostly pointless since most was done here already).

@adneerav
Copy link

adneerav commented Feb 5, 2019

Hello @luke-jr ,

Is there any way where we can increase the number of wallets to be in loaded state at same time.As rightnow its like if I load wallet more than 100 or 150 daemon is getting crashed/stopped. I am trying to load/unload wallet dynamically using RPC.

What i tried is incraesing the set_lk_max_lockers to 400000 and also added
set_lg_regionmax 1048576 But still same things I am facing.

Reflink for above setup : https://docs.oracle.com/cd/E17276_01/html/api_reference/C/set_lk_max_lockers_parameter.html
https://bitcoin.stackexchange.com/a/70737

So is there any way or configuration or any changes which can increase and allow more number of wallets to be loaded ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.