Beispiel #1
0
    def faultHandler(self, tx, error, e=""):
        #handle transfers to the gateway that have problems
        amount = tx['amount'] / pow(10, self.config['tn']['decimals'])
        timestampStr = sharedfunc.getnow()

        if error == "noattachment":
            self.db.insError(tx['sender'], "", tx['id'], "", amount,
                             "no attachment found on transaction")
            print("ERROR: " + timestampStr +
                  " - Error: no attachment found on transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "txerror":
            targetAddress = base58.b58decode(tx['attachment']).decode()
            self.db.insError(tx['sender'], targetAddress, tx['id'], "", amount,
                             "tx error, possible incorrect address", str(e))
            print("ERROR: " + timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "senderror":
            targetAddress = base58.b58decode(tx['attachment']).decode()
            self.db.insError(tx['sender'], targetAddress, tx['id'], "", amount,
                             "tx error, check exception error", str(e))
            print("ERROR: " + timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")
    def faultHandler(self, tx, error, e=""):
        #handle transfers to the gateway that have problems
        amount = float(tx['amount'])
        timestampStr = sharedfunc.getnow()

        if error == "noattachment":
            self.db.insError('unknown', '', '', tx['txid'], amount,
                             'empty memo field')
            print("ERROR: " + timestampStr + " - Error: empty memo field " +
                  tx['sender'] + " - check errors table.")

        if error == "notunnel":
            self.db.insError(tx['sender'], '', '', tx['txid'], amount,
                             'no tunnel found for sender')
            print("ERROR: " + timestampStr +
                  " - Error: no tunnel found for transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "txerror":
            targetAddress = tx['recipient']
            self.db.insError(tx['sender'], targetAddress, '', tx['txid'],
                             amount, 'tx error, possible incorrect address',
                             str(e))
            print("ERROR: " + timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "senderror":
            targetAddress = tx['recipient']
            self.db.insError(tx['sender'], targetAddress, '', tx['txid'],
                             amount, 'tx error, check exception error', str(e))
            print("ERROR: " + timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")
    def faultHandler(self, tx, error, e=""):
        # handle transfers to the gateway that have problems
        amount = tx['amount']
        timestampStr = sharedfunc.getnow()

        if error == "notunnel":
            cursor = self.dbCon.cursor()
            cursor.execute(
                'INSERT INTO errors ("sourceAddress", "targetAddress", "tnTxId", "ethTxId", "amount", "error") VALUES ("'
                + tx['sender'] + '", "", "", "' + tx['id'] + '", "' +
                str(amount) + '", "no tunnel found for sender")')
            self.dbCon.commit()
            print(timestampStr +
                  " - Error: no tunnel found for transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "txerror":
            targetAddress = tx['recipient']
            cursor = self.dbCon.cursor()
            cursor.execute(
                'INSERT INTO errors ("sourceAddress", "targetAddress", "tnTxId", "ethTxId", "amount", "error", "exception") VALUES ("'
                + tx['sender'] + '", "' + targetAddress + '", "", "' +
                tx['id'] + '", "' + str(amount) +
                '", "tx error, possible incorrect address", "' + str(e) + '")')
            self.dbCon.commit()
            print(timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "senderror":
            targetAddress = tx['recipient']
            cursor = self.dbCon.cursor()
            cursor.execute(
                'INSERT INTO errors ("sourceAddress", "targetAddress", "tnTxId", "ethTxId", "amount", "error", "exception") VALUES ("'
                + tx['sender'] + '", "' + targetAddress + '", "", "' +
                tx['id'] + '", "' + str(amount) +
                '", "tx error, check exception error", "' + str(e) + '")')
            self.dbCon.commit()
            print(timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")
    def faultHandler(self, tx, error, e=""):
        #handle transfers to the gateway that have problems
        amount = tx['amount'] / pow(10, self.config['tn']['decimals'])
        timestampStr = sharedfunc.getnow()

        if error == "noattachment":
            cursor = self.dbCon.cursor()
            cursor.execute(
                'INSERT INTO errors ("sourceAddress", "targetAddress", "tnTxId", "wavesTxId", "amount", "error") VALUES ("'
                + tx['sender'] + '", "", "' + tx['id'] + '", "", "' +
                str(amount) + '", "no attachment found on transaction")')
            self.dbCon.commit()
            print(timestampStr +
                  " - Error: no attachment found on transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "txerror":
            targetAddress = base58.b58decode(tx['attachment']).decode()
            cursor = self.dbCon.cursor()
            cursor.execute(
                'INSERT INTO errors ("sourceAddress", "targetAddress", "tnTxId", "wavesTxId", "amount", "error", "exception") VALUES ("'
                + tx['sender'] + '", "' + targetAddress + '", "' + tx['id'] +
                '", "", "' + str(amount) +
                '", "tx error, possible incorrect address", "' + str(e) + '")')
            self.dbCon.commit()
            print(timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")

        if error == "senderror":
            targetAddress = base58.b58decode(tx['attachment']).decode()
            cursor = self.dbCon.cursor()
            cursor.execute(
                'INSERT INTO errors ("sourceAddress", "targetAddress", "tnTxId", "wavesTxId", "amount", "error", "exception") VALUES ("'
                + tx['sender'] + '", "' + targetAddress + '", "' + tx['id'] +
                '", "", "' + str(amount) +
                '", "tx error, check exception error", "' + str(e) + '")')
            self.dbCon.commit()
            print(timestampStr +
                  " - Error: on outgoing transaction for transaction from " +
                  tx['sender'] + " - check errors table.")