From: Riccardo Casatta Date: Tue, 1 Jun 2021 14:19:32 +0000 (+0200) Subject: correctly initialize UTXO keychain kind X-Git-Tag: v0.9.0~22^2~5 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/memory/enum.MessageSignatureError.html?a=commitdiff_plain;h=81851190f037d81680c8b6a6e235cea10a4cb79c;p=bdk correctly initialize UTXO keychain kind --- diff --git a/src/blockchain/rpc.rs b/src/blockchain/rpc.rs index f272246d..ea5b8dd1 100644 --- a/src/blockchain/rpc.rs +++ b/src/blockchain/rpc.rs @@ -242,17 +242,22 @@ impl Blockchain for RpcBlockchain { } } - let current_utxos: HashSet = current_utxo + let current_utxos: HashSet<_> = current_utxo .into_iter() - .map(|u| LocalUtxo { - outpoint: OutPoint::new(u.txid, u.vout), - txout: TxOut { - value: u.amount.as_sat(), - script_pubkey: u.script_pub_key, - }, - keychain: KeychainKind::External, + .map(|u| { + Ok(LocalUtxo { + outpoint: OutPoint::new(u.txid, u.vout), + keychain: db + .get_path_from_script_pubkey(&u.script_pub_key)? + .ok_or(Error::TransactionNotFound)? + .0, + txout: TxOut { + value: u.amount.as_sat(), + script_pubkey: u.script_pub_key, + }, + }) }) - .collect(); + .collect::>()?; let spent: HashSet<_> = known_utxos.difference(¤t_utxos).collect(); for s in spent {