MCPcopy
hub / github.com/raiden-network/raiden / inplace_delete_message

Function inplace_delete_message

raiden/transfer/node.py:452–474  ·  view source on GitHub ↗

Check if the message exists in queue with ID `queueid` and exclude if found.

(
    message_queue: List[SendMessageEvent],
    state_change: Union[ReceiveDelivered, ReceiveProcessed, ReceiveWithdrawConfirmation],
)

Source from the content-addressed store, hash-verified

450
451
452def inplace_delete_message(
453 message_queue: List[SendMessageEvent],
454 state_change: Union[ReceiveDelivered, ReceiveProcessed, ReceiveWithdrawConfirmation],
455) -> None:
456 """Check if the message exists in queue with ID `queueid` and exclude if found."""
457 for message in list(message_queue):
458 # A withdraw request is only confirmed by a withdraw confirmation.
459 # This is done because Processed is not an indicator that the partner has
460 # processed and **accepted** our withdraw request. Receiving
461 # `Processed` here would cause the withdraw request to be removed
462 # from the queue although the confirmation may have not been sent.
463 # This is avoided by waiting for the confirmation before removing
464 # the withdraw request.
465 if isinstance(message, SendWithdrawRequest):
466 if not isinstance(state_change, ReceiveWithdrawConfirmation):
467 continue
468
469 message_found = (
470 message.message_identifier == state_change.message_identifier
471 and message.recipient == state_change.sender
472 )
473 if message_found:
474 message_queue.remove(message)
475
476
477def handle_block(chain_state: ChainState, state_change: Block) -> TransitionResult[ChainState]:

Callers 1

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected