ExchangeUnion / xud

Exchange Union Daemon 🔁 ⚡️
https://exchangeunion.com
GNU Affero General Public License v3.0
115 stars 49 forks source link

feat: ignore unavailable swap clients on create (#1815) #2004

Closed rsercano closed 3 years ago

rsercano commented 3 years ago

attempts to fix #1815

But as a followup I don't know if this affects next startups when L2 is setup properly @sangaman

erkarl commented 3 years ago

Can we initialize all swap clients after the initial create now?

sangaman commented 3 years ago

Can we initialize all swap clients after the initial create now?

Yes, thanks to #1973 we should automatically initialize wallets on future xud unlocks, so requiring all wallets/swap clients to be online upon initial create isn't that big a deal any more. So this change would make sense to me now.

kilrau commented 3 years ago

Concept ACK

rsercano commented 3 years ago

@raladev are you sure you have the correct changeset? I have the exact same condition and don't get an error:

image image

raladev commented 3 years ago

checked once more, same result. Screenshot from 2020-11-25 21-55-33 Screenshot from 2020-11-25 21-55-21

Yeap, im sure that I am in same changeset.

native@ubuntu:~/xud$ git log -1
commit f7b955b89236861c33226e14bc105ae77c372f24 (HEAD -> fix/create-node-ignore-unavailable-clients, origin/fix/create-node-ignore-unavailable-clients)
Author: rsercano <ozdemirsercan27@gmail.com>
Date:   Tue Nov 24 12:51:05 2020 +0300

    fix: ignores unavailable swap clients during create node (#1815)

U have a little bit differrent condition, in your case both lnd are not avaliable, in my case only lndbtc is not avaliable.

My steps:

  1. share lnd port through simnet.conf - https://docs.exchangeunion.com/development/developer-guide
  2. bash xud.sh
  3. wait for neutrino sync
  4. close utils
  5. docker rm -f simnet_xud_1
  6. docker stop simnet_lndbtc_1
  7. git clone https://github.com/ExchangeUnion/xud.git
  8. mkdir .xud & cd ./xud
  9. nano xud.conf - set pathes to lndbtc and lndltc certs
    
    loglevel = "trace"
    noencrypt = false

[http] host = "localhost" port = 8887

[lnd.BTC] cltvdelta = 40 disable = false host = "localhost" nomacaroons = false port = 30009 certpath = "/home/native/.xud-docker/simnet/data/lndbtc/tls.cert" macaroonpath = "/home/native/.xud-docker/simnet/data/lndbtc/data/chain/bitcoin/simnet/admin.macaroon"

[lnd.LTC] cltvdelta = 576 disable = false host = "localhost" nomacaroons = false port = 31009 certpath = "/home/native/.xud-docker/simnet/data/lndltc/tls.cert" macaroonpath = "/home/native/.xud-docker/simnet/data/lndltc/data/chain/litecoin/simnet/admin.macaroon"

[raiden] disable = true

[connext] disable = false host = "localhost" port = 25040

[debug] testing = false


9. cd ~/xud
10. git checkout fix/create-node-ignore-unavailable-clients
11. npm install & npm run compile & npm run compile:seedutil  https://docs.exchangeunion.com/development/native-installation
12. sudo ./bin/xud
13. sudo ./bin/xucli create
rsercano commented 3 years ago

Thanks for sharing all steps briefly Roman I will check it.

25 Kas 2020 Çar 22:06 tarihinde raladev notifications@github.com şunu yazdı:

checked once more, same result. Screenshot from 2020-11-25 21-55-33 https://user-images.githubusercontent.com/29906866/100270494-33ad5080-2f69-11eb-9ad9-9515ab0090c4.png Screenshot from 2020-11-25 21-55-21 https://user-images.githubusercontent.com/29906866/100270499-35771400-2f69-11eb-92b9-008142564341.png

Yeap, im sure that am in same changeset.

native@ubuntu:~/xud$ git log -1 commit f7b955b89236861c33226e14bc105ae77c372f24 (HEAD -> fix/create-node-ignore-unavailable-clients, origin/fix/create-node-ignore-unavailable-clients) Author: rsercano ozdemirsercan27@gmail.com Date: Tue Nov 24 12:51:05 2020 +0300

fix: ignores unavailable swap clients during create node (#1815)

U have a little bit differrent condition, in your case both lnd are not avaliable, in my case only lndbtc is not avaliable.

My steps:

  1. share lnd port through simnet.conf - https://docs.exchangeunion.com/development/developer-guide

    1. bash xud.sh
    2. wait for neutrino sync
    3. close utils
    4. docker rm -f simnet_xud_1
    5. docker stop simnet_lndbtc_1
    6. git clone https://github.com/ExchangeUnion/xud.git
    7. mkdir .xud & cd ./xud
    8. nano xud.conf - set pathes to lndbtc and lndltc certs

loglevel = "trace" noencrypt = false

[http] host = "localhost" port = 8887

[lnd.BTC] cltvdelta = 40 disable = false host = "localhost" nomacaroons = false port = 30009 certpath = "/home/native/.xud-docker/simnet/data/lndbtc/tls.cert" macaroonpath = "/home/native/.xud-docker/simnet/data/lndbtc/data/chain/bitcoin/simnet/admin.macaroon"

[lnd.LTC] cltvdelta = 576 disable = false host = "localhost" nomacaroons = false port = 31009 certpath = "/home/native/.xud-docker/simnet/data/lndltc/tls.cert" macaroonpath = "/home/native/.xud-docker/simnet/data/lndltc/data/chain/litecoin/simnet/admin.macaroon"

[raiden] disable = true

[connext] disable = false host = "localhost" port = 25040

[debug] testing = false

  1. cd ~/xud
  2. git checkout fix/create-node-ignore-unavailable-clients
  3. npm install & npm run compile & npm run compile:seedutil https://docs.exchangeunion.com/development/native-installation
  4. sudo ./bin/xud
  5. sudo ./bin/xucli create

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ExchangeUnion/xud/pull/2004#issuecomment-733897729, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3YYMH2QWOYGSEEW7H2ST3SRVIVFANCNFSM4UAUWLLQ .

rsercano commented 3 years ago

I changed how initWallets in SwapClientManager behave while initializing by removing throw error phrase, therefore it won't throw while initializing a wallet per swap client and create/restore commands should continue as is, if one of the clients is not available for initializing.

@raladev @sangaman

kilrau commented 3 years ago

Could you please give this another look? @sangaman

sangaman commented 3 years ago

This error 24/11/2020 09:32:03.099 [LND-BTC] error: AssertionError [ERR_ASSERTION]: awaitWalletInit should not be called from a status besides Initialized or Unlocked is unrelated to this PR - I'll look into it separately. It's a bit of an edge case but I can reproduce it by setting up a new node with an enabled lnd in the config that is unreachable. It's setting the state of that lnd to WaitingUnlock when it should really be disconnected, so it tries to unlock it anyway and hits that exception.

Sercan's workaround to remove the throw line is fine for now, but I think it would make sense to reenable it once the above is addressed.