Applying fix for the body of the txn not containing a fee.

This commit is contained in:
Alexander Blair
2017-10-13 08:36:37 -07:00
parent e0152b8c46
commit 5d31708abf
+6 -6
View File
@@ -110,10 +110,10 @@ function Payee(amount, address, paymentID, bitcoin) {
let payee = this;
debug("Payment Details: " + JSON.stringify(paymentDetails));
paymentQueue.push(paymentDetails, function (body) {
if (body.fee && body.fee > 10) {
if (typeof body.tx_hash !== 'undefined') {
debug("Successful payment sent to: " + identifier);
global.mysql.query("INSERT INTO transactions (bitcoin, address, payment_id, xmr_amt, transaction_hash, mixin, fees, payees) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
[0, address, paymentID, amount, body.tx_hash.match(hexChars)[0], global.config.payout.mixIn, body.fee, 1]).then(function (result) {
[0, address, paymentID, amount, body.tx_hash.match(hexChars)[0], global.config.payout.mixIn, global.config.payout.fee, 1]).then(function (result) {
payee.transactionID = result.insertId;
payee.trackPayment();
});
@@ -142,10 +142,10 @@ function Payee(amount, address, paymentID, bitcoin) {
debug("Payment Details: " + JSON.stringify(paymentDetails));
paymentQueue.push(paymentDetails, function (body) {
if (body.fee && body.fee > 10) {
if (typeof body.tx_hash !== 'undefined') {
debug("Successful payment sent to: " + identifier);
global.mysql.query("INSERT INTO transactions (bitcoin, address, xmr_amt, transaction_hash, mixin, fees, payees) VALUES (?, ?, ?, ?, ?, ?, ?)",
[0, address, amount, body.tx_hash.match(hexChars)[0], global.config.payout.mixIn, body.fee, 1]).then(function (result) {
[0, address, amount, body.tx_hash.match(hexChars)[0], global.config.payout.mixIn, global.config.payout.fee, 1]).then(function (result) {
payee.transactionID = result.insertId;
payee.trackPayment();
});
@@ -217,7 +217,7 @@ function makePayments() {
console.log("Paying out: " + paymentDetails.destinations.length + " people");
paymentQueue.push(paymentDetails, function (body) { //jshint ignore:line
// This is the only section that could potentially contain multiple txns. Lets do this safely eh?
if (body.fee && body.fee > 10) {
if (typeof body.tx_hash !== 'undefined') {
debug("Made it to the SQL insert for transactions");
let totalAmount = 0;
paymentDetails.destinations.forEach(function (payeeItem) {
@@ -225,7 +225,7 @@ function makePayments() {
totalAmount += payeeObjects[payeeItem.address].fee;
});
global.mysql.query("INSERT INTO transactions (bitcoin, address, payment_id, xmr_amt, transaction_hash, mixin, fees, payees) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
[0, null, null, totalAmount, body.tx_hash.match(hexChars)[0], global.config.payout.mixIn, body.fee, paymentDetails.destinations.length]).then(function (result) {
[0, null, null, totalAmount, body.tx_hash.match(hexChars)[0], global.config.payout.mixIn, global.config.payout.fee, paymentDetails.destinations.length]).then(function (result) {
paymentDetails.destinations.forEach(function (payeeItem) {
payee = payeeObjects[payeeItem.address];
payee.transactionID = result.insertId;