Exemple #1
0
    def onVerify(self):
        # check fields
        addy = self.ui.addressLineEdit.text().strip()
        if len(addy) == 0:
            mess = "No address inserted"
            myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - no address', mess)
            return
        if not checkPivxAddr(addy, True) and not checkPivxAddr(addy, False):
            mess = "PIVX address not valid. Insert valid PIVX address"
            myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - invalid address', mess)
            return
        if self.ui.messageTextEdt.document().isEmpty():
            mess = "No message inserted"
            myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - no message', mess)
            return
        if self.ui.signatureTextEdt.document().isEmpty():
            mess = "No signature inserted"
            myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - no signature', mess)
            return

        try:
            ok = ecdsa_verify_addr(self.ui.messageTextEdt.toPlainText(),
                                   self.ui.signatureTextEdt.toPlainText(),
                                   self.ui.addressLineEdit.text().strip())
        except Exception as e:
            mess = "Error decoding signature:\n" + str(e)
            myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - invalid signature', mess)
            ok = False
        if ok:
            mess = "<span style='color: green'>Signature OK"
        else:
            mess = "<span style='color: red'>Signature doesn't verify"
        mess = "<b>" + mess + "</span></b>"
        self.ui.resultLabel.setText(mess)
        self.ui.resultLabel.setVisible(True)
Exemple #2
0
 def onSendRewards(self):
     self.dest_addr = self.ui.destinationLine.text().strip()     
 
     # Check dongle
     printDbg("Checking HW device")
     if self.caller.hwStatus != 2:
         self.caller.myPopUp2(QMessageBox.Critical, 'PET4L - hw device check', "Connect to HW device first")
         printDbg("Unable to connect - hw status: %d" % self.caller.hwStatus)
         return None
     
     # Check destination Address      
     if not checkPivxAddr(self.dest_addr):
         self.caller.myPopUp2(QMessageBox.Critical, 'PET4L - PIVX address check', "Invalid Destination Address")
         return None
     
                 
     # LET'S GO
     printDbg("Sending from PIVX address  %s  to PIVX address  %s " % (self.curr_addr, self.dest_addr))
     if self.selectedRewards:                      
         self.currFee = self.ui.feeLine.value() * 1e8
         # connect signal
         self.caller.hwdevice.sigTxdone.connect(self.FinishSend)
         try:
             self.txFinished = False
             self.caller.hwdevice.prepare_transfer_tx(self.caller, self.curr_path, self.selectedRewards, self.dest_addr, self.currFee, self.rawtransactions)
         except Exception as e:
             err_msg = "Error while preparing transaction"
             printException(getCallerName(), getFunctionName(), err_msg, e.args)
     else:
         self.caller.myPopUp2(QMessageBox.Information, 'transaction NOT Sent', "No UTXO to send")         
Exemple #3
0
 def test_checkPivxAddr(self):
     # Generate Valid PIVX address
     pK = privkey_to_pubkey(generate_privkey())
     pivxAddr = pubkey_to_address(pK)
     # Check valid address
     self.assertTrue(checkPivxAddr(pivxAddr))
     # Check malformed address 1: change leading char
     pivxAddr2 = self.getRandomChar() + pivxAddr[1:]
     while pivxAddr2[0] == 'D':
         pivxAddr2 = self.getRandomChar() + pivxAddr[1:]
     self.assertFalse(checkPivxAddr(pivxAddr2))
     # Check malformed address 1: add random chars
     pivxAddr3 = pivxAddr
     for _ in range(10):
         pivxAddr3 += self.getRandomChar()
     self.assertFalse(checkPivxAddr(pivxAddr3))
