We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 855bcb7 commit 45fc1c1Copy full SHA for 45fc1c1
lwk_wollet/src/cache.rs
@@ -166,12 +166,23 @@ impl Cache {
166
}
167
168
pub fn spent(&self) -> Result<HashSet<OutPoint>, Error> {
169
+ // Dummy spent outputs are outputs that are not in height map, but we have to consider them
170
+ // for the utxo mode.
171
+ let dummy_spent: Vec<OutPoint> = self
172
+ .all_txs
173
+ .iter()
174
+ .filter(|(_, tx)| tx.output.is_empty()) // Only dummy tx have no outputs
175
+ .map(|(_, tx)| tx.input.iter().map(|i| i.previous_output))
176
+ .flatten()
177
+ .collect();
178
+
179
Ok(self
180
.heights
181
.keys()
182
.filter_map(|txid| self.all_txs.get(txid))
183
.flat_map(|tx| tx.input.iter())
184
.map(|i| i.previous_output)
185
+ .chain(dummy_spent)
186
.collect())
187
188
0 commit comments