Merge #586: bitcoind: create watchonly wallet with load_on_startup = true

8ae597fec11c2fdd7873c9bd011a75a5fbbd9301 bitcoind: create watchonly wallet with load_on_startup = true (Antoine Poinsot)

Pull request description:

  Upon startup bitcoind will update loaded wallets before pruning historical chain data.

  This is a trivial fix for people using an aggressively pruned `bitcoind` to not be forced to `-reindex` if they haven't started their Liana wallet for longer than their prune target allows for.

  See https://github.com/wizardsardine/liana/issues/570#issuecomment-1658108967 for a discussion about this.

ACKs for top commit:
  darosior:
    self-ACK 8ae597fec11c2fdd7873c9bd011a75a5fbbd9301

Tree-SHA512: 022ab1224d182372963a6ceb9baaf13aecc568b9d0d546d490ac1fb15450a8c70611b4b25a3a8a2f6cf613e28e8b54c8f5e4c55a4da723927ffc4c6e179f2a63
This commit is contained in:
Antoine Poinsot 2023-07-31 13:05:19 +02:00
commit 3ccbb68017
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -512,13 +512,19 @@ impl BitcoinD {
}
fn create_wallet(&self, wallet_path: String) -> Result<(), String> {
// NOTE: we set load_on_startup to make sure the wallet will get updated before the
// historical blocks are deleted in case the bitcoind is pruned.
let res = self
.make_fallible_node_request(
"createwallet",
&params!(
Json::String(wallet_path),
Json::Bool(true), // watchonly
Json::Bool(true), // blank
Json::Bool(true), // watchonly
Json::Bool(true), // blank
Json::Null, // passphrase
Json::Bool(false), // avoid_reuse
Json::Bool(true), // descriptors
Json::Bool(true) // load_on_startup
),
)
.map_err(|e| e.to_string())?;