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

Function block_offset_timeout

raiden/tests/utils/transfer.py:1179–1200  ·  view source on GitHub ↗

Returns a BlockTimeout that will fire after a number of blocks. Usually created at the same time as a set of transfers to wait until their expiration.

(
    raiden: RaidenService,
    error_message: Optional[str] = None,
    offset: Optional[BlockOffset] = None,
    safety_margin: int = 5,
)

Source from the content-addressed store, hash-verified

1177
1178
1179def block_offset_timeout(
1180 raiden: RaidenService,
1181 error_message: Optional[str] = None,
1182 offset: Optional[BlockOffset] = None,
1183 safety_margin: int = 5,
1184) -> BlockTimeout:
1185 """
1186 Returns a BlockTimeout that will fire after a number of blocks. Usually created
1187 at the same time as a set of transfers to wait until their expiration.
1188 """
1189 expiration = BlockNumber(
1190 raiden.get_block_number() + (offset or raiden.config.settle_timeout) + safety_margin
1191 )
1192 exception = RuntimeError(
1193 error_message or "Events were not completed in the required number of blocks."
1194 )
1195 return BlockTimeout(
1196 raiden=raiden,
1197 exception_to_throw=exception,
1198 block_number=expiration,
1199 retry_timeout=DEFAULT_RETRY_TIMEOUT,
1200 )
1201
1202
1203def block_timeout_for_transfer_by_secrethash(

Calls 2

BlockTimeoutClass · 0.90
get_block_numberMethod · 0.80