Exemple #4
0
    def onSearchPK(self):
        fromAddress = self.ui.fromAddressRadioBtn.isChecked()
        self.hwAcc = self.ui.hwAccountSpingBox.value()
        self.currIsTestnet = self.ui.testnetCheckBox.isChecked()
        if fromAddress:
            addy = self.ui.addressLineEdit.text().strip()
            if len(addy) == 0:
                mess = "No address. Insert PIVX address first."
                myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - no address', mess)
                return

            if not checkPivxAddr(addy, self.currIsTestnet):
                net = "testnet" if self.currIsTestnet else "mainnet"
                mess = "PIVX address not valid. Insert valid PIVX %s address" % net
                myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - invalid address', mess)
                return

        # check hw connection
        while self.main_wnd.hwStatus != 2:
            mess = "HW device not connected. Try to connect?"
            ans = myPopUp(self.main_wnd, QMessageBox.Question, 'SPMT - hw check', mess)
            if ans == QMessageBox.No:
                return
            # re connect
            self.main_wnd.onCheckHw()

        # Go!
        if fromAddress:
            self.spath_found = False
            ThreadFuns.runInThread(self.findSpath, (0, 10), self.findSpath_done)
        else:
            self.spath_found = True
            self.spath = self.ui.spathSpinBox.value()
            self.findPubKey()
Exemple #5
0
    def onButtonSend(self):
        try:
            self.dest_addr = self.ui.edt_destination.text().strip()
            if self.useSwiftX():
                self.currFee = 0.01 * 1e8
            else:
                self.currFee = self.ui.feeLine.value() * 1e8
             
             # Check RPC & dongle  
            if not self.main_tab.caller.rpcConnected or self.main_tab.caller.hwStatus != 2:
                self.main_tab.caller.myPopUp2(QMessageBox.Critical, 'SPMT - hw/rpc device check', "Connect to RPC server and HW device first")
                return None
            
            # Check destination Address      
            if not checkPivxAddr(self.dest_addr):
                self.main_tab.caller.myPopUp2(QMessageBox.Critical, 'SPMT - PIVX address check', "The destination address is missing, or invalid.")
                return None

            # LET'S GO
            if len(self.rawtransactions) > 0:
                printDbg("Preparing transaction. Please wait...")
                self.ui.loadingLine.show()
                self.ui.loadingLinePercent.show()
                QApplication.processEvents()
                
                # save last destination address and swiftxCheck to cache
                self.main_tab.caller.parent.cache["lastAddress"] = self.dest_addr
                self.main_tab.caller.parent.cache["useSwiftX"] = self.useSwiftX()
                writeToFile(self.main_tab.caller.parent.cache, cache_File)
                    
                # re-connect signals
                try:
                    self.main_tab.caller.hwdevice.sigTxdone.disconnect()
                except:
                    pass
                try:
                    self.main_tab.caller.hwdevice.sigTxabort.disconnect()
                except:
                    pass
                try:
                    self.main_tab.caller.hwdevice.tx_progress.disconnect()
                except:
                    pass
                self.main_tab.caller.hwdevice.sigTxdone.connect(self.FinishSend)
                self.main_tab.caller.hwdevice.sigTxabort.connect(self.AbortSend)
                self.main_tab.caller.hwdevice.tx_progress.connect(self.updateProgressPercent)
    
                self.txFinished = False
                self.main_tab.caller.hwdevice.prepare_transfer_tx_bulk(self.main_tab.caller, self.rewards, self.dest_addr, self.currFee, self.rawtransactions, self.useSwiftX())
            else:
                self.main_tab.caller.myPopUp2(QMessageBox.Information, 'Transaction NOT sent', "No UTXO to send") 
                
        except DisconnectedException as e:
            self.main_tab.caller.hwStatus = 0
            self.main_tab.caller.updateHWleds()
            self.onButtonCancel()
                
        except Exception as e:
            err_msg = "Exception in onButtonSend"
            printException(getCallerName(), getFunctionName(), err_msg, e.args)
