From 2c636d00e96a3f2e7b82bde0b32d4e97e2f07ab7 Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Wed, 21 Aug 2019 18:32:57 -0400 Subject: [PATCH] fix balance updates --- src/pool.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pool.c b/src/pool.c index e9bf390..1f90da3 100644 --- a/src/pool.c +++ b/src/pool.c @@ -572,7 +572,12 @@ balance_add(const char *address, uint64_t amount, MDB_txn *parent) { log_trace("Adding new balance entry"); MDB_val new_val = { sizeof(amount), (void*)&amount }; - mdb_cursor_put(cursor, &key, &new_val, MDB_APPEND); + rc = mdb_cursor_put(cursor, &key, &new_val, 0); + if (rc != 0) + { + err = mdb_strerror(rc); + log_error("%s", err); + } } else if (rc == 0) { @@ -663,6 +668,8 @@ payout_block(block_t *block, MDB_txn *parent) rc = balance_add(share->address, amount, txn); if (rc != 0) { + err = mdb_strerror(rc); + log_error("%s", err); mdb_cursor_close(cursor); mdb_txn_abort(txn); return rc;