예제 #1
0
 def on_btnSendUpdateTx_clicked(self, enabled):
     self.read_data_from_network()
     self.validate_data()
     if self.dmn_prev_payout_address == self.dmn_new_payout_address and \
         self.dmn_prev_operator_pubkey == self.dmn_new_operator_pubkey and \
         self.dmn_prev_voting_address == self.dmn_new_voting_address:
         WndUtils.warnMsg(
             'Nothing is changed compared to the data stored in the FIX network.'
         )
     else:
         self.send_upd_tx()
예제 #2
0
    def on_btnLocateCollateral_clicked(self, checked):
        break_scanning = False

        if not self.main_dlg.connect_hardware_wallet():
            return

        def do_break_scanning():
            nonlocal break_scanning
            break_scanning = True
            return False

        def check_break_scanning():
            nonlocal break_scanning
            return break_scanning

        def apply_utxo(utxo):
            self.masternode.collateralAddress = utxo.address
            self.edtCollateralAddress.setText(utxo.address)
            self.masternode.collateralBip32Path = utxo.bip32_path
            self.edtCollateralPath.setText(utxo.bip32_path)
            self.masternode.collateralTx = utxo.txid
            self.edtCollateralTxHash.setText(utxo.txid)
            self.masternode.collateralTxIndex = str(utxo.output_index)
            self.edtCollateralTxIndex.setText(str(utxo.output_index))
            self.update_ui_controls_state()
            self.set_modified()

        bip44_wallet = Bip44Wallet(self.app_config.hw_coin_name, self.main_dlg.hw_session,
                                   self.app_config.db_intf, self.crownd_intf, self.app_config.crown_network)

        utxos = WndUtils.run_thread_dialog(
            self.get_collateral_tx_address_thread,
            (bip44_wallet, check_break_scanning, self.edtCollateralAddress.text()),
            True, force_close_dlg_callback=do_break_scanning)

        if utxos:
            if len(utxos) == 1 and \
                    (not self.masternode.collateralAddress or
                     (utxos[0].address_obj and self.masternode.collateralAddress == utxos[0].address_obj.address)) \
                    and (not self.masternode.collateralTx or utxos[0].txid == self.masternode.collateralTx):
                apply_utxo(utxos[0])
                return

            dlg = ListCollateralTxsDlg(self, self.masternode, self.app_config, False, utxos)
            if dlg.exec_():
                utxo = dlg.get_selected_utxo()
                if utxo:
                    apply_utxo(utxo)
        else:
            if utxos is not None:
                WndUtils.warnMsg('Couldn\'t find any 10000 Crown UTXO in your wallet.')
예제 #3
0
    def on_btnLocateCollateral_clicked(self, checked):
        if not self.main_dlg.connect_hardware_wallet():
            return

        def apply_utxo(utxo):
            self.masternode.collateralAddress = utxo.address
            self.edtCollateralAddress.setText(utxo.address)
            self.masternode.collateralBip32Path = utxo.bip32_path
            self.edtCollateralPath.setText(utxo.bip32_path)
            self.masternode.collateralTx = utxo.txid
            self.edtCollateralTxHash.setText(utxo.txid)
            self.masternode.collateralTxIndex = str(utxo.output_index)
            self.edtCollateralTxIndex.setText(str(utxo.output_index))
            self.update_ui()
            self.set_modified()

        bip44_wallet = Bip44Wallet(self.app_config.hw_coin_name,
                                   self.main_dlg.hw_session,
                                   self.app_config.db_intf, self.dashd_intf,
                                   self.app_config.dash_network)

        utxos = WndUtils.run_thread_dialog(
            self.get_collateral_tx_address_thread, (bip44_wallet, ), True)
        if utxos:
            if len(
                    utxos
            ) == 1 and not self.masternode.collateralAddress and not self.masternode.collateralTx:
                used = False
                for mn in self.app_config.masternodes:
                    if utxos[0].address == mn.collateralAddress or mn.collateralTx + '-' + str(mn.collateralTxIndex) == \
                       utxos[0].txid + '-' + str(utxos[0].output_index):
                        used = True
                        break
                if not used:
                    apply_utxo(utxos[0])
                    return

            dlg = ListCollateralTxsDlg(self, self.masternode, self.app_config,
                                       False, utxos)
            if dlg.exec_():
                utxo = dlg.get_selected_utxo()
                if utxo:
                    apply_utxo(utxo)
        else:
            if utxos is not None:
                WndUtils.warnMsg(
                    'Couldn\'t find any 1000 Dash UTXO in your wallet.')
예제 #4
0
    def on_btnFindDMNTxHash_clicked(self, checked):
        if self.masternode and not self.updating_ui:
            found_protx = None
            if not ((self.masternode.ip and self.masternode.port) or
                    (self.masternode.collateralTx
                     and self.masternode.collateralTxIndex)):
                WndUtils.errorMsg(
                    'To be able to locate the deterministic masternode transaction you need to '
                    'provide the masternode ip + port or collateral tx + tx index.'
                )
                return

            try:
                txes = self.dashd_intf.protx('list', 'registered', True)
                for protx in txes:
                    state = protx.get('state')
                    if state:
                        if (state.get('addr') == self.masternode.ip + ':' + self.masternode.port) or \
                           (protx.get('collateralHash') == self.masternode.collateralTx and
                            str(protx.get('collateralIndex', '')) == self.masternode.collateralTxIndex):
                            found_protx = protx
                            break
            except Exception as e:
                pass

            if found_protx:
                if self.masternode.dmn_tx_hash == protx.get('proTxHash'):
                    WndUtils.infoMsg(
                        'You have te correct DMN TX hash in the masternode configuration.'
                    )
                else:
                    self.edtDMNTxHash.setText(protx.get('proTxHash'))
                    self.masternode.dmn_tx_hash = protx.get('proTxHash')
                    self.set_modified()
            else:
                WndUtils.warnMsg(
                    'Couldn\'t find this masternode in the list of registered deterministic masternodes.'
                )
            self.set_modified()