python: handle psbt-version of fundchannel_complete, deprecate old.

I didn't change the callers yet, so I can test the backwards compat code
works.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-03-15 14:57:59 +10:30
parent da7ba6c146
commit dc44737fb8

View File

@ -814,10 +814,11 @@ class LightningRpc(UnixDomainSocketRpc):
} }
return self.call("fundchannel_cancel", payload) return self.call("fundchannel_cancel", payload)
def fundchannel_complete(self, node_id, funding_txid, funding_txout): def _deprecated_fundchannel_complete(self, node_id, funding_txid, funding_txout):
""" warnings.warn("fundchannel_complete: funding_txid & funding_txout replaced by psbt: expect removal"
Complete channel establishment with {id}, using {funding_txid} at {funding_txout}. " in Mid-2021",
""" DeprecationWarning)
payload = { payload = {
"id": node_id, "id": node_id,
"txid": funding_txid, "txid": funding_txid,
@ -825,6 +826,22 @@ class LightningRpc(UnixDomainSocketRpc):
} }
return self.call("fundchannel_complete", payload) return self.call("fundchannel_complete", payload)
def fundchannel_complete(self, node_id, *args, **kwargs):
"""
Complete channel establishment with {id}, using {psbt}.
"""
if 'txid' in kwargs or len(args) == 2:
return self._deprecated_fundchannel_complete(node_id, *args, **kwargs)
def _fundchannel_complete(node_id, psbt):
payload = {
"id": node_id,
"psbt": psbt,
}
return self.call("fundchannel_complete", payload)
return _fundchannel_complete(node_id, *args, **kwargs)
def getinfo(self): def getinfo(self):
""" """
Show information about this node. Show information about this node.