File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ class Config {
8181 discover : true ,
8282 discoverminutes : 60 * 12 , // 12 hours
8383 detectexternalip : false ,
84- port : 8885 , // X = 88, U = 85 in ASCII
84+ port : this . getDefaultP2pPort ( ) ,
8585 addresses : [ ] ,
8686 } ;
8787 this . rpc = {
@@ -191,6 +191,7 @@ class Config {
191191 // update defaults based on the xudir and network from the args or config file
192192 this . logpath = this . getDefaultLogPath ( ) ;
193193 this . dbpath = this . getDefaultDbPath ( ) ;
194+ this . p2p . port = this . getDefaultP2pPort ( ) ;
194195 this . setDefaultMacaroonPaths ( ) ;
195196
196197 if ( configProps ) {
@@ -263,6 +264,21 @@ class Config {
263264 }
264265 }
265266
267+ private getDefaultP2pPort = ( ) => {
268+ switch ( this . network ) {
269+ case XuNetwork . MainNet :
270+ return 8885 ; // X = 88, U = 85 in ASCII
271+ case XuNetwork . TestNet :
272+ return 18885 ;
273+ case XuNetwork . SimNet :
274+ return 28885 ;
275+ case XuNetwork . RegTest :
276+ return 38885 ;
277+ default :
278+ throw new Error ( 'unrecognized network' ) ;
279+ }
280+ }
281+
266282 private getDefaultDbPath = ( ) => {
267283 return path . join ( this . xudir , `xud-${ this . network } .db` ) ;
268284 }
You can’t perform that action at this time.
0 commit comments