reserve/unreserve input: new RPC commands for reserving inputs/outputs

Reserve and unreserve wallet UTXOs using a PSBT which includes those
inputs.

Note that currently we unreserve inputs everytime the node restarts.
This will be addressed in a future commit.

Changelog-Added: JSON-RPC: Adds two new rpc methods, `reserveinputs` and `unreserveinputs`, which allow for reserving or unreserving wallet UTXOs
This commit is contained in:
niftynei
2020-06-09 18:41:51 -05:00
committed by Christian Decker
parent b90be4f6c8
commit 103dce63ef
5 changed files with 275 additions and 0 deletions

View File

@@ -1107,6 +1107,28 @@ class LightningRpc(UnixDomainSocketRpc):
}
return self.call("txsend", payload)
def reserveinputs(self, outputs, feerate=None, minconf=None, utxos=None):
"""
Reserve UTXOs and return a psbt for a 'stub' transaction that
spends the reserved UTXOs.
"""
payload = {
"outputs": outputs,
"feerate": feerate,
"minconf": minconf,
"utxos": utxos,
}
return self.call("reserveinputs", payload)
def unreserveinputs(self, psbt):
"""
Unreserve UTXOs that were previously reserved.
"""
payload = {
"psbt": psbt,
}
return self.call("unreserveinputs", payload)
def signmessage(self, message):
"""
Sign a message with this node's secret key.