Skip to content

wallet: wire -sendto into main(), where it never was - #119

Merged
Bitflash-sh merged 1 commit into
mainfrom
wire-sendto
Aug 3, 2026
Merged

wallet: wire -sendto into main(), where it never was#119
Bitflash-sh merged 1 commit into
mainfrom
wire-sendto

Conversation

@Bitflash-sh

Copy link
Copy Markdown
Owner

What is missing

CmdSendTo() has lived in walletcmd.cpp since #115, and nothing ever declared or called it. The flag is dead code: bitflash -sendto=ADDRESS,AMOUNT starts 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. -help on the published bitflash-node lists /newaddress and 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:

  • the declaration in walletcmd.h
  • the dispatch in main()
  • the -help line

No change to CmdSendTo itself.

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:

command result
-help lists /sendto=ADDRESS,AMOUNT
-sendto=NOTANADDRESS,1 Not a valid address: NOTANADDRESS, exit 1
-sendto=<valid>,-5 Not a valid amount: -5, exit 1
-sendto=<valid>,999 refused on an empty wallet, exit 1

Every refusal happens before the wallet is touched, which is what CmdSendTo already promised and could never demonstrate.

Not in this PR

BTF_ACCEPT_THREADS was 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.

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.
@Bitflash-sh
Bitflash-sh merged commit 07afc4d into main Aug 3, 2026
@Bitflash-sh
Bitflash-sh deleted the wire-sendto branch August 3, 2026 13:49
@Bitflash-sh

Copy link
Copy Markdown
Owner Author

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 CmdSendTo on a branch, tested it against a live wallet, and then moved to the next fix without ever committing it. Switching branches carried the uncommitted files along, and a later git add src/walletcmd.cpp for an unrelated change swept the function body in with it. The header and the main() dispatch stayed behind.

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant