mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 23:24:21 +01:00
wallet: clean reserved inputs on startup.
We reserve inputs when we're going to send a transaction, but we don't unreserve them if we crash. This is most graphically demonstrated by the txprepare case, which makes it easier to trigger. Instead, we should query bitcoind to see whether the tx made it out or not, as we would do manually with dev-rescan-outputs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -736,6 +736,10 @@ int main(int argc, char *argv[])
|
||||
else if (max_blockheight != UINT32_MAX)
|
||||
max_blockheight -= ld->config.rescan;
|
||||
|
||||
/*~ Tell the wallet to start figuring out what to do for any reserved
|
||||
* unspent outputs we may have crashed with. */
|
||||
wallet_clean_utxos(ld->wallet, ld->topology->bitcoind);
|
||||
|
||||
/*~ That's all of the wallet db operations for now. */
|
||||
db_commit_transaction(ld->wallet->db);
|
||||
|
||||
|
||||
@@ -173,6 +173,9 @@ const char *version(void)
|
||||
/* Generated stub for wallet_blocks_heights */
|
||||
void wallet_blocks_heights(struct wallet *w UNNEEDED, u32 def UNNEEDED, u32 *min UNNEEDED, u32 *max UNNEEDED)
|
||||
{ fprintf(stderr, "wallet_blocks_heights called!\n"); abort(); }
|
||||
/* Generated stub for wallet_clean_utxos */
|
||||
void wallet_clean_utxos(struct wallet *w UNNEEDED, struct bitcoind *bitcoind UNNEEDED)
|
||||
{ fprintf(stderr, "wallet_clean_utxos called!\n"); abort(); }
|
||||
/* Generated stub for wallet_network_check */
|
||||
bool wallet_network_check(struct wallet *w UNNEEDED,
|
||||
const struct chainparams *chainparams UNNEEDED)
|
||||
|
||||
Reference in New Issue
Block a user