diff --git a/lightningd/jsonrpc.h b/lightningd/jsonrpc.h index 16fc01049fd7..1455891d49b3 100644 --- a/lightningd/jsonrpc.h +++ b/lightningd/jsonrpc.h @@ -22,7 +22,7 @@ enum command_mode { /* Context for a command (from JSON, but might outlive the connection!). */ /* FIXME: move definition into jsonrpc.c */ struct command { - /* Off json_cmd->commands */ + /* Off list jcon->commands */ struct list_node list; /* The global state */ struct lightningd *ld; diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 248090c81593..6294c70aa8fa 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -1193,12 +1193,8 @@ int main(int argc, char *argv[]) /* Tell plugins we're shutting down, closes the db for write access. */ shutdown_plugins(ld); - /* Clean up the JSON-RPC. This needs to happen in a DB transaction since - * it might actually be touching the DB in some destructors, e.g., - * unreserving UTXOs (see #1737) */ - db_begin_transaction(ld->wallet->db); + /* Cleanup JSON RPC separately: destructors assume some list_head * in ld */ tal_free(ld->jsonrpc); - db_commit_transaction(ld->wallet->db); /* Clean our our HTLC maps, since they use malloc. */ htlc_in_map_clear(&ld->htlcs_in); diff --git a/wallet/wallet.c b/wallet/wallet.c index b26ec943d823..ba4c8c3bb8cc 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -401,35 +401,8 @@ bool wallet_unreserve_output(struct wallet *w, OUTPUT_STATE_AVAILABLE); } -/** - * unreserve_utxo - Mark a reserved UTXO as available again - */ -static void unreserve_utxo(struct wallet *w, const struct utxo *unres) -{ - if (!wallet_update_output_status(w, &unres->outpoint, - OUTPUT_STATE_RESERVED, - OUTPUT_STATE_AVAILABLE)) { - fatal("Unable to unreserve output"); - } -} - -/** - * destroy_utxos - Destructor for an array of pointers to utxo - */ -static void destroy_utxos(const struct utxo **utxos, struct wallet *w) -{ - for (size_t i = 0; i < tal_count(utxos); i++) - unreserve_utxo(w, utxos[i]); -} - -void wallet_persist_utxo_reservation(struct wallet *w, const struct utxo **utxos) -{ - tal_del_destructor2(utxos, destroy_utxos, w); -} - void wallet_confirm_utxos(struct wallet *w, const struct utxo **utxos) { - tal_del_destructor2(utxos, destroy_utxos, w); for (size_t i = 0; i < tal_count(utxos); i++) { if (!wallet_update_output_status( w, &utxos[i]->outpoint, diff --git a/wallet/wallet.h b/wallet/wallet.h index ad2bcbfc0643..833f3ef60621 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -1411,13 +1411,6 @@ void add_unreleased_tx(struct wallet *w, struct unreleased_tx *utx); /* These will touch the db, so need to be explicitly freed. */ void free_unreleased_txs(struct wallet *w); -/* wallet_persist_utxo_reservation - Removes destructor - * - * Persists the reservation in the database (until a restart) - * instead of clearing the reservation when the utxo object - * is destroyed */ -void wallet_persist_utxo_reservation(struct wallet *w, const struct utxo **utxos); - /* wallet_unreserve_output - Unreserve a utxo * * We unreserve utxos so that they can be spent elsewhere.