You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lightning/src/events/bump_transaction.rs
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -582,11 +582,25 @@ where
582
582
// match, but we still need to have at least one output in the transaction for it to be
583
583
// considered standard. We choose to go with an empty OP_RETURN as it is the cheapest
584
584
// way to include a dummy output.
585
-
log_debug!(self.logger,"Including dummy OP_RETURN output since an output is needed and a change output was not provided");
586
-
tx.output.push(TxOut{
587
-
value:Amount::ZERO,
588
-
script_pubkey:ScriptBuf::new_op_return(&[]),
589
-
});
585
+
if tx.input.len() <= 1{
586
+
// Transactions have to be at least 65 bytes in non-witness data, which we can run
587
+
// under if we have too few witness inputs.
588
+
log_debug!(self.logger,"Including large OP_RETURN output since an output is needed and a change output was not provided and the transaction is small");
589
+
debug_assert!(!tx.input.is_empty());
590
+
tx.output.push(TxOut{
591
+
value:Amount::ZERO,
592
+
// Minimum transaction size is 60 bytes, so we need a 5-byte script to get a
593
+
// 65 byte transaction. We do that as OP_RETURN <3 0 bytes, plus 1 byte len>.
594
+
script_pubkey:ScriptBuf::new_op_return(&[0,0,0]),
595
+
});
596
+
debug_assert_eq!(tx.base_size(),65);
597
+
}else{
598
+
log_debug!(self.logger,"Including dummy OP_RETURN output since an output is needed and a change output was not provided");
0 commit comments