def execute(self, block_height, invoker_uri='', channel_name='', hashcode='', rcode='', invoker_key='', is_debug=False): """ :param block_height: :param invoker_uri: :param channel_name: :param hashcode: :param rcode: :param invoker_key: :param is_debug: :return: """ super(ChannelHtlcUnlockEvent, self).execute(block_height) LOG.debug('unlock htlc payment parameter: {}, {}, {}'.format( invoker_uri, channel_name, hashcode)) LOG.debug('unlock htlc payment event args: {}, kwargs {}' \ .format(self.event_arguments.args, self.event_arguments.kwargs)) # close channel event result = Channel.force_release_htlc( invoker_uri, channel_name, hashcode, rcode, invoker_key, gwei_coef=self.gwei_coef, trigger=self.contract_event_api.htlc_unlock_payment, is_debug=is_debug) # Don't close channel if result and 'success' in result.values(): self.next_stage()
def execute(self, block_height, invoker_uri='', channel_name='', hashcode='', rcode='', invoker_key=''): """ :param block_height: :param invoker_uri: :param channel_name: :param hashcode: :param rcode: :param invoker_key: :return: """ super(ChannelPunishHtlcUnlockEvent, self).execute(block_height) # punishment when other want to release the htlc-locked payment result = Channel.force_release_htlc( invoker_uri, channel_name, hashcode, rcode, invoker_key, gwei_coef=self.gwei_coef, trigger=self.contract_event_api.punish_when_htlc_unlock_payment, is_debug=False, is_pubnishment=True, htcl_to_rsmc=self.transfer_htlc_to_rsmc) self.transfer_htlc_to_rsmc = False # set channel settling if result is not None and 'success' in result.values(): Channel.update_channel(self.channel_name, state=EnumChannelState.SETTLED.name) self.next_stage()