Exemple #6
0
    def onButtonSend(self):
        try:
            self.dest_addr = self.ui.edt_destination.text().strip()
            self.currFee = self.ui.feeLine.value() * 1e8

            # Check RPC & dongle
            if not self.main_tab.caller.rpcConnected or self.main_tab.caller.hwStatus != 2:
                self.main_tab.caller.myPopUp2(
                    QMessageBox.Critical, 'SPMT - hw/rpc device check',
                    "Connect to RPC server and HW device first")
                return None

            # Check destination Address
            if not checkPivxAddr(self.dest_addr):
                self.main_tab.caller.myPopUp2(
                    QMessageBox.Critical, 'SPMT - PIVX address check',
                    "The destination address is missing, or invalid.")
                return None

            printDbg("Preparing transaction. Please wait...")
            self.ui.loadingLine.show()
            self.main_tab.caller.parent.app.processEvents()
            # save destination address to cache
            if self.dest_addr != self.main_tab.caller.parent.cache.get(
                    "lastAddress"):
                self.main_tab.caller.parent.cache[
                    "lastAddress"] = self.dest_addr
                writeToFile(self.main_tab.caller.parent.cache, cache_File)

            # re-connect signals
            try:
                self.main_tab.caller.hwdevice.sigTxdone.disconnect()
                self.main_tab.caller.hwdevice.sigTxabort.disconnect()
            except:
                pass
            self.main_tab.caller.hwdevice.sigTxdone.connect(self.FinishSend)
            self.main_tab.caller.hwdevice.sigTxabort.connect(self.AbortSend)

            self.txFinished = False
            self.main_tab.caller.hwdevice.prepare_transfer_tx_bulk(
                self.main_tab.caller, self.rewards, self.dest_addr,
                self.currFee, self.rawtransactions)

        except Exception as e:
            err_msg = "Exception in SendRewards"
            printException(getCallerName(), getFunctionName(), err_msg, e.args)
    def SendRewards(self, useSwiftX, inputs=None, gui=None):
        # Default slots on tabRewards
        if gui is None:
            gui = self

        # re-connect signals
        try:
            self.caller.hwdevice.api.sigTxdone.disconnect()
        except:
            pass
        try:
            self.caller.hwdevice.api.sigTxabort.disconnect()
        except:
            pass
        try:
            self.caller.hwdevice.api.tx_progress.disconnect()
        except:
            pass
        self.caller.hwdevice.api.sigTxdone.connect(gui.FinishSend)
        self.caller.hwdevice.api.sigTxabort.connect(gui.AbortSend)
        self.caller.hwdevice.api.tx_progress.connect(gui.updateProgressPercent)

        # Check destination Address
        if not checkPivxAddr(self.dest_addr, self.caller.isTestnetRPC):
            myPopUp_sb(self.caller, "crit", 'SPMT - PIVX address check', "The destination address is missing, or invalid.")
            return None

        if inputs is None:
            # send from single path
            num_of_inputs = len(self.selectedRewards)
        else:
            # bulk send
            num_of_inputs = sum([len(x['utxos']) for x in inputs])
        ans = checkTxInputs(self.caller, num_of_inputs)
        if ans is None or ans == QMessageBox.No:
            # emit sigTxAbort and return
            self.caller.hwdevice.api.sigTxabort.emit()
            return None

        # LET'S GO
        if inputs is None:
            printDbg("Sending from PIVX address  %s  to PIVX address  %s " % (self.curr_addr, self.dest_addr))
        else:
            printDbg("Sweeping rewards to PIVX address %s " % self.dest_addr)
        printDbg("Preparing transaction. Please wait...")
        self.ui.loadingLine.show()
        self.ui.loadingLinePercent.show()
        QApplication.processEvents()

        # save last destination address and swiftxCheck to cache and persist to settings
        self.caller.parent.cache["lastAddress"] = persistCacheSetting('cache_lastAddress', self.dest_addr)
        self.caller.parent.cache["useSwiftX"] = persistCacheSetting('cache_useSwiftX', useSwiftX)

        try:
            self.txFinished = False
            if inputs is None:
                # send from single path
                self.caller.hwdevice.prepare_transfer_tx(self.caller,
                                                         self.curr_hwpath,
                                                         self.selectedRewards,
                                                         self.dest_addr,
                                                         self.currFee,
                                                         useSwiftX,
                                                         self.caller.isTestnetRPC)
            else:
                # bulk send
                self.caller.hwdevice.prepare_transfer_tx_bulk(self.caller,
                                                              inputs,
                                                              self.dest_addr,
                                                              self.currFee,
                                                              useSwiftX,
                                                              self.caller.isTestnetRPC)

        except DisconnectedException as e:
            self.caller.hwStatus = 0
            self.caller.updateHWleds()

        except Exception as e:
            err_msg = "Error while preparing transaction. <br>"
            err_msg += "Probably Blockchain wasn't synced when trying to fetch raw TXs.<br>"
            err_msg += "<b>Wait for full synchronization</b> then hit 'Clear/Reload'"
            printException(getCallerName(), getFunctionName(), err_msg, e.args)
