-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wallet: better error for send() if no outputs given #664
Conversation
Good change. I agree with this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Okay, that is more clear. While testing, also got this message as a result of a missing address (slightly incorrect): ./bin/bwallet-cli --network=regtest send
Error: Output is dust.
at WalletClient.request (/home/bgf/c/bcoin/bcoin/node_modules/bcurl/lib/client.js:213:19)
at process._tickCallback (internal/process/next_tick.js:68:7) It also looks like Here is a test case after adding it('should throw error with missing outputs', async () => {
const wallet = new Wallet({});
let err = null;
try {
await wallet.send({outputs: []});
} catch (e) {
err = e;
}
assert(err);
assert.equal(err.message, 'At least one output required.')
}); |
nit: commit message is without |
nit addressed and test added. Re: |
This comment has been minimized.
This comment has been minimized.
Wallet: better error for send() if no outputs given
If you try to
wallet.send()
with an emptyoutputs
array, the error you currently get is:No outputs available.
This was confusing me because I thought the wallet was unable to find any coins to spend, like it had a zero balance or coinbase outputs were not mature yet.
This PR changes that error to
At least one output required.
which indicates to the user/developer more specifically which output is missing.