Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
destream-blockchain
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
destream-blockchain
Commits
6cde68e8
Commit
6cde68e8
authored
Feb 14, 2019
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix API ports
parent
0370b7af
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
4 deletions
+40
-4
ApiSettings.cs
Sources/Stratis.Bitcoin.Features.Api/ApiSettings.cs
+20
-2
DeStreamNetworkExtensions.cs
...es/Stratis.Bitcoin/Utilities/DeStreamNetworkExtensions.cs
+17
-0
NetworkExtensions.cs
Sources/Stratis.Bitcoin/Utilities/NetworkExtensions.cs
+3
-2
No files found.
Sources/Stratis.Bitcoin.Features.Api/ApiSettings.cs
View file @
6cde68e8
...
...
@@ -25,6 +25,12 @@ namespace Stratis.Bitcoin.Features.Api
/// <summary>The default port used by the API when the node runs on the Stratis testnet network.</summary>
public
const
int
TestStratisApiPort
=
38221
;
/// <summary>The default port used by the API when the node runs on the DeStream network.</summary>
public
const
int
DefaultDeStreamApiPort
=
56864
;
/// <summary>The default port used by the API when the node runs on the DeStream test network.</summary>
public
const
int
TestDeStreamApiPort
=
56865
;
/// <summary>The default port used by the API when the node runs on the Stratis network.</summary>
public
const
string
DefaultApiHost
=
"http://localhost"
;
...
...
@@ -113,11 +119,23 @@ namespace Stratis.Bitcoin.Features.Api
private
static
int
GetDefaultPort
(
Network
network
)
{
if
(
network
.
IsBitcoin
())
{
return
network
.
IsTest
()
?
TestBitcoinApiPort
:
DefaultBitcoinApiPort
;
}
if
(
network
.
IsStratis
())
{
return
network
.
IsTest
()
?
TestStratisApiPort
:
DefaultStratisApiPort
;
}
if
(
network
.
IsDeStream
())
{
return
network
.
IsTest
()
?
TestDeStreamApiPort
:
DefaultDeStreamApiPort
;
}
throw
new
ConfigurationException
(
$"Invalid network
{
network
.
Name
}
."
);
}
/// <summary>Prints the help information on how to configure the API settings to the logger.</summary>
/// <param name="network">The network to use.</param>
public
static
void
PrintHelp
(
Network
network
)
...
...
Sources/Stratis.Bitcoin/Utilities/DeStreamNetworkExtensions.cs
0 → 100644
View file @
6cde68e8
using
NBitcoin
;
namespace
Stratis.Bitcoin.Utilities
{
public
static
partial
class
NetworkExtensions
{
public
static
bool
IsStratis
(
this
Network
network
)
{
return
network
.
Name
.
ToLowerInvariant
().
Contains
(
"stratis"
);
}
public
static
bool
IsDeStream
(
this
Network
network
)
{
return
network
.
Name
.
ToLowerInvariant
().
Contains
(
"destream"
);
}
}
}
\ No newline at end of file
Sources/Stratis.Bitcoin/Utilities/NetworkExtensions.cs
View file @
6cde68e8
...
...
@@ -5,7 +5,7 @@ namespace Stratis.Bitcoin.Utilities
/// <summary>
/// Extension methods for NBitcoin's Network class.
/// </summary>
public
static
class
NetworkExtensions
public
static
partial
class
NetworkExtensions
{
/// <summary>Fake height value used in Coins to signify they are only in the memory pool (since 0.8).</summary>
public
const
int
MempoolHeight
=
0x7FFFFFFF
;
...
...
@@ -37,7 +37,8 @@ namespace Stratis.Bitcoin.Utilities
/// <returns><c>true</c> if the specified network is bitcoin, <c>false</c> otherwise.</returns>
public
static
bool
IsBitcoin
(
this
Network
network
)
{
return
!
network
.
Name
.
ToLowerInvariant
().
Contains
(
"stratis"
);
return
!
network
.
Name
.
ToLowerInvariant
().
Contains
(
"stratis"
)
&&
!
network
.
Name
.
ToLowerInvariant
().
Contains
(
"destream"
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment