Support block hash alias in console #88
pull promag wants to merge 1 commits into bitcoin-core:master from promag:2020-09-block-alias-console changing 1 files +11 −3-
promag commented at 8:56 am on September 11, 2020: contributor
-
promag requested review from hebasto on Sep 11, 2020
-
promag force-pushed on Sep 11, 2020
-
promag added the label Feature on Sep 11, 2020
-
promag closed this on Sep 11, 2020
-
promag reopened this on Sep 11, 2020
-
gui: Support block hash alias in console
Add support to use @best or @height instead of block hash in the RPC console. The approach used is to simply replace those expressions with the relevant RPC method.
-
promag force-pushed on Sep 11, 2020
-
promag commented at 1:21 pm on September 11, 2020: contributorNow using
QRegExp
, not sure why it fails to build withQRegularExpression
since it’s (supposedly) available since Qt 5.0. -
hebasto commented at 1:23 pm on September 11, 2020: member
Now using
QRegExp
, not sure why it fails to build withQRegularExpression
since it’s (supposedly) available since Qt 5.0. -
promag commented at 9:38 pm on September 11, 2020: contributorThis is an alternative approach for the GUI change in https://github.com/bitcoin/bitcoin/pull/16439
-
in src/qt/rpcconsole.cpp:392 in d2379e5c8f
388+void RPCExecutor::request(QString command, const WalletModel* wallet_model) 389 { 390 try 391 { 392+ command.replace(QRegExp("@best"), "getbestblockhash()"); 393+ command.replace(QRegExp("@([\\d]+)"), "getblockhash(\\1)");
ajtowns commented at 4:55 am on September 14, 2020:Would it be better to have “\b@best\b” (and likewise for digits) so you don’t replace “bob@bestdomainever.com” in a label or similar?
hebasto commented at 7:35 pm on September 14, 2020:The opening word boundary doesn’t work with a “word” that starts with the
@
character. But the closing word boundary indeed improves behavior and error handling:0 command.replace(QRegExp("@best\\b"), "getbestblockhash()"); 1 command.replace(QRegExp("@([\\d]+)\\b"), "getblockhash(\\1)");
luke-jr commented at 8:04 pm on October 24, 2020:I thinkRPCParseCommandLine
would be the proper place to do this.in src/qt/rpcconsole.cpp:419 in d2379e5c8f
413@@ -410,7 +414,11 @@ void RPCExecutor::request(const QString &command, const WalletModel* wallet_mode 414 " example: getblock(getblockhash(0) 1)[tx]\n\n" 415 416 "Results without keys can be queried with an integer in brackets using the parenthesized syntax.\n" 417- " example: getblock(getblockhash(0),1)[tx][0]\n\n"))); 418+ " example: getblock(getblockhash(0),1)[tx][0]\n\n" 419+ 420+ "Aliases for block hash can be used."
hebasto commented at 6:27 pm on September 14, 2020:0 "Aliases for block hash can be used.\n"
hebasto changes_requestedhebasto commented at 7:45 pm on September 14, 2020: memberApproach ACK d2379e5c8f831abc244616069b6382626d6a6382.
Only
help-console
message provides a user with info about new aliases. The help messages of the affected RPC’s still lack these updates, but I think it is OK for the GUI console.This PR seems preferable than the 2f9f2d66cbada9134238f25aa12691876bdeff6b commit from https://github.com/bitcoin/bitcoin/pull/16439.
MarcoFalke renamed this:
gui: Support block hash alias in console
Support block hash alias in console
on Sep 20, 2020in src/qt/rpcconsole.cpp:35 in d2379e5c8f
31@@ -32,6 +32,7 @@ 32 #include <QKeyEvent> 33 #include <QMenu> 34 #include <QMessageBox> 35+#include <QRegExp>
luke-jr commented at 8:02 pm on October 24, 2020:I don’t think this warrants addingQRegExp
to the project
promag commented at 12:12 pm on October 28, 2020:We already have it. Maybe you are thinking ofQRegularExpression
?luke-jr changes_requestedhebasto added the label UX on May 29, 2021hebasto added the label Waiting for author on May 29, 2021promag closed this on Jun 6, 2021
promag deleted the branch on Jun 6, 2021bitcoin-core locked this on Aug 16, 2022
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 07:20 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me