Skip to content

Commit 42480ea

Browse files
committed
Bring less data around
1 parent 02c0ad2 commit 42480ea

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/blockchain/utils.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ fn save_transaction_details_and_utxos<D: BatchDatabase>(
308308
timestamp: u64,
309309
height: Option<u32>,
310310
updates: &mut dyn BatchOperations,
311-
utxo_deps: &HashMap<OutPoint, UTXO>,
311+
utxo_deps: &HashMap<OutPoint, OutPoint>,
312312
) -> Result<(), Error> {
313313
let tx = db
314314
.get_raw_tx(txid)?
@@ -343,8 +343,8 @@ fn save_transaction_details_and_utxos<D: BatchDatabase>(
343343
}
344344

345345
// removes conflicting UTXO if any (generated from same inputs, like for example RBF)
346-
if let Some(utxo) = utxo_deps.get(&input.previous_output) {
347-
updates.del_utxo(&utxo.outpoint)?;
346+
if let Some(outpoint) = utxo_deps.get(&input.previous_output) {
347+
updates.del_utxo(&outpoint)?;
348348
}
349349
}
350350

@@ -386,15 +386,15 @@ fn save_transaction_details_and_utxos<D: BatchDatabase>(
386386
fn utxos_deps<D: BatchDatabase>(
387387
db: &mut D,
388388
tx_raw_in_db: &HashMap<Txid, Transaction>,
389-
) -> Result<HashMap<OutPoint, UTXO>, Error> {
389+
) -> Result<HashMap<OutPoint, OutPoint>, Error> {
390390
let utxos = db.iter_utxos()?;
391391
let mut utxos_deps = HashMap::new();
392392
for utxo in utxos {
393393
let from_tx = tx_raw_in_db
394394
.get(&utxo.outpoint.txid)
395395
.ok_or_else(|| Error::TransactionNotFound)?;
396396
for input in from_tx.input.iter() {
397-
utxos_deps.insert(input.previous_output, utxo.clone());
397+
utxos_deps.insert(input.previous_output, utxo.outpoint);
398398
}
399399
}
400400
Ok(utxos_deps)

0 commit comments

Comments
 (0)