def close(self, deposit_txid, deposit_txid_signature):
# Load channel
channel = self._load_channel(deposit_txid)
# Check if a payment has been made to this chanel
if channel['payment_tx'] is None:
raise Exception("No payment has been made to this channel.")
# Verify deposit txid singature
public_key = channel['redeem_script'].customer_public_key
assert public_key.verify(
deposit_txid.encode(), bitcoin.Signature.from_der(deposit_txid_signature)
), "Invalid deposit txid signature."
# Return payment txid
return str(channel['payment_tx'].hash)
评论列表
文章目录