Skip to content

Commit 1339898

Browse files
committed
commands: include missing amount in response
The GUI uses the InsufficientFunds error to get the missing amount when the user is creating a new spend. It is not straightforward to extract this information in a general way from the RPC error. Instead, this missing amount will be included in the command response. These changes are based on suggestions from darosior and edouardparis.
1 parent 7ca6cc8 commit 1339898

File tree

4 files changed

+213
-124
lines changed

4 files changed

+213
-124
lines changed

doc/API.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,18 @@ This command will refuse to create any output worth less than 5k sats.
179179

180180
#### Response
181181

182+
If the spend is created successfully, the following response will be received:
183+
182184
| Field | Type | Description |
183185
| -------------- | ----------------- | ---------------------------------------------------- |
184186
| `psbt` | string | PSBT of the spending transaction, encoded as base64. |
185187
| `warnings` | list of string | Warnings, if any, generated during spend creation. |
186188

189+
If there are insufficient funds to create the required spend, then the following response will be received:
190+
191+
| Field | Type | Description |
192+
| -------------- | ----------------- | ---------------------------------------------------- |
193+
| `missing` | integer | Additional sats required to create the spend. |
187194

188195
### `updatespend`
189196

@@ -294,9 +301,7 @@ allowed in order to replace this transaction using RBF (see https://github.com/b
294301

295302
#### Response
296303

297-
| Field | Type | Description |
298-
| -------------- | --------- | ---------------------------------------------------- |
299-
| `psbt` | string | PSBT of the spending transaction, encoded as base64. |
304+
The response is the same as for [`createspend`](#createspend).
300305

301306
### `startrescan`
302307

0 commit comments

Comments
 (0)