SatoshiPortal / boltz-rust

Boltz client rust crate
https://docs.boltz.exchange
30 stars 19 forks source link

`LBtcSwapScriptV2::get_balance()` results in error #48

Closed ok300 closed 6 months ago

ok300 commented 6 months ago

Calling

https://github.com/SatoshiPortal/boltz-rust/blob/8c92a59e1c555616844d5acd7d3231a3119549bf/src/swaps/liquidv2.rs#L321

results in an error of type

Electrum(AllAttemptsErrored([SharedIOError(Kind(UnexpectedEof))])
i5hi commented 6 months ago

hey! yes, this is a known issue where electrum-rs doesnt' directly support all methods.

I would suggest not using get_balance and just use fetch_utxos instead. If you need balance, you can compute it from the utxos.

i5hi commented 6 months ago

even with fetch utxos, you will notice we cannot use the list_unspent method, instead we use script_get_history

ok300 commented 6 months ago

Interesting, thanks!

As a workaround, would it make sense to remove or deprecate LBtcSwapScriptV2::get_balance()? I'm thinking others could fall into the same trap.

i5hi commented 6 months ago

Yes. I will remove it.

i5hi commented 6 months ago

Thanks!