wallet: wire -sendto into main(), where it never was - #119
Conversation
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.
|
Thank you for catching this, and the title is exactly right — it never was wired. For the record of how it happened, because the shape of the mistake matters more than the missing lines: I wrote So two things went wrong at once. #115 shipped a diff wider than its description — the same contract violation I had corrected on #112/#113 a few hours earlier — and v1.2.14's release notes promised a command that build cannot run. I have added a correction at the top of that section in the v1.2.14 notes pointing at 1.2.15, since anyone reading them on the old release would otherwise be told something false. The lesson I am keeping: a feature is not done when it works in my shell, it is done when it is committed on its own branch and the diff matches what the description says. |
What is missing
CmdSendTo()has lived inwalletcmd.cppsince #115, and nothing ever declared or called it. The flag is dead code:bitflash -sendto=ADDRESS,AMOUNTstarts a node and says nothing, because an unrecognised argument is not an error in this tree.The v1.2.14 notes announce it under "A headless node can finally spend" — and the headless Linux binary is precisely the one that does not have it.
-helpon the publishedbitflash-nodelists/newaddressand stops.The published Windows binary does have it. It was built from a working tree carrying these two files uncommitted, so the two artifacts of the same release disagree with each other and neither matches the tag.
What this changes
Only the wiring that was missing:
walletcmd.hmain()-helplineNo change to
CmdSendToitself.Testing
Built from this branch; all five self-tests pass. Then exercised the flag against a throwaway data directory, since the whole failure was that it silently did nothing:
-help/sendto=ADDRESS,AMOUNT-sendto=NOTANADDRESS,1Not a valid address: NOTANADDRESS, exit 1-sendto=<valid>,-5Not a valid amount: -5, exit 1-sendto=<valid>,999Every refusal happens before the wallet is touched, which is what
CmdSendToalready promised and could never demonstrate.Not in this PR
BTF_ACCEPT_THREADSwas the third file uncommitted in that tree, set to 3. It stays at 1 here. The published Windows binary is running with 3, which the v1.2.14 notes say was deliberately left out; that is a separate problem and is not fixed by this change.