fix: timelock parameter is optional
The timelock parameter is optional in that it can be omitted, but if present it must have an integer value rather than a value of `null`.
This commit is contained in:
parent
d4151d88d6
commit
2527bcea2e
@ -430,7 +430,7 @@ cover the requested feerate.
|
||||
| ---------- | ---------------------- | ----------------------------------------------------------------------------------------- |
|
||||
| `address` | str | The Bitcoin address to sweep the coins to. |
|
||||
| `feerate` | integer | Target feerate for the transaction, in satoshis per virtual byte. |
|
||||
| `timelock` | int or `null` | Recovery path to be used, identified by the number of blocks after which it is available. |
|
||||
| `timelock` | int (optional) | Recovery path to be used, identified by the number of blocks after which it is available. |
|
||||
| `outpoints`| list of str (optional) | List of the coins to be recovered, as `txid:vout`. |
|
||||
|
||||
|
||||
|
||||
@ -186,10 +186,13 @@ impl<C: Client + Send + Sync + Debug> Daemon for Lianad<C> {
|
||||
sequence: Option<u16>,
|
||||
) -> Result<Psbt, DaemonError> {
|
||||
// The `outpoints` parameter is omitted, which means all recoverable coins will be used.
|
||||
let res: CreateRecoveryResult = self.call(
|
||||
"createrecovery",
|
||||
Some(vec![json!(address), json!(feerate_vb), json!(sequence)]),
|
||||
)?;
|
||||
let mut params = serde_json::Map::new();
|
||||
params.insert("address".to_string(), json!(address));
|
||||
params.insert("feerate".to_string(), json!(feerate_vb));
|
||||
if let Some(sequence) = sequence {
|
||||
params.insert("timelock".to_string(), json!(sequence));
|
||||
}
|
||||
let res: CreateRecoveryResult = self.call("createrecovery", Some(params))?;
|
||||
Ok(res.psbt)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user