opendax icon indicating copy to clipboard operation
opendax copied to clipboard

deposit_coin_address uses wrong RPC information

Open kde99 opened this issue 4 years ago • 3 comments
trafficstars

Hello everyone.

I am trying to set an instance up but I have a weird problem. In tower I changed the default ETH chain's client to geth (because im using geth, its running on the same server as docker but not in docker), also changed the RPC url to http://localhost:8545. The problem is deposit_coin_address (docker instance) keeps requesting from parity:8545 (which is obviously incorrect).

So what I tried so far:

  • check the db instance if it's even saved (yes it is saved)
  • restarted deposit_coin_address docker instance (no it didn't work, is it even pulling it from the db?)
  • rake service:all (it does recreate it but still uses the wrong RPC url)
  • check tower again (it doesnt even show up in tower correctly but in the db it's correct so what??)

docker logs testing_deposit_coin_address_1:

{"level":"ERROR","time":"2021-07-27 10:30:56","message":"#<Peatio::Wallet::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"}
{"level":"ERROR","time":"2021-07-27 10:30:56","message":"/home/app/lib/peatio/ethereum/wallet.rb:39:in `rescue in create_address!'\n/home/app/lib/peatio/ethereum/wallet.rb:32:in `create_address!'\n/home/app/app/services/wallet_service.rb:12:in `create_address!'\n/home/app/app/workers/amqp/deposit_coin_address.rb:36:in `block (2 levels) in process'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/locking/pessimistic.rb:84:in `block in with_lock'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'\n/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/transactions.rb:212:in `transaction'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/transactions.rb:301:in `transaction'\n/opt/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/locking/pessimistic.rb:82:in `with_lock'\n/home/app/app/workers/amqp/deposit_coin_address.rb:32:in `block in process'\n/home/app/app/workers/amqp/deposit_coin_address.rb:31:in `tap'\n/home/app/app/workers/amqp/deposit_coin_address.rb:31:in `process'\nlib/daemons/amqp_daemon.rb:63:in `block (2 levels) in <main>'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/consumer.rb:56:in `call'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/channel.rb:1768:in `block in handle_frameset'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/consumer_work_pool.rb:108:in `block (2 levels) in run_loop'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/consumer_work_pool.rb:103:in `loop'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/consumer_work_pool.rb:103:in `block in run_loop'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/consumer_work_pool.rb:102:in `catch'\n/opt/vendor/bundle/ruby/2.6.0/gems/bunny-2.14.4/lib/bunny/consumer_work_pool.rb:102:in `run_loop'"}

How could I make deposit_coin_address realize that parity:8545 doesn't exist in ANY config?

kde99 avatar Jul 27 '21 10:07 kde99

Update:

Looks like a docker issue I can't access any of the parent's stuff from inside (docker docs says i should be through a special url which also doesn't work). Using the server's IP blockchain scanning works but deposit_coin_address still isn't updated with the new RPC address.

Now the error is: {"level":"ERROR","time":"2021-07-28 15:35:02","message":"#<Peatio::Wallet::MissingSettingError: Uri setting is missing>"}

kde99 avatar Jul 28 '21 15:07 kde99

So finally found a partial fix:

  • go to "templates/compose/daemons.yaml.erb"
  • then change the following
x-daemon: &peatio-daemon
  image: "<%= @config['images']['peatio'] %>"
  restart: always
  env_file:
    - ../config/peatio.env
  volumes:
    - ../config/peatio:/opt/peatio/config:ro
  extra_hosts:
  - "parity:IP_OF_GETH_INSTANCE"

if you are running geth on the same pc (but not in docker) then you need the IP of the docker0 interface on your host pc (ip a will give you).

  • rake service:all (probably doing daemons is enough though but let's be sure)
  • now deposit_coin_address will think that parity is at that IP

I still have no idea why deposit_coin_address doesn't load the IP from the db but this is solution that works for now for me until I can finally find something better.

kde99 avatar Aug 27 '21 21:08 kde99

Here is simple trick

  1. Make sure your uri right, example http://username:password@ip:port
  2. add this code on your .coin/coin.conf
  3. rpcallowip=0.0.0.0/0
  4. rpcbind=0.0.0.0
  5. reset your coin, coin-cli stop and coind

MonkeyD-Core avatar Aug 09 '22 00:08 MonkeyD-Core