Skip to content

Commit

Permalink
Fix restoring from snapshot
Browse files Browse the repository at this point in the history
Move the restoring from snapshot after the registering of the registry
  • Loading branch information
LefterisJP committed Sep 4, 2017
1 parent 1d99856 commit a52b89a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions raiden/raiden_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,6 @@ def __init__(self, chain, private_key_bin, transport, discovery, config):

def start(self):
""" Start the node. """
if self.database_dir is not None:
self.db_lock.acquire(timeout=0)
assert self.db_lock.is_locked
self.restore_from_snapshots()

self.alarm.start()

# Prime the block number cache and set the callbacks
Expand All @@ -284,6 +279,13 @@ def start(self):
# is mined, and the alarm starts polling at block C.
self.register_registry(self.chain.default_registry.address)

# Restore from snapshot must come after registering the registry as we
# need to know the registered tokens to populate `token_to_channelgraph`
if self.database_dir is not None:
self.db_lock.acquire(timeout=0)
assert self.db_lock.is_locked
self.restore_from_snapshots()

# Start the protocol after the registry is queried to avoid warning
# about unknown channels.
self.protocol.start()
Expand Down

0 comments on commit a52b89a

Please sign in to comment.