Exemple #8
0
    def onSendRewards(self):
        self.dest_addr = self.ui.destinationLine.text().strip()

        # Check HW device
        if self.caller.hwStatus != 2:
            myPopUp_sb(self.caller, "crit", 'PET4L - hw device check',
                       "Connect to HW device first")
            printDbg(
                "Unable to connect to hardware device. The device status is: %d"
                % self.caller.hwStatus)
            return None

        # Check destination Address
        if not checkPivxAddr(self.dest_addr, self.caller.isTestnetRPC):
            myPopUp_sb(self.caller, "crit", 'PET4L - PIVX address check',
                       "The destination address is missing, or invalid.")
            return None

        # LET'S GO
        if self.selectedRewards:
            printDbg("Sending from PIVX address  %s  to PIVX address  %s " %
                     (self.curr_addr, self.dest_addr))
            printDbg("Preparing transaction. Please wait...")
            try:
                self.ui.loadingLine.show()
                self.ui.loadingLinePercent.show()
                QApplication.processEvents()
                self.currFee = self.ui.feeLine.value() * 1e8

                # save last destination address and swiftxCheck to cache and persist to settings
                self.caller.parent.cache["lastAddress"] = persistCacheSetting(
                    'cache_lastAddress', self.dest_addr)
                self.caller.parent.cache["useSwiftX"] = persistCacheSetting(
                    'cache_useSwiftX', self.useSwiftX())

                self.currFee = self.ui.feeLine.value() * 1e8
                # re-connect signals
                try:
                    self.caller.hwdevice.api.sigTxdone.disconnect()
                except:
                    pass
                try:
                    self.caller.hwdevice.api.sigTxabort.disconnect()
                except:
                    pass
                try:
                    self.caller.hwdevice.api.tx_progress.disconnect()
                except:
                    pass
                self.caller.hwdevice.api.sigTxdone.connect(self.FinishSend)
                self.caller.hwdevice.api.sigTxabort.connect(self.AbortSend)
                self.caller.hwdevice.api.tx_progress.connect(
                    self.updateProgressPercent)

                try:
                    self.txFinished = False
                    self.caller.hwdevice.prepare_transfer_tx(
                        self.caller, self.curr_path,
                        self.selectedRewards, self.dest_addr, self.currFee,
                        self.useSwiftX(), self.caller.isTestnetRPC)
                except DisconnectedException as e:
                    self.caller.hwStatus = 0
                    self.caller.updateHWleds()

                except Exception as e:
                    err_msg = "Error while preparing transaction. <br>"
                    err_msg += "Probably Blockchain wasn't synced when trying to fetch raw TXs.<br>"
                    err_msg += "<b>Wait for full synchronization</b> then hit 'Clear/Reload'"
                    printException(getCallerName(), getFunctionName(), err_msg,
                                   e.args)
            except Exception as e:
                print(e)
        else:
            myPopUp_sb(self.caller, "warn", 'Transaction NOT sent',
                       "No UTXO to send")
