upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorBitflash <btf01@proton.me>2026-08-03 10:49:25 -0300
committerGitHub <noreply@github.com>2026-08-03 10:49:25 -0300
commit54ec7ae895491ce9047e6589cc7d76bd8b44c226 (patch)
treed5f4d4114a1b990089b8c63937c731fadf865af7 /src/main_gui.cpp
parent57441faffb02f4f2eea37d31b29728de25f18bef (diff)
wallet: wire -sendto into main(), where it never was (#119)
CmdSendTo() has been in walletcmd.cpp since #115 and nothing declared it or called it. The flag was dead: `bitflash -sendto=ADDRESS,AMOUNT` started a node and said nothing, because an unrecognised argument is not an error here. The v1.2.14 notes announce it under "A headless node can finally spend", and the headless Linux binary is exactly the one that does not have it -- `-help` there lists /newaddress and stops. The published Windows binary does have it, because it was built from a working tree that carried these two files uncommitted. So the artifacts disagree with each other and neither matches the tag. This adds only what was missing: the declaration in walletcmd.h, the dispatch in main(), and the -help line. No behaviour change to CmdSendTo itself. Checked on a build of this branch, against a throwaway data directory: -help lists /sendto=ADDRESS,AMOUNT -sendto=NOTANADDRESS,1 "Not a valid address", exit 1 -sendto=<valid>,-5 "Not a valid amount", exit 1 -sendto=<valid>,999 refused on an empty wallet, exit 1 All five self-tests still pass.
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 1b72813..6164ad7 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -86,6 +86,8 @@ static void PrintUsage()
86 printf(" anyone, so guard it like cash)\n"); 86 printf(" anyone, so guard it like cash)\n");
87 printf(" /importwallet=FILE (load keys from such a file back in)\n"); 87 printf(" /importwallet=FILE (load keys from such a file back in)\n");
88 printf(" /newaddress (print the next receiving address, then exit)\n"); 88 printf(" /newaddress (print the next receiving address, then exit)\n");
89 printf(" /sendto=ADDRESS,AMOUNT (spend from this wallet, then exit -- the\n");
90 printf(" only way to send without the window)\n");
89 printf(" /newphrase (create a twelve-word recovery phrase for a\n"); 91 printf(" /newphrase (create a twelve-word recovery phrase for a\n");
90 printf(" wallet that has none, show it once, exit)\n"); 92 printf(" wallet that has none, show it once, exit)\n");
91 printf(" /restorephrase=\"WORDS\" (rebuild this wallet from a phrase and scan\n"); 93 printf(" /restorephrase=\"WORDS\" (rebuild this wallet from a phrase and scan\n");
@@ -388,6 +390,17 @@ int main(int argc, char* argv[])
388 return nRet; 390 return nRet;
389 } 391 }
390 392
393 // -sendto -- the counterpart to -newaddress. Without it a headless node can
394 // be paid and can never pay: SendMoney() has been here since 0.1.0 and only
395 // the window ever reached it.
396 string strSendTo = argval2(argc, argv, "/sendto", "-sendto");
397 if (!strSendTo.empty())
398 {
399 int nRet = CmdSendTo(strSendTo);
400 DBFlush(true);
401 return nRet;
402 }
403
391 if (arg(argc,argv,"/recoveryaudit") || arg(argc,argv,"-recoveryaudit")) 404 if (arg(argc,argv,"/recoveryaudit") || arg(argc,argv,"-recoveryaudit"))
392 { 405 {
393 int nRet = CmdRecoveryAudit(); 406 int nRet = CmdRecoveryAudit();