wallet update: move fields that have string keys out of channel log
This commit is contained in:
@@ -563,6 +563,8 @@ class Channel(AbstractChannel):
|
||||
self.onion_keys = state['onion_keys'] # type: Dict[int, bytes]
|
||||
self.data_loss_protect_remote_pcp = state['data_loss_protect_remote_pcp']
|
||||
self.hm = HTLCManager(log=state['log'], initial_feerate=initial_feerate)
|
||||
self.fail_htlc_reasons = state["fail_htlc_reasons"]
|
||||
self.unfulfilled_htlcs = state["unfulfilled_htlcs"]
|
||||
self._state = ChannelState[state['state']]
|
||||
self.peer_state = PeerState.DISCONNECTED
|
||||
self._sweep_info = {}
|
||||
@@ -912,7 +914,7 @@ class Channel(AbstractChannel):
|
||||
remote_ctn = self.get_latest_ctn(REMOTE)
|
||||
if onion_packet:
|
||||
# TODO neither local_ctn nor remote_ctn are used anymore... no point storing them.
|
||||
self.hm.log['unfulfilled_htlcs'][htlc.htlc_id] = local_ctn, remote_ctn, onion_packet.hex(), False
|
||||
self.unfulfilled_htlcs[htlc.htlc_id] = local_ctn, remote_ctn, onion_packet.hex(), False
|
||||
|
||||
self.logger.info("receive_htlc")
|
||||
return htlc
|
||||
@@ -1071,10 +1073,10 @@ class Channel(AbstractChannel):
|
||||
failure_message: Optional['OnionRoutingFailure']):
|
||||
error_hex = error_bytes.hex() if error_bytes else None
|
||||
failure_hex = failure_message.to_bytes().hex() if failure_message else None
|
||||
self.hm.log['fail_htlc_reasons'][htlc_id] = (error_hex, failure_hex)
|
||||
self.fail_htlc_reasons[htlc_id] = (error_hex, failure_hex)
|
||||
|
||||
def pop_fail_htlc_reason(self, htlc_id):
|
||||
error_hex, failure_hex = self.hm.log['fail_htlc_reasons'].pop(htlc_id, (None, None))
|
||||
error_hex, failure_hex = self.fail_htlc_reasons.pop(htlc_id, (None, None))
|
||||
error_bytes = bytes.fromhex(error_hex) if error_hex else None
|
||||
failure_message = OnionRoutingFailure.from_bytes(bytes.fromhex(failure_hex)) if failure_hex else None
|
||||
return error_bytes, failure_message
|
||||
|
||||
Reference in New Issue
Block a user