From cce0020568c2e3356814a78809055b87ddf8cd72 Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 15 Dec 2020 14:09:22 -0600 Subject: [PATCH] pyln-client: add missing `min_witness_weight` to fundpsbt/utxopsbt We need to use it for the 'df_accepter' plugin, so we get the feerate correct. Changelog-Added: pyln-client: `fundpsbt`/`utxopsbt` now support `min_witness_weight` param --- contrib/pyln-client/pyln/client/lightning.py | 6 ++++-- tests/plugins/df_accepter.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py index 9e3398216..4c4bbf142 100644 --- a/contrib/pyln-client/pyln/client/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -1244,7 +1244,7 @@ class LightningRpc(UnixDomainSocketRpc): } return self.call("unreserveinputs", payload) - def fundpsbt(self, satoshi, feerate, startweight, minconf=None, reserve=True, locktime=None): + def fundpsbt(self, satoshi, feerate, startweight, minconf=None, reserve=True, locktime=None, min_witness_weight=None): """ Create a PSBT with inputs sufficient to give an output of satoshi. """ @@ -1255,10 +1255,11 @@ class LightningRpc(UnixDomainSocketRpc): "minconf": minconf, "reserve": reserve, "locktime": locktime, + "min_witness_weight": min_witness_weight, } return self.call("fundpsbt", payload) - def utxopsbt(self, satoshi, feerate, startweight, utxos, reserve=True, reservedok=False, locktime=None): + def utxopsbt(self, satoshi, feerate, startweight, utxos, reserve=True, reservedok=False, locktime=None, min_witness_weight=None): """ Create a PSBT with given inputs, to give an output of satoshi. """ @@ -1270,6 +1271,7 @@ class LightningRpc(UnixDomainSocketRpc): "reserve": reserve, "reservedok": reservedok, "locktime": locktime, + "min_witness_weight": min_witness_weight, } return self.call("utxopsbt", payload) diff --git a/tests/plugins/df_accepter.py b/tests/plugins/df_accepter.py index 3e22d5ee7..770489640 100755 --- a/tests/plugins/df_accepter.py +++ b/tests/plugins/df_accepter.py @@ -79,7 +79,8 @@ def on_openchannel(openchannel2, plugin, **kwargs): funding = plugin.rpc.fundpsbt(amount, '{}perkw'.format(feerate), 0, reserve=True, - locktime=locktime) + locktime=locktime, + min_witness_weight=110) psbt_obj = psbt_from_base64(funding['psbt']) excess = Millisatoshi(funding['excess_msat'])