Skip to content

Avoid panics in public methods if possible #784

Open
@sr-gi

Description

@sr-gi

Some public methods can lead to panics if called under certain conditions. While some of this may be permanent errors that the app cannot recover from, therefore panic-ing, some others may be handleable best with an Error, making it easier to catch both for Rust and foreign languages.

Here's a list of the ones I've found so far so (as of v0.0.12) we can discuss which one fall into which group.

  • KeysInterface
    • counterparty_pubkeys
    • counterparty_selected_contest_delay
    • holder_selected_contest_delay

All this panic due to calling unwrap on None for non-accepted channels.

ChannelMonitor::get_latest_holder_commitment_txn panics if called for non-accepted channels (?)
@devrandom mentioned this is changing for v0.0.13, so it may not apply after that.

ChannelManager::funding_transaction_generated panics if called for an already accepted channel.

May add more if I find any.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions