Blockstream / gdk

Blockstream Green Development Kit
Other
161 stars 59 forks source link

Need `electrum_tls` set to False #161

Open jblachly opened 2 years ago

jblachly commented 2 years ago

I am posting here as issue seems to affect all platforms tested (iOS; Mac OS), and configuration option causing problem on all platforms AFAICT is in this repository at: https://github.com/Blockstream/gdk/blob/fb8a9a0d0600212280c036a1a21e028202b5a3ad/src/network_parameters.cpp#L331

Description of Problem

I can't connect to a personal electrum server, which causes all sorts of unexpected failure behaviours across all platforms when creating or restoring wallets

Cause of problem

I believe this is because Green/GDK always forces Electrum TLS to be true, and I am running non-TLS only on port 50001.

Logs

GDK

Note electrum_url is electrs.local:50001, and electrum_tls is Bool(true).

[2022-04-16 13:07:46.813813] [gdk:debug] 46.813 INFO - create_session Object({"address_explorer_url": String("https://blockstream.info/address/"), "bech32_prefix": String("bc"), "bip21_prefix": String("bitcoin"), "cert_expiry_threshold": Number(1), "csv_buckets": Array([]), "development": Bool(false), "electrum_onion_url": String("omitted.onion:110"), "electrum_tls": Bool(true), "electrum_url": String("electrs.local:50001"), "liquid": Bool(false), "mainnet": Bool(true), "max_reorg_blocks": Number(144), "name": String("Bitcoin (Electrum)"), "network": String("electrum-mainnet"), "p2pkh_version": Number(0), "p2sh_version": Number(5), "pin_server_onion_url": ...

Electrs

[2022-04-16T17:17:08.200Z WARN  electrs::server] InvalidData on first line may indicate client attempted to connect using SSL when server expects unencrypted communication.
[2022-04-16T17:17:08.200Z WARN  electrs::thread] recv_loop thread failed: 0: recv failed
[2022-04-16T17:17:08.200Z WARN  electrs::thread] because: stream did not contain valid UTF-8

Setup details

Green Wallet, latest version from official channels on iOS and Mac OS

Electrs, git commit 1b4cc1ec0fd51caeea92da9d959a00805a4810a4 (latest)

Green and Electrs running on private network, not publicly exposed (hence no TLS)

Bitcoin mainnet

jgriffiths commented 2 years ago

Hi @jblachly ,

This looks like a wallet issue rather than gdk. You can override electrum_tls along with electrum_url in the network parameters, but for green-android, in crypto/src/main/java/com/blockstream/gdk/GreenWallet.kt:registerCustomNetwork() only electrum_url is being passed in.

cc @domegabri

jgriffiths commented 2 years ago

Confirming Qt and iOS are also affected.

jblachly commented 2 years ago

Hi @jblachly ,

This looks like a wallet issue rather than gdk. You can override electrum_tls along with electrum_url in the network parameters, but for green-android, in crypto/src/main/java/com/blockstream/gdk/GreenWallet.kt:registerCustomNetwork() only electrum_url is being passed in.

cc @domegabri

It is ultimately a wallet issue, but I thought beginning in GDK (where the parameter lies) would be the most reasonable way to open discussion with the development team, rather than creating separate identical issues for each of the wallet platforms.

jgriffiths commented 2 years ago

@jblachly Yes thanks for reporting here, @domegabri will coordinate with the wallet devs to get each updated. Thanks!