Skip to content

Commit 13ad4d6

Browse files
committed
fix: check explicitly is None and don't use falsiness (nonce == 0)
NOTE: Also forgot to backup nonce in state
1 parent 4151c9c commit 13ad4d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

silverback/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ async def __create_snapshot_handler(
261261
# TODO: Migrate these to parameters (remove explicitly from state)
262262
last_block_seen=self.state.get("system:last_block_seen", -1),
263263
last_block_processed=self.state.get("system:last_block_processed", -1),
264+
last_nonce_used=self.state.get("system:last_nonce_used"),
264265
)
265266

266267
# To ensure we don't have too many forks at once
@@ -271,7 +272,7 @@ def nonce(self) -> int:
271272
if not self.signer:
272273
raise NoSignerLoaded()
273274

274-
elif not (last_nonce_used := self.state["system:last_nonce_used"]):
275+
elif (last_nonce_used := self.state.get("system:last_nonce_used")) is None:
275276
raise AttributeError(
276277
"`bot.state` not fully loaded yet, please do not use during worker startup."
277278
)

0 commit comments

Comments
 (0)