correctly initialize UTXO keychain kind
This commit is contained in:
parent
e1b037a921
commit
81851190f0
@ -242,17 +242,22 @@ impl Blockchain for RpcBlockchain {
|
||||
}
|
||||
}
|
||||
|
||||
let current_utxos: HashSet<LocalUtxo> = 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::<Result<_, Error>>()?;
|
||||
|
||||
let spent: HashSet<_> = known_utxos.difference(¤t_utxos).collect();
|
||||
for s in spent {
|
||||
|
Loading…
x
Reference in New Issue
Block a user