Skip to content

Commit

Permalink
Refactor Status::sync_confirmed a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
romanz committed Nov 5, 2021
1 parent 2228c4e commit a738662
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,15 @@ impl ScriptHashStatus {
return None;
}
cache.add_tx(*txid, move || tx);
cache.add_proof(blockhash, *txid, || Proof::create(&funding_txids, pos));
Some((pos, txid, funding_outputs))
})
.collect();

let block_entries = result.entry(blockhash).or_default();
for (pos, txid, funding_outputs) in found {
cache.add_proof(blockhash, *txid, || Proof::create(&funding_txids, pos));
outpoints.extend(make_outpoints(txid, &funding_outputs));
result
.entry(blockhash)
.or_default()
block_entries
.entry(pos)
.or_insert_with(|| TxEntry::new(*txid))
.outputs = funding_outputs;
Expand All @@ -375,15 +374,14 @@ impl ScriptHashStatus {
return None;
}
cache.add_tx(*txid, move || tx);
cache.add_proof(blockhash, *txid, || Proof::create(&spending_txids, pos));
Some((pos, txid, spent_outpoints))
})
.collect();

let block_entries = result.entry(blockhash).or_default();
for (pos, txid, spent_outpoints) in found {
cache.add_proof(blockhash, *txid, || Proof::create(&spending_txids, pos));
result
.entry(blockhash)
.or_default()
block_entries
.entry(pos)
.or_insert_with(|| TxEntry::new(*txid))
.spent = spent_outpoints;
Expand Down

0 comments on commit a738662

Please sign in to comment.