Exemple #9
0
    def onSendRewards(self):
        self.dest_addr = self.ui.destinationLine.text().strip()

        # Check dongle
        printDbg("Checking HW device")
        if self.caller.hwStatus != 2:
            self.caller.myPopUp2(QMessageBox.Critical,
                                 'SPMT - hw device check',
                                 "Connect to HW device first")
            printDbg("Unable to connect - hw status: %d" %
                     self.caller.hwStatus)
            return None

        # Check destination Address
        if not checkPivxAddr(self.dest_addr):
            self.caller.myPopUp2(QMessageBox.Critical,
                                 'SPMT - PIVX address check',
                                 "Invalid Destination Address")
            return None

        # Check spending collateral
        if (not self.ui.collateralHidden
                and self.ui.rewardsList.box.collateralRow is not None
                and self.ui.rewardsList.box.item(
                    self.ui.rewardsList.box.collateralRow, 0).isSelected()):
            warning1 = "Are you sure you want to transfer the collateral?"
            warning2 = "Really?"
            warning3 = "Take a deep breath. Do you REALLY want to transfer your collateral?"
            ans = self.caller.myPopUp(QMessageBox.Warning, 'SPMT - warning',
                                      warning1)
            if ans == QMessageBox.No:
                return None
            else:
                ans2 = self.caller.myPopUp(QMessageBox.Warning,
                                           'SPMT - warning', warning2)
                if ans2 == QMessageBox.No:
                    return None
                else:
                    ans3 = self.caller.myPopUp(QMessageBox.Critical,
                                               'SPMT - warning', warning3)
                    if ans3 == QMessageBox.No:
                        return None

        # LET'S GO
        if self.selectedRewards:
            printDbg("Sending from PIVX address  %s  to PIVX address  %s " %
                     (self.curr_addr, self.dest_addr))
            printDbg("Preparing transaction. Please wait...")
            self.currFee = self.ui.feeLine.value() * 1e8
            # connect signal
            self.caller.hwdevice.sigTxdone.connect(self.FinishSend)
            try:
                self.txFinished = False
                self.caller.hwdevice.prepare_transfer_tx(
                    self.caller, self.curr_path, self.selectedRewards,
                    self.dest_addr, self.currFee, self.rawtransactions)
            except Exception as e:
                err_msg = "Error while preparing transaction. <br>"
                err_msg += "Probably Blockchain wasn't synced when trying to fetch raw TXs.<br>"
                err_msg += "<b>Wait for full synchronization</b> then hit 'Clear/Reload'"
                printException(getCallerName(), getFunctionName(), err_msg,
                               e.args)
        else:
            self.caller.myPopUp2(QMessageBox.Information,
                                 'transaction NOT Sent', "No UTXO to send")
