diff --git a/res/ui/currency_tab.ui b/res/ui/currency_tab.ui index afc46e246ca289d292f683d46ce68a33019aef89..8218af48ed277e794265950b98bfee2f45e6fd16 100644 --- a/res/ui/currency_tab.ui +++ b/res/ui/currency_tab.ui @@ -33,7 +33,7 @@ <bool>false</bool> </property> <property name="currentIndex"> - <number>1</number> + <number>0</number> </property> <widget class="QWidget" name="tab_wallets"> <attribute name="icon"> diff --git a/src/cutecoin/core/community.py b/src/cutecoin/core/community.py index 5f48889c33bd2cc01809a1873ecda428e075633c..f7ec25dd95932df2e8a2be736462614acafd669f 100644 --- a/src/cutecoin/core/community.py +++ b/src/cutecoin/core/community.py @@ -47,11 +47,14 @@ class Community(object): endpoint_inline = next(e for e in data['endpoints'] if Endpoint.from_inline(e) is not None) endpoint = Endpoint.from_inline(endpoint_inline) - peering = bma.network.Peering(endpoint.conn_handler()) - peer_data = peering.get() - peer = Peer.from_signed_raw("{0}{1}\n".format(peer_data['raw'], + try: + peering = bma.network.Peering(endpoint.conn_handler()) + peer_data = peering.get() + peer = Peer.from_signed_raw("{0}{1}\n".format(peer_data['raw'], peer_data['signature'])) - peers.append(peer) + peers.append(peer) + except: + pass community = cls(currency, peers) return community diff --git a/src/cutecoin/core/wallet.py b/src/cutecoin/core/wallet.py index a8c09bfd81146dfb0b66d63d45dd68ec6027f215..4d65c372ee2778e03838ff9b49869a5b5d24f154 100644 --- a/src/cutecoin/core/wallet.py +++ b/src/cutecoin/core/wallet.py @@ -75,22 +75,29 @@ class Cache(): with_tx = community.request(bma.blockchain.TX) # We parse only blocks with transactions parsed_blocks = reversed(range(self.latest_block, - current_block['number'])) - parsed_blocks = [n for n in parsed_blocks if n in with_tx['result']['blocks']] + current_block['number'] + 1)) + parsed_blocks = [n for n in parsed_blocks + if n in with_tx['result']['blocks']] for block_number in parsed_blocks: block = community.request(bma.blockchain.Block, req_args={'number': block_number}) signed_raw = "{0}{1}\n".format(block['raw'], block['signature']) block_doc = Block.from_signed_raw(signed_raw) for tx in block_doc.transactions: - in_outputs = [o for o in tx.outputs if o.pubkey == self.wallet.pubkey] + in_outputs = [o for o in tx.outputs + if o.pubkey == self.wallet.pubkey] if len(in_outputs) > 0: self.tx_received.append(tx) in_inputs = [i for i in tx.issuers if i == self.wallet.pubkey] if len(in_inputs) > 0: + logging.debug("TX:{0}".format(tx.compact())) # remove from waiting transactions list the one which were # validated in the blockchain + confirmed_tx = [awaiting for awaiting in self.awaiting_tx + if awaiting.compact() == tx.compact()] + for c in confirmed_tx: + logging.debug("Awaiting:{0}".format(c.compact())) self.awaiting_tx = [awaiting for awaiting in self.awaiting_tx if awaiting.compact() != tx.compact()] self.tx_sent.append(tx) diff --git a/src/cutecoin/gui/process_cfg_community.py b/src/cutecoin/gui/process_cfg_community.py index 07b562e320946e5bc23a28c86db559b4101ee12d..5cf49b38ec9f4f68c9f2dcd0441ea9ea623a3918 100644 --- a/src/cutecoin/gui/process_cfg_community.py +++ b/src/cutecoin/gui/process_cfg_community.py @@ -139,10 +139,16 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): ''' server = self.lineedit_server.text() port = self.spinbox_port.value() - if self.community is not None: - self.community.add_peer(server, port) - self.tree_peers.setModel(PeeringTreeModel(self.community, - self.peers)) + try: + peer_data = bma.network.Peering(ConnectionHandler(server, port)) + + peer = Peer.from_signed_raw("{0}{1}\n".format(peer_data['raw'], + peer_data['signature'])) + self.community.peers.append(peer) + except: + QMessageBox.critical(self, "Server error", + "Cannot get node peering") + self.tree_peers.setModel(PeeringTreeModel(self.community)) def showContextMenu(self, point): if self.stacked_pages.currentIndex() == 1: