Skip to content

Feature Request: Return a structured error type instead of a bool on failed finalization #1939

@w3irdrobot

Description

@w3irdrobot

Describe the enhancement

finalize_psbt is where I noticed this pattern of returning a bool to represent if the finalization of a PSBT completed successfully. This is unhelpful to a developer since returning a bool does nothing except tell me what happened. There is nothing to tell me why. I can't react to specific forms of failure. I guess the expectation is that I would be able to check the transaction myself, but then the bool doesn't really do anything either then. Why wouldn't I just write something to check the transaction first and be confident that finalization occurred after that point?

My suggestion is to remove the bool return and instead update the signature to something like Result<(), SignerError> and update anywhere the process fails to instead fail earlier with a structured error that at least tells me where in the process the failure happened. This is a breaking change. Perhaps a middle ground to prevent a breaking change would instead be to keep the signature as is but just never return false. Instead, return errors where false would have been returned.

Use case

This would allow reacting to failures in the finalization process instead of just accepting the failure and crying myself to sleep at night.

Additional context

I don't mind working on this one since it is theoretically pretty straightforward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions