log failures of balance transfers

This commit is contained in:
Jethro Grassie 2019-08-23 16:53:29 -04:00
parent af9b9c8953
commit 6471c6a20a
No known key found for this signature in database
GPG key ID: DE8ED755616565BB

View file

@ -1729,9 +1729,9 @@ rpc_on_wallet_transferred(const char* data, rpc_callback_t *callback)
int ec = json_object_get_int(code); int ec = json_object_get_int(code);
const char *em = json_object_get_string(message); const char *em = json_object_get_string(message);
log_error("Error (%d) with wallet transfer: %s", ec, em); log_error("Error (%d) with wallet transfer: %s", ec, em);
goto cleanup;
} }
log_info("Payout transfer successfull"); else
log_info("Payout transfer successfull");
int rc; int rc;
char *err; char *err;
@ -1772,6 +1772,11 @@ rpc_on_wallet_transferred(const char* data, rpc_callback_t *callback)
} }
uint64_t current_amount = *(uint64_t*)val.mv_data; uint64_t current_amount = *(uint64_t*)val.mv_data;
current_amount -= payment->amount; current_amount -= payment->amount;
if (error)
{
log_warn("Error seen on transfer for %s with amount %"PRIu64,
payment->address, payment->amount);
}
MDB_val new_val = {sizeof(current_amount), (void*)&current_amount}; MDB_val new_val = {sizeof(current_amount), (void*)&current_amount};
rc = mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT); rc = mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT);
if (rc != 0) if (rc != 0)