Skip to content
Snippets Groups Projects
Commit 9b26ea0f authored by inso's avatar inso
Browse files

Fixed an error when the blockchain is empty

parent 83887812
No related branches found
No related tags found
No related merge requests found
...@@ -91,16 +91,19 @@ class Account(object): ...@@ -91,16 +91,19 @@ class Account(object):
def add_community(self, server, port): def add_community(self, server, port):
logging.debug("Adding a community") logging.debug("Adding a community")
current = bma.blockchain.Current(ConnectionHandler(server, port))
block_data = current.get()
currency = block_data['currency']
logging.debug("Currency : {0}".format(currency))
peering = bma.network.Peering(ConnectionHandler(server, port)) peering = bma.network.Peering(ConnectionHandler(server, port))
peer_data = peering.get() peer_data = peering.get()
peer = Peer.from_signed_raw("{0}{1}\n".format(peer_data['raw'], peer = Peer.from_signed_raw("{0}{1}\n".format(peer_data['raw'],
peer_data['signature'])) peer_data['signature']))
currency = ""
if peer.blockid != "0-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709":
current = bma.blockchain.Current(ConnectionHandler(server, port))
block_data = current.get()
currency = block_data['currency']
logging.debug("Currency : {0}".format(currency))
community = Community.create(currency, peer) community = Community.create(currency, peer)
self.communities.append(community) self.communities.append(community)
return community return community
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment