db: we must always be in a transaction, remove nested, call fatal()

We save location where transaction was started, in case we try to nest.
There's now no error case; db_exec_mayfail() is the only one.

This means the tests need to override fatal() if they want to intercept
these errors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-11-01 11:51:56 +10:30
committed by Christian Decker
parent f4d27eefa1
commit 4fb472b7a7
8 changed files with 180 additions and 186 deletions

View File

@@ -287,8 +287,8 @@ static void json_delinvoice(struct command *cmd,
}
if (!wallet_invoice_remove(cmd->ld->wallet, i)) {
log_broken(cmd->ld->log, "Error attempting to remove invoice %"PRIu64": %s",
i->id, cmd->ld->wallet->db->err);
log_broken(cmd->ld->log, "Error attempting to remove invoice %"PRIu64,
i->id);
command_fail(cmd, "Database error");
return;
}