Skip to content

Commit 67031f8

Browse files
committed
Abort if we add a duplicate input
1 parent bde122f commit 67031f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning/src/ln/interactivetxs.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ impl NegotiationContext {
310310
};
311311
let prev_output =
312312
tx.output.get(msg.prevtx_out as usize).ok_or(AbortReason::PrevTxOutInvalid)?.clone();
313-
self.prevtx_outpoints.insert(input.previous_output.clone());
313+
if !self.prevtx_outpoints.insert(input.previous_output.clone()) {
314+
// We have added an input that already exists
315+
return Err(AbortReason::PrevTxOutInvalid);
316+
}
314317
self.inputs.insert(msg.serial_id, TxInputWithPrevOutput { input, prev_output });
315318
Ok(())
316319
}

0 commit comments

Comments
 (0)