def _load_channel(self, deposit_txid):
# Check if a payment has been made to this chanel
if not os.path.exists(deposit_txid + ".server.tx"):
raise PaymentChannelNotFoundError("Payment channel not found.")
# Load JSON channel
with open(deposit_txid + ".server.tx") as f:
channel_json = json.load(f)
# Deserialize into objects
channel = {}
channel['deposit_tx'] = bitcoin.Transaction.from_hex(channel_json['deposit_tx'])
channel['redeem_script'] = PaymentChannelRedeemScript.from_bytes(
codecs.decode(channel_json['redeem_script'], 'hex_codec'))
channel['payment_tx'] = bitcoin.Transaction.from_hex(
channel_json['payment_tx']) if channel_json['payment_tx'] else None
return channel
评论列表
文章目录