Skip to content

Commit 1892549

Browse files
committed
f avoid clone
1 parent 73b8e92 commit 1892549

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lightning/src/ln/interactivetxs.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,13 @@ impl InputOwned {
13611361
}
13621362
}
13631363

1364+
fn into_tx_in_with_prev_output(self) -> (TxIn, TxOut) {
1365+
match self {
1366+
InputOwned::Single(single) => (single.input, single.prev_output),
1367+
InputOwned::Shared(shared) => (shared.input, shared.prev_output),
1368+
}
1369+
}
1370+
13641371
fn prev_output(&self) -> &TxOut {
13651372
match self {
13661373
InputOwned::Single(single) => &single.prev_output,
@@ -1538,13 +1545,8 @@ impl InteractiveTxInput {
15381545

15391546
fn into_negotiated_input(self) -> NegotiatedTxInput {
15401547
let weight = self.input.estimate_input_weight();
1541-
let prev_output = self.input.prev_output().clone();
1542-
NegotiatedTxInput {
1543-
serial_id: self.serial_id,
1544-
txin: self.input.into_tx_in(),
1545-
weight,
1546-
prev_output,
1547-
}
1548+
let (txin, prev_output) = self.input.into_tx_in_with_prev_output();
1549+
NegotiatedTxInput { serial_id: self.serial_id, txin, weight, prev_output }
15481550
}
15491551
}
15501552

0 commit comments

Comments
 (0)