@@ -1459,48 +1459,48 @@ impl<SP: Deref> Channel<SP> where
1459
1459
}
1460
1460
}
1461
1461
1462
- pub fn tx_add_input(&mut self, msg: &msgs::TxAddInput) -> InteractiveTxMessageSendResult {
1462
+ pub fn tx_add_input(&mut self, msg: &msgs::TxAddInput) -> Result< InteractiveTxMessageSendResult, &'static str> {
1463
1463
match &mut self.phase {
1464
- ChannelPhase::UnfundedV2(chan) => chan.tx_add_input(msg),
1464
+ ChannelPhase::UnfundedV2(chan) => Ok( chan.tx_add_input(msg) ),
1465
1465
#[cfg(splicing)]
1466
- ChannelPhase::Funded(chan) => chan.tx_add_input(msg),
1467
- _ => panic! ("Got tx_add_input in an invalid phase"),
1466
+ ChannelPhase::Funded(chan) => Ok( chan.tx_add_input(msg) ),
1467
+ _ => Err ("Got tx_add_input in an invalid phase"),
1468
1468
}
1469
1469
}
1470
1470
1471
- pub fn tx_add_output(&mut self, msg: &msgs::TxAddOutput) -> InteractiveTxMessageSendResult {
1471
+ pub fn tx_add_output(&mut self, msg: &msgs::TxAddOutput) -> Result< InteractiveTxMessageSendResult, &'static str> {
1472
1472
match &mut self.phase {
1473
- ChannelPhase::UnfundedV2(chan) => chan.tx_add_output(msg),
1473
+ ChannelPhase::UnfundedV2(chan) => Ok( chan.tx_add_output(msg) ),
1474
1474
#[cfg(splicing)]
1475
- ChannelPhase::Funded(chan) => chan.tx_add_output(msg),
1476
- _ => panic! ("Got tx_add_output in an invalid phase"),
1475
+ ChannelPhase::Funded(chan) => Ok( chan.tx_add_output(msg) ),
1476
+ _ => Err ("Got tx_add_output in an invalid phase"),
1477
1477
}
1478
1478
}
1479
1479
1480
- pub fn tx_remove_input(&mut self, msg: &msgs::TxRemoveInput) -> InteractiveTxMessageSendResult {
1480
+ pub fn tx_remove_input(&mut self, msg: &msgs::TxRemoveInput) -> Result< InteractiveTxMessageSendResult, &'static str> {
1481
1481
match &mut self.phase {
1482
- ChannelPhase::UnfundedV2(chan) => chan.tx_remove_input(msg),
1482
+ ChannelPhase::UnfundedV2(chan) => Ok( chan.tx_remove_input(msg) ),
1483
1483
#[cfg(splicing)]
1484
- ChannelPhase::Funded(chan) => chan.tx_remove_input(msg),
1485
- _ => panic! ("Got tx_remove_input in an invalid phase"),
1484
+ ChannelPhase::Funded(chan) => Ok( chan.tx_remove_input(msg) ),
1485
+ _ => Err ("Got tx_remove_input in an invalid phase"),
1486
1486
}
1487
1487
}
1488
1488
1489
- pub fn tx_remove_output(&mut self, msg: &msgs::TxRemoveOutput) -> InteractiveTxMessageSendResult {
1489
+ pub fn tx_remove_output(&mut self, msg: &msgs::TxRemoveOutput) -> Result< InteractiveTxMessageSendResult, &'static str> {
1490
1490
match &mut self.phase {
1491
- ChannelPhase::UnfundedV2(chan) => chan.tx_remove_output(msg),
1491
+ ChannelPhase::UnfundedV2(chan) => Ok( chan.tx_remove_output(msg) ),
1492
1492
#[cfg(splicing)]
1493
- ChannelPhase::Funded(chan) => chan.tx_remove_output(msg),
1494
- _ => panic! ("Got tx_remove_output in an invalid phase"),
1493
+ ChannelPhase::Funded(chan) => Ok( chan.tx_remove_output(msg) ),
1494
+ _ => Err ("Got tx_remove_output in an invalid phase"),
1495
1495
}
1496
1496
}
1497
1497
1498
- pub fn tx_complete(&mut self, msg: &msgs::TxComplete) -> HandleTxCompleteResult {
1498
+ pub fn tx_complete(&mut self, msg: &msgs::TxComplete) -> Result< HandleTxCompleteResult, &'static str> {
1499
1499
match &mut self.phase {
1500
- ChannelPhase::UnfundedV2(chan) => chan.tx_complete(msg),
1500
+ ChannelPhase::UnfundedV2(chan) => Ok( chan.tx_complete(msg) ),
1501
1501
#[cfg(splicing)]
1502
- ChannelPhase::Funded(chan) => chan.tx_complete(msg),
1503
- _ => panic! ("Got tx_complete in an invalid phase"),
1502
+ ChannelPhase::Funded(chan) => Ok( chan.tx_complete(msg) ),
1503
+ _ => Err ("Got tx_complete in an invalid phase"),
1504
1504
}
1505
1505
}
1506
1506
0 commit comments