From bbe7a03300fc8b4358fd13a52334d4e6be15b52b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 1 Nov 2017 11:40:48 +1030 Subject: [PATCH] wallet: use db_exec_mayfail() for wallet_add_utxo. This is the only case where we actually rely on the db to ensure we don't do something twice: don't error out if it fails. Signed-off-by: Rusty Russell --- wallet/wallet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wallet/wallet.c b/wallet/wallet.c index eaa668204..4c18035aa 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -24,6 +24,7 @@ struct wallet *wallet_new(const tal_t *ctx, struct log *log) return wallet; } +/* We actually use the db constraints to uniquify, so OK if this fails. */ bool wallet_add_utxo(struct wallet *w, struct utxo *utxo, enum wallet_output_type type) { @@ -36,7 +37,7 @@ bool wallet_add_utxo(struct wallet *w, struct utxo *utxo, sqlite3_bind_int(stmt, 4, type); sqlite3_bind_int(stmt, 5, output_state_available); sqlite3_bind_int(stmt, 6, utxo->keyindex); - return db_exec_prepared(w->db, stmt); + return db_exec_prepared_mayfail(w->db, stmt); } /**