Xud: `./xud --db.xud2` (xud2 db doesn't exist) loads `xud` db

Created on 18 Aug 2018  路  4Comments  路  Source: ExchangeUnion/xud

How it is:
./xud --db.xud2 --rpc.port 1337 whereas xud2 doesn't exist leads to:

kilrau@ubuntu:~/xud/bin$ ./xud --db.xud2 --rpc.port 1337
8/17/2018, 6:04:24 PM [GLOBAL] info: config loaded
8/17/2018, 6:04:24 PM [GLOBAL] info: Local nodePubKey is 03b8575322792950c2921279a5ed4aea4af2f826e2c557b21ae9085fc91258532f
Executing (default): SELECT 1+1 AS result
8/17/2018, 6:04:24 PM [DB] info: connected to database. host:localhost port:3306 **database:xud**

How it should be:
If xud2 doesn't exist./xud --db.xud2

  • prints sth like {Couldn't find xud2 database, initializing new xud2 database with default values.}
  • initialize xud2 database with the same default values (seed nodes, currencies, pairs). and start xud
P2 bug command line (CLI)

All 4 comments

Right now you'd have to use --db.database xud2 to do what you're trying to do. But I agree that it's a little verbose, and maybe having --db xud2 would be a nice alias, I'll have to see how practical it would be to do that.

For now though, try it with the full --db.database xud2 command and see if it works for you, I don't think there's a bug because I start instances like that fairly often.

Making it --db xud2 doesn't work, maybe there's some hacky way to do it but I'm not going to dive into it right now. The simplest thing would be to add a single character alias, -d xud2. Let me know if that sounds good to you.

Ok, my bad not being able to type CLI args straight 馃憥

But shouldn't it rather throw --help and tell me there's something wrong with my arguments (doesn't exist) instead of just going ahead and execute xud with default values?

I think this is simply the behavior of the yargs package we're using for the command line tools, it doesn't show help if you specify a parameter that isn't defined, and I'm not seeing an easy way to do that from their docs. There are certain use cases (not ours) where this is desirable as you might want to be able to specify arbitrary parameters from the command line.

I think we should close this unless you think it's important, we'd probably have to fork yargs or look into using a different package for command line arguments which would involve some refactoring. Someone correct me if I'm wrong.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kilrau picture kilrau  路  5Comments

offerm picture offerm  路  4Comments

raladev picture raladev  路  4Comments

kilrau picture kilrau  路  4Comments

moshababo picture moshababo  路  5Comments