Exemple #10
0
    def onSendRewards(self):
        self.dest_addr = self.ui.destinationLine.text().strip()

        # Check HW device
        if self.caller.hwStatus != 2:
            myPopUp_sb(self.caller, "crit", 'SPMT - hw device check', "Connect to HW device first")
            printDbg("Unable to connect to hardware device. The device status is: %d" % self.caller.hwStatus)
            return None

        # Check destination Address
        if not checkPivxAddr(self.dest_addr, self.caller.isTestnetRPC):
            myPopUp_sb(self.caller, "crit", 'SPMT - PIVX address check', "The destination address is missing, or invalid.")
            return None

        # Check spending collateral
        if (not self.ui.collateralHidden and
                self.ui.rewardsList.box.collateralRow is not None and
                self.ui.rewardsList.box.item(self.ui.rewardsList.box.collateralRow, 0).isSelected() ):
            warning1 = "Are you sure you want to transfer the collateral?"
            warning2 = "Really?"
            warning3 = "Take a deep breath. Do you REALLY want to transfer your collateral?"
            ans = myPopUp(self.caller, "warn", 'SPMT - warning', warning1)
            if ans == QMessageBox.No:
                return None
            else:
                ans2 = myPopUp(self.caller, "warn", 'SPMT - warning', warning2)
                if ans2 == QMessageBox.No:
                    return None
                else:
                    ans2 = myPopUp(self.caller, "crit", 'SPMT - warning', warning3)
                    if ans2 == QMessageBox.No:
                        return None

        # LET'S GO
        if self.selectedRewards:
            printDbg("Sending from PIVX address  %s  to PIVX address  %s " % (self.curr_addr, self.dest_addr))
            printDbg("Preparing transaction. Please wait...")
            self.ui.loadingLine.show()
            self.ui.loadingLinePercent.show()
            QApplication.processEvents()

            # save last destination address and swiftxCheck to cache and persist to settings
            self.caller.parent.cache["lastAddress"] = persistCacheSetting('cache_lastAddress', self.dest_addr)
            self.caller.parent.cache["useSwiftX"] = persistCacheSetting('cache_useSwiftX', self.useSwiftX())

            self.currFee = self.ui.feeLine.value() * 1e8
            # re-connect signals
            try:
                self.caller.hwdevice.api.sigTxdone.disconnect()
            except:
                pass
            try:
                self.caller.hwdevice.api.sigTxabort.disconnect()
            except:
                pass
            try:
                self.caller.hwdevice.api.tx_progress.disconnect()
            except:
                pass
            self.caller.hwdevice.api.sigTxdone.connect(self.FinishSend)
            self.caller.hwdevice.api.sigTxabort.connect(self.AbortSend)
            self.caller.hwdevice.api.tx_progress.connect(self.updateProgressPercent)

            try:
                self.txFinished = False
                self.caller.hwdevice.prepare_transfer_tx(self.caller, self.curr_hwpath, self.selectedRewards, self.dest_addr, self.currFee, self.useSwiftX(), self.caller.isTestnetRPC)

            except DisconnectedException as e:
                self.caller.hwStatus = 0
                self.caller.updateHWleds()

            except Exception as e:
                err_msg = "Error while preparing transaction. <br>"
                err_msg += "Probably Blockchain wasn't synced when trying to fetch raw TXs.<br>"
                err_msg += "<b>Wait for full synchronization</b> then hit 'Clear/Reload'"
                printException(getCallerName(), getFunctionName(), err_msg, e.args)
        else:
            myPopUp_sb(self.caller, "warn", 'Transaction NOT sent', "No UTXO to send")
Exemple #11
0
    def onButtonSend(self):
        try:
            self.dest_addr = self.ui.edt_destination.text().strip()
            self.currFee = self.ui.feeLine.value() * 1e8

             # Check RPC & HW device
            if not self.main_tab.caller.rpcConnected or self.main_tab.caller.hwStatus != 2:
                myPopUp_sb(self.main_tab.caller, "crit", 'SPMT - hw/rpc device check', "Connect to RPC server and HW device first")
                return None

            # Check destination Address
            if not checkPivxAddr(self.dest_addr, self.main_tab.caller.isTestnetRPC):
                myPopUp_sb(self.main_tab.caller, "crit", 'SPMT - PIVX address check', "The destination address is missing, or invalid.")
                return None

            # LET'S GO
            if sum([len(x['utxos']) for x in self.rewardsArray]) > 0:
                printDbg("Preparing transaction. Please wait...")
                self.ui.loadingLine.show()
                self.ui.loadingLinePercent.show()
                QApplication.processEvents()

                # save last destination address and swiftxCheck to cache and persist to settings
                self.main_tab.caller.parent.cache["lastAddress"] = persistCacheSetting('cache_lastAddress', self.dest_addr)
                self.main_tab.caller.parent.cache["useSwiftX"] = persistCacheSetting('cache_useSwiftX', self.useSwiftX())

                # re-connect signals
                try:
                    self.main_tab.caller.hwdevice.api.sigTxdone.disconnect()
                except:
                    pass
                try:
                    self.main_tab.caller.hwdevice.api.sigTxabort.disconnect()
                except:
                    pass
                try:
                    self.main_tab.caller.hwdevice.api.tx_progress.disconnect()
                except:
                    pass
                self.main_tab.caller.hwdevice.api.sigTxdone.connect(self.FinishSend)
                self.main_tab.caller.hwdevice.api.sigTxabort.connect(self.AbortSend)
                self.main_tab.caller.hwdevice.api.tx_progress.connect(self.updateProgressPercent)

                self.txFinished = False
                self.main_tab.caller.hwdevice.prepare_transfer_tx_bulk(self.main_tab.caller,
                                                                       self.rewardsArray,
                                                                       self.dest_addr,
                                                                       self.currFee,
                                                                       self.useSwiftX(),
                                                                       self.main_tab.caller.isTestnetRPC)
            else:
                myPopUp_sb(self.main_tab.caller, "warn", 'Transaction NOT sent', "No UTXO to send")

        except DisconnectedException as e:
            self.main_tab.caller.hwStatus = 0
            self.main_tab.caller.updateHWleds()
            self.onButtonCancel()

        except Exception as e:
            err_msg = "Exception in onButtonSend"
            printException(getCallerName(), getFunctionName(), err_msg, e)
