wallet: let sendtoaddress skip the optional future argument cleanly (#383)#456
Open
JSanchezFDZ wants to merge 1 commit into
Open
wallet: let sendtoaddress skip the optional future argument cleanly (#383)#456JSanchezFDZ wants to merge 1 commit into
JSanchezFDZ wants to merge 1 commit into
Conversation
…aptor3um#383) sendtoaddress's positional "future" argument is optional, but the only ways to skip it and still pass later arguments (comment, subtractfeefromamount, ...) were `[]` or `null`. Passing an empty object `{}` hit the future branch and failed with "no future_maturity is specified", and the JSON-typed slot also rejects an empty string `""` at the CLI layer with a cryptic "Error parsing JSON". Treat an empty object the same as an absent future (only a non-empty object requests a future transaction), and document in the help how to skip the argument positionally (`[]`/`null`) or via named arguments (-named). A non-empty but incomplete future object still errors as before, so validation is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Issue #383 reports that
sendtoaddress"does not work except the default/simplestsend" and that anything after the
futureargument fails, often with a crypticerror: Error parsing JSON:.Testing the current code on regtest shows the feature mostly works already — the
later arguments (
comment,comment_to,subtractfeefromamount, ...) areaccepted when
futureis given as[],null, or a valid object, and namedarguments (
-named) also work. Two rough edges remain:{}forfutureentered the future branch andfailed with
no future_maturity is specified.""forfuturefails at the CLI layer withError parsing JSON, becausefutureis a JSON-typed positional argument and""is not valid JSON.Change
future: only a non-emptyobject requests a future transaction.
{},[]andnullnow all mean"no future". A non-empty but incomplete object (e.g. only
future_maturity)still errors exactly as before, so validation is unchanged.
futurehelp text to explain that the argument is optional and howto skip it positionally (
[]/null, not"") or via-named.Verified (regtest)
Closes #383.