diff --git a/wallet/db.c b/wallet/db.c index 5aec8358d..8151241a4 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -235,6 +235,7 @@ bool db_begin_transaction(struct db *db) assert(db->in_transaction); return db->in_transaction; } + db->in_transaction++; return false; } @@ -242,7 +243,7 @@ bool db_commit_transaction(struct db *db) { assert(db->in_transaction); bool ret = db_exec(__func__, db, "COMMIT;"); - db->in_transaction = false; + db->in_transaction--; return ret; } @@ -250,7 +251,7 @@ bool db_rollback_transaction(struct db *db) { assert(db->in_transaction); bool ret = db_exec(__func__, db, "ROLLBACK;"); - db->in_transaction = false; + db->in_transaction--; return ret; } diff --git a/wallet/db.h b/wallet/db.h index 3c84f8a15..d5d7da1df 100644 --- a/wallet/db.h +++ b/wallet/db.h @@ -15,7 +15,7 @@ struct db { char *filename; - bool in_transaction; + unsigned int in_transaction; const char *err; sqlite3 *sql; };