Exemple #12
0
    def onSendRewards(self):
        self.dest_addr = self.ui.destinationLine.text().strip() 
    
        # Check dongle
        printDbg("Checking HW device")
        if self.caller.hwStatus != 2:
            self.caller.myPopUp2(QMessageBox.Critical, 'SPMT - hw device check', "Connect to HW device first")
            printDbg("Unable to connect to hardware device. The device status is: %d" % self.caller.hwStatus)
            return None
        
        # Check destination Address      
        if not checkPivxAddr(self.dest_addr):
            self.caller.myPopUp2(QMessageBox.Critical, 'SPMT - PIVX address check', "The destination address is missing, or invalid.")
            return None
        
        # Check spending collateral
        if (not self.ui.collateralHidden and
                self.ui.rewardsList.box.collateralRow is not None and
                self.ui.rewardsList.box.item(self.ui.rewardsList.box.collateralRow, 0).isSelected() ): 
            warning1 = "Are you sure you want to transfer the collateral?"
            warning2 = "Really?"
            warning3 = "Take a deep breath. Do you REALLY want to transfer your collateral?"
            ans = self.caller.myPopUp(QMessageBox.Warning, 'SPMT - warning', warning1)
            if ans == QMessageBox.No:
                return None
            else:
                ans2 = self.caller.myPopUp(QMessageBox.Warning, 'SPMT - warning', warning2)
                if ans2 == QMessageBox.No:
                    return None
                else:
                    ans3 = self.caller.myPopUp(QMessageBox.Critical, 'SPMT - warning', warning3)
                    if ans3 == QMessageBox.No:
                        return None
                    
        # LET'S GO    
        if self.selectedRewards: 
            printDbg("Sending from PIVX address  %s  to PIVX address  %s " % (self.curr_addr, self.dest_addr))
            printDbg("Preparing transaction. Please wait...")
            self.ui.loadingLine.show()
            self.ui.loadingLinePercent.show()
            QApplication.processEvents()            
            
            # save last destination address and swiftxCheck to cache
            self.caller.parent.cache["lastAddress"] = self.dest_addr
            self.caller.parent.cache["useSwiftX"] = self.useSwiftX()
            writeToFile(self.caller.parent.cache, cache_File)            
            
            self.currFee = self.ui.feeLine.value() * 1e8            

            try:
                self.txFinished = False
                self.caller.hwdevice.prepare_transfer_tx(self.caller, self.curr_path, self.selectedRewards, self.dest_addr, self.currFee, self.rawtransactions, self.useSwiftX())
            
            except DisconnectedException as e:
                self.caller.hwStatus = 0
                self.caller.updateHWleds()
                
            except Exception as e:
                err_msg = "Error while preparing transaction. <br>"
                err_msg += "Probably Blockchain wasn't synced when trying to fetch raw TXs.<br>" 
                err_msg += "<b>Wait for full synchronization</b> then hit 'Clear/Reload'"
                printException(getCallerName(), getFunctionName(), err_msg, e.args)
        else:
            self.caller.myPopUp2(QMessageBox.Information, 'Transaction NOT sent', "No UTXO to send")