breez / c-breez

20 stars 2 forks source link

Old BTC address format support #570

Closed Nackoo2000 closed 12 months ago

Nackoo2000 commented 1 year ago

We need to support sending to the old format of the BTC address.

image

ubbabeck commented 1 year ago

It recognises the address and successfully validates it.

2023-07-10T10:16:36.192659 :: V :: BitcoinAddressTextFormField :: Calling validator for bc1qpyncvfcknjx9f7xmm0jhtj2mzcelf7ccjkenn2ejk9z8yvlf33hserkwkm ::  :: 0 ::  ::  :: 
2023-07-10T10:16:36.193189 :: V :: AccountBloc :: isValidBitcoinAddress: bc1qpyncvfcknjx9f7xmm0jhtj2mzcelf7ccjkenn2ejk9z8yvlf33hserkwkm ::  :: 0 ::  ::  :: 
2023-07-10T10:16:36.195308 :: V :: BitcoinAddressTextFormField :: Address bc1qpyncvfcknjx9f7xmm0jhtj2mzcelf7ccjkenn2ejk9z8yvlf33hserkwkm validation result ValidatorHolder{valid: true, inLock: true, locked true, hash: 634443779} ::  :: 0 ::  ::  :: 

when trying to broadcast the transaction it returns the following error:

2023-07-10T10:18:53.264574 :: D :: BreezBridge :: node-logs: DEBUG   plugin-gl-plugin-internal: Read response from JSON-RPC: {\"error\":{\"code\":301,\"message\":\"Could not afford all using all 0 available UTXOs: all short\"},\"id\":0,\"jsonrpc\":\"2.0\"} ::  :: 0 ::  ::  ::
Nackoo2000 commented 1 year ago

The old format is not recognised when scanning from the balance screen I have to scan it from Send>Send to BTC Address>Scan

https://github.com/breez/c-breez/assets/127208515/eb0e22e5-b952-46b3-818d-8c0c9d755a2b

ubbabeck commented 1 year ago

[Edit ] We need to make sure that sending scanning works to all of the following addresses.

ok300 commented 1 year ago

On SDK level, they work. I tested sending to all 4 a few days ago.

ubbabeck commented 1 year ago

Awesome, in that case it's must be an issue in how we handle it when scanning.

Nackoo2000 commented 1 year ago

I am not sure if this is for this issue or a different one: This is when scanning a BTC address generated in BreezM. Scanned with BreezC When I deleted the text "BITCOIN:" before the text the payment was made successfully image

ubbabeck commented 1 year ago

I am not sure if this is for this issue or a different one: This is when scanning a BTC address generated in BreezM. Scanned with BreezC When I deleted the text "BITCOIN:" before the text the payment was made successfully

This can be an issue on it's own since it is tied to bip 21(https://bitcoinqr.dev/). Though not sure if this is something we should add here in c-breez or add to the breez-sdk.

ademar111190 commented 1 year ago

I see two different things here:

ok300 commented 12 months ago

The SDK accepts "bitcoin:..." addresses as valid and removes the prefix in the returned BitcoinAddressData (see unit test).

It does the same for other BIP-21 URI params, like label or amount.

ademar111190 commented 12 months ago

@Nackoo2000 Can you confirm the address with "bitcoin:" prefix are working for you? On my tests it is working after the changes on https://github.com/breez/c-breez/pull/665

Nackoo2000 commented 12 months ago

Yes all good.