bdk icon indicating copy to clipboard operation
bdk copied to clipboard

InsufficientFunds is duplicated within coin_selection::Error and CreateTxError enums

Open e1a0a0ea opened this issue 1 year ago • 1 comments

Describe the bug
Both coin_selection::Error and CreateTxError enums have an InsufficientFunds member. It is quite confusion prone

Expected behavior
We shouldn't have duplicated enums

Proposed solution
keep only coin_selection::Error's member

e1a0a0ea avatar May 13 '24 07:05 e1a0a0ea

I ran into an issue while working on our wallet integration that I think is related to this thread.

When I try to create a PSBT on testnet or signet, I keep getting this error:

Error: Insufficient funds: 0 sat available of 11 sat needed

I understand why this check is important on mainnet (to more easily catch and handle low balance situations). But when I'm just trying to test stuff out on other networks, it just gets in the way.

What do you think about disabling this specific error for any network besides Network::Bitcoin? That way, we could generate PSBTs and test wallet compatibility more easily on testnets without this error getting in the way all the time. Maybe we could log a warning or print a message about the low balance instead?

Let me know your thoughts! I'm happy to submit a PR if you think this change would be helpful.

matthiasdebernardini avatar May 13 '24 17:05 matthiasdebernardini