server.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:two1-python 作者: 21dotco 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号