Skip to content

Commit 9737572

Browse files
committed
[Qt] Use wallet 0 in rpc console if running with multiple wallets
1 parent 9e8d6a3 commit 9737572

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/qt/rpcconsole.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#ifdef ENABLE_WALLET
2727
#include <db_cxx.h>
28+
#include <wallet/wallet.h>
2829
#endif
2930

3031
#include <QKeyEvent>
@@ -301,6 +302,14 @@ bool RPCConsole::RPCParseCommandLine(std::string &strResult, const std::string &
301302
JSONRPCRequest req;
302303
req.params = RPCConvertValues(stack.back()[0], std::vector<std::string>(stack.back().begin() + 1, stack.back().end()));
303304
req.strMethod = stack.back()[0];
305+
#ifdef ENABLE_WALLET
306+
// TODO: Move this logic to WalletModel
307+
if (!vpwallets.empty()) {
308+
// in Qt, use always the wallet with index 0 when running with multiple wallets
309+
QByteArray encodedName = QUrl::toPercentEncoding(QString::fromStdString(vpwallets[0]->GetName()));
310+
req.URI = "/wallet/"+std::string(encodedName.constData(), encodedName.length());
311+
}
312+
#endif
304313
lastResult = tableRPC.execute(req);
305314
}
306315

0 commit comments

Comments
 (0)