-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XU networks support #827
XU networks support #827
Conversation
Great!! Indeed I would say |
# Conflicts: # lib/Config.ts # test/p2p/sanity.spec.ts
@kilrau done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not reviewing or discussing this change sooner but I finally went through this PR and the associated issue closely. I'll probably need to review again with a fresh set of eyes since this touches a lot of things. A couple of points in addition to the comments below:
-
I think it may make sense to use separate databases for each network, rather than just differentiating the nodes by network in the nodes table. The reason being that each network is entirely distinct from one another, and data that applies to one network is unrelated to data for another network. As an example, we wouldn't want testnet data contaminating/bloating the mainnet database.
-
I don't fully understand the need for the
lnNetwork
in addition to the xu network. Aren't these always going to be the same? -
I sort of liked the way the commands arg for network was before with
-n
, although I get the appeal of being able to write out--testnet
and such so I'm ok with leaving it if that's what others prefer. However it differs from the way you'd specify the network in the config file, which is still likenetwork = "simnet"
(and where having to write outtestnet = true
is a little clunkier). A neater solution might be to convert the boolean arguments to a stringnetwork
argument within thexud
bin file before passing it to the xud server code. You can also use yargsbuilt-in
conflicts` API so that yargs will throw an error if a user tries to pass in more than one network value rather than having to check for that yourself. It would look like this:
.conflicts('mainnet', ['testnet', 'simnet', 'regtest'])
.conflicts('testnet', ['mainnet', 'simnet', 'regtest'])
// same for last two
Agree! |
Sounds good, will do.
See my comment here.
Thanks, i’ll check it out. |
You could also consider using a separate schema per network if having separate DBs is too much work. |
# Conflicts: # lib/p2p/Peer.ts # lib/p2p/Pool.ts # lib/p2p/errors.ts # test/p2p/sanity.spec.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I'd like to test this manually a bit before merging since it's a big PR but the code looks good. Thanks for making those changes.
break; | ||
} | ||
} | ||
} | ||
|
||
private getDefaultDbPath = () => { | ||
return path.join(this.xudir, 'xud.db'); | ||
return path.join(this.xudir, `xud-${this.network}.db`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought but we can keep the xud.db
filename for mainnet and only specify a network if it's not mainnet, so this would be something like:
this.network === XuNetwork.MainNet ? 'xud.db' : `xud-${this.network}.db`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't mind it being more explicit for each network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i'd rather have it be more explicit.
break; | ||
} | ||
} | ||
} | ||
|
||
private getDefaultDbPath = () => { | ||
return path.join(this.xudir, 'xud.db'); | ||
return path.join(this.xudir, `xud-${this.network}.db`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't mind it being more explicit for each network.
@@ -0,0 +1,16 @@ | |||
import * as db from '../../db/types'; | |||
|
|||
export default [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice to have these seeds on a network level :).
Also, needs a rebase. |
# Conflicts: # lib/db/DB.ts # lib/p2p/Peer.ts # lib/p2p/Pool.ts # test/unit/DB.spec.ts
@sangaman I wasn't sure if you still want to manually test this, so i'll leave it open for you to merge. |
Thanks. I'm merging this now and will do #869 shortly after since they both involve breaking db changes. |
Closes #781.
This required less changes then I expected, since we're not directly communicating with the underlying blockchains clients, but only with the 2nd layer clients. It might require more work on the docker config though (@reliveyy).
mainnet
&testnet
seed nodes are empty for nown
arg (-n=testnet
for example). @kilrau let me know if you want me to change that to be used as a boolean signal, e.g.--testnet
BREAKING CHANGE:
nodes
database table scheme.