MCPcopy Index your code
hub / github.com/raiden-network/raiden / set_reveal_timeout

Method set_reveal_timeout

raiden/api/python.py:775–825  ·  view source on GitHub ↗

Set the `reveal_timeout` in the channel with the peer at `partner_address` and the given `token_address`. Raises: InvalidBinaryAddress: If either token_address or partner_address is not 20 bytes long. InvalidRevealTimeout: If reveal_timeout ha

(
        self,
        registry_address: TokenNetworkRegistryAddress,
        token_address: TokenAddress,
        partner_address: Address,
        reveal_timeout: BlockTimeout,
    )

Source from the content-addressed store, hash-verified

773 )
774
775 def set_reveal_timeout(
776 self,
777 registry_address: TokenNetworkRegistryAddress,
778 token_address: TokenAddress,
779 partner_address: Address,
780 reveal_timeout: BlockTimeout,
781 ) -> None:
782 """Set the `reveal_timeout` in the channel with the peer at `partner_address` and the
783 given `token_address`.
784
785 Raises:
786 InvalidBinaryAddress: If either token_address or partner_address is not
787 20 bytes long.
788 InvalidRevealTimeout: If reveal_timeout has an invalid value.
789 """
790 chain_state = views.state_from_raiden(self.raiden)
791
792 token_addresses = views.get_token_identifiers(chain_state, registry_address)
793 channel_state = views.get_channelstate_for(
794 chain_state=chain_state,
795 token_network_registry_address=registry_address,
796 token_address=token_address,
797 partner_address=partner_address,
798 )
799
800 if not is_binary_address(token_address):
801 raise InvalidBinaryAddress(
802 "Expected binary address format for token in channel deposit"
803 )
804
805 if not is_binary_address(partner_address):
806 raise InvalidBinaryAddress(
807 "Expected binary address format for partner in channel deposit"
808 )
809
810 if token_address not in token_addresses:
811 raise UnknownTokenAddress("Unknown token address")
812
813 if channel_state is None:
814 raise NonexistingChannel("No channel with partner_address for the given token")
815
816 try:
817 self._raise_for_invalid_channel_timeouts(channel_state.settle_timeout, reveal_timeout)
818 except InvalidSettleTimeout as ex:
819 # convert the invalid settle timeout, since from the perspective of set_reveal_timeout
820 # the new RevealTimeout is invalid
821 raise InvalidRevealTimeout(str(ex)) from ex
822
823 self.raiden.set_channel_reveal_timeout(
824 canonical_identifier=channel_state.canonical_identifier, reveal_timeout=reveal_timeout
825 )
826
827 def channel_close(
828 self,

Callers 1

Tested by

no test coverage detected