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
9e7f819a
Commit
9e7f819a
authored
May 31, 2018
by
Alexey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automerge side effects fixed.
Data root directory name changed to "DeStreamNode".
parent
9d48dd0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
75 deletions
+23
-75
Program.cs
Sources/DeStream.DeStreamD/Program.cs
+4
-0
NodeSettings.cs
...es/DeStream.Stratis.Bitcoin/Configuration/NodeSettings.cs
+8
-72
NodeSettings.cs
Sources/Stratis.Bitcoin/Configuration/NodeSettings.cs
+11
-3
No files found.
Sources/DeStream.DeStreamD/Program.cs
View file @
9e7f819a
using
System
;
using
System
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.IO
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.CSharp
;
using
NBitcoin
;
using
NBitcoin
;
using
NBitcoin.Protocol
;
using
NBitcoin.Protocol
;
...
@@ -14,6 +15,8 @@ using Stratis.Bitcoin.Features.Miner;
...
@@ -14,6 +15,8 @@ using Stratis.Bitcoin.Features.Miner;
using
Stratis.Bitcoin.Features.RPC
;
using
Stratis.Bitcoin.Features.RPC
;
using
Stratis.Bitcoin.Features.Wallet
;
using
Stratis.Bitcoin.Features.Wallet
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Utilities.Extensions
;
using
DeStream.Stratis.Bitcoin.Configuration
;
using
DeStream.Stratis.Bitcoin.Configuration
;
...
@@ -35,6 +38,7 @@ namespace DeStream.DeStreamD
...
@@ -35,6 +38,7 @@ namespace DeStream.DeStreamD
network
=
Network
.
DeStreamTest
;
network
=
Network
.
DeStreamTest
;
else
else
network
=
Network
.
DeStreamMain
;
network
=
Network
.
DeStreamMain
;
DeStreamNodeSettings
nodeSettings
=
new
DeStreamNodeSettings
(
network
,
ProtocolVersion
.
ALT_PROTOCOL_VERSION
,
args
:
args
,
loadConfiguration
:
false
);
DeStreamNodeSettings
nodeSettings
=
new
DeStreamNodeSettings
(
network
,
ProtocolVersion
.
ALT_PROTOCOL_VERSION
,
args
:
args
,
loadConfiguration
:
false
);
Console
.
WriteLine
(
$"current network:
{
network
.
Name
}
"
);
Console
.
WriteLine
(
$"current network:
{
network
.
Name
}
"
);
...
...
Sources/DeStream.Stratis.Bitcoin/Configuration/NodeSettings.cs
View file @
9e7f819a
...
@@ -17,6 +17,14 @@ namespace DeStream.Stratis.Bitcoin.Configuration
...
@@ -17,6 +17,14 @@ namespace DeStream.Stratis.Bitcoin.Configuration
/// </summary>
/// </summary>
public
class
DeStreamNodeSettings
:
NodeSettings
public
class
DeStreamNodeSettings
:
NodeSettings
{
{
/// <summary>
/// Returns default data root directory name
/// </summary>
protected
override
string
DataRootDirName
{
get
{
return
"DeStreamNode"
;
}
}
/// <summary>
/// <summary>
/// Initializes a new instance of the object.
/// Initializes a new instance of the object.
/// </summary>
/// </summary>
...
@@ -28,77 +36,5 @@ namespace DeStream.Stratis.Bitcoin.Configuration
...
@@ -28,77 +36,5 @@ namespace DeStream.Stratis.Bitcoin.Configuration
:
base
(
innerNetwork
,
protocolVersion
,
agent
,
args
,
loadConfiguration
)
:
base
(
innerNetwork
,
protocolVersion
,
agent
,
args
,
loadConfiguration
)
{
{
}
}
/// <summary>
/// Loads the configuration file.
/// </summary>
/// <returns>Initialized node configuration.</returns>
/// <exception cref="ConfigurationException">Thrown in case of any problems with the configuration file or command line arguments.</exception>
public
override
NodeSettings
LoadConfiguration
(
List
<
IFeatureRegistration
>
features
=
null
)
{
// Configuration already loaded?
if
(
this
.
ConfigReader
!=
null
)
return
this
;
// Get the arguments set previously
var
args
=
this
.
LoadArgs
;
// Setting the data directory.
if
(
this
.
LoadArgs
.
GetValueOf
(
"-datadir"
)
==
null
||
this
.
DataDir
==
null
)
{
this
.
DataDir
=
this
.
CreateDefaultDataDirectories
(
Path
.
Combine
(
"DeStreamNode"
,
this
.
Network
.
RootFolderName
),
this
.
Network
);
}
else
{
// Create the data directories if they don't exist.
string
directoryPath
=
Path
.
Combine
(
this
.
DataDir
,
this
.
Network
.
RootFolderName
,
this
.
Network
.
Name
);
Directory
.
CreateDirectory
(
directoryPath
);
this
.
DataDir
=
directoryPath
;
this
.
Logger
.
LogDebug
(
"Data directory initialized with path {0}."
,
directoryPath
);
}
// If no configuration file path is passed in the args, load the default file.
if
(
this
.
ConfigurationFile
==
null
)
{
this
.
ConfigurationFile
=
this
.
CreateDefaultConfigurationFile
();
}
var
consoleConfig
=
new
TextFileConfiguration
(
args
);
var
config
=
new
TextFileConfiguration
(
File
.
ReadAllText
(
this
.
ConfigurationFile
));
this
.
ConfigReader
=
config
;
consoleConfig
.
MergeInto
(
config
);
this
.
DataFolder
=
new
DataFolder
(
this
.
DataDir
);
if
(!
Directory
.
Exists
(
this
.
DataFolder
.
CoinViewPath
))
Directory
.
CreateDirectory
(
this
.
DataFolder
.
CoinViewPath
);
// Set the configuration filter and file path.
this
.
Log
.
Load
(
config
);
this
.
LoggerFactory
.
AddFilters
(
this
.
Log
,
this
.
DataFolder
);
this
.
LoggerFactory
.
ConfigureConsoleFilters
(
this
.
LoggerFactory
.
GetConsoleSettings
(),
this
.
Log
);
this
.
Logger
.
LogDebug
(
"Data directory set to '{0}'."
,
this
.
DataDir
);
this
.
Logger
.
LogDebug
(
"Configuration file set to '{0}'."
,
this
.
ConfigurationFile
);
this
.
RequireStandard
=
config
.
GetOrDefault
(
"acceptnonstdtxn"
,
!(
this
.
Network
.
IsTest
()));
this
.
MaxTipAge
=
config
.
GetOrDefault
(
"maxtipage"
,
this
.
Network
.
MaxTipAge
);
this
.
Logger
.
LogDebug
(
"Network: IsTest='{0}', IsBitcoin='{1}'."
,
this
.
Network
.
IsTest
(),
this
.
Network
.
IsBitcoin
());
this
.
MinTxFeeRate
=
new
FeeRate
(
config
.
GetOrDefault
(
"mintxfee"
,
this
.
Network
.
MinTxFee
));
this
.
Logger
.
LogDebug
(
"MinTxFeeRate set to {0}."
,
this
.
MinTxFeeRate
);
this
.
FallbackTxFeeRate
=
new
FeeRate
(
config
.
GetOrDefault
(
"fallbackfee"
,
this
.
Network
.
FallbackFee
));
this
.
Logger
.
LogDebug
(
"FallbackTxFeeRate set to {0}."
,
this
.
FallbackTxFeeRate
);
this
.
MinRelayTxFeeRate
=
new
FeeRate
(
config
.
GetOrDefault
(
"minrelaytxfee"
,
this
.
Network
.
MinRelayTxFee
));
this
.
Logger
.
LogDebug
(
"MinRelayTxFeeRate set to {0}."
,
this
.
MinRelayTxFeeRate
);
this
.
SyncTimeEnabled
=
config
.
GetOrDefault
<
bool
>(
"synctime"
,
true
);
this
.
Logger
.
LogDebug
(
"Time synchronization with peers is {0}."
,
this
.
SyncTimeEnabled
?
"enabled"
:
"disabled"
);
// Add a prefix set by the user to the agent. This will allow people running nodes to
// identify themselves if they wish. The prefix is limited to 10 characters.
string
agentPrefix
=
config
.
GetOrDefault
(
"agentprefix"
,
string
.
Empty
);
agentPrefix
=
agentPrefix
.
Substring
(
0
,
Math
.
Min
(
10
,
agentPrefix
.
Length
));
this
.
Agent
=
string
.
IsNullOrEmpty
(
agentPrefix
)
?
this
.
Agent
:
$"
{
agentPrefix
}
-
{
this
.
Agent
}
"
;
return
this
;
}
}
}
}
}
\ No newline at end of file
Sources/Stratis.Bitcoin/Configuration/NodeSettings.cs
View file @
9e7f819a
...
@@ -38,6 +38,14 @@ namespace Stratis.Bitcoin.Configuration
...
@@ -38,6 +38,14 @@ namespace Stratis.Bitcoin.Configuration
/// <summary>Version of the protocol the current implementation supports.</summary>
/// <summary>Version of the protocol the current implementation supports.</summary>
public
const
ProtocolVersion
SupportedProtocolVersion
=
ProtocolVersion
.
SENDHEADERS_VERSION
;
public
const
ProtocolVersion
SupportedProtocolVersion
=
ProtocolVersion
.
SENDHEADERS_VERSION
;
/// <summary>
/// Returns default data root directory name
/// </summary>
protected
virtual
string
DataRootDirName
{
get
{
return
"StratisNode"
;
}
}
/// <summary>
/// <summary>
/// Initializes a new instance of the object.
/// Initializes a new instance of the object.
/// </summary>
/// </summary>
...
@@ -110,7 +118,7 @@ namespace Stratis.Bitcoin.Configuration
...
@@ -110,7 +118,7 @@ namespace Stratis.Bitcoin.Configuration
// Setting the data directory.
// Setting the data directory.
if
(
this
.
DataDir
==
null
)
if
(
this
.
DataDir
==
null
)
{
{
this
.
DataDir
=
this
.
CreateDefaultDataDirectories
(
Path
.
Combine
(
"StratisNode"
,
this
.
Network
.
RootFolderName
),
this
.
Network
);
this
.
DataDir
=
this
.
CreateDefaultDataDirectories
(
Path
.
Combine
(
this
.
DataRootDirName
,
this
.
Network
.
RootFolderName
),
this
.
Network
);
}
}
else
else
{
{
...
@@ -183,7 +191,7 @@ namespace Stratis.Bitcoin.Configuration
...
@@ -183,7 +191,7 @@ namespace Stratis.Bitcoin.Configuration
/// <summary>Minimum relay transaction fee for network.</summary>
/// <summary>Minimum relay transaction fee for network.</summary>
public
FeeRate
MinRelayTxFeeRate
{
get
;
set
;
}
public
FeeRate
MinRelayTxFeeRate
{
get
;
set
;
}
public
TextFileConfiguration
ConfigReader
{
get
;
pr
otected
set
;
}
public
TextFileConfiguration
ConfigReader
{
get
;
pr
ivate
set
;
}
/// <summary><c>true</c> to sync time with other peers and calculate adjusted time, <c>false</c> to use our system clock only.</summary>
/// <summary><c>true</c> to sync time with other peers and calculate adjusted time, <c>false</c> to use our system clock only.</summary>
public
bool
SyncTimeEnabled
{
get
;
set
;
}
public
bool
SyncTimeEnabled
{
get
;
set
;
}
...
@@ -205,7 +213,7 @@ namespace Stratis.Bitcoin.Configuration
...
@@ -205,7 +213,7 @@ namespace Stratis.Bitcoin.Configuration
/// <param name="features">The features to include in the configuration file if a default file has to be created.</param>
/// <param name="features">The features to include in the configuration file if a default file has to be created.</param>
/// <returns>Initialized node configuration.</returns>
/// <returns>Initialized node configuration.</returns>
/// <exception cref="ConfigurationException">Thrown in case of any problems with the configuration file or command line arguments.</exception>
/// <exception cref="ConfigurationException">Thrown in case of any problems with the configuration file or command line arguments.</exception>
public
virtual
NodeSettings
LoadConfiguration
(
List
<
IFeatureRegistration
>
features
=
null
)
public
NodeSettings
LoadConfiguration
(
List
<
IFeatureRegistration
>
features
=
null
)
{
{
// Configuration already loaded?
// Configuration already loaded?
if
(
this
.
ConfigReader
!=
null
)
if
(
this
.
ConfigReader
!=
null
)
...
...
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