Skip to content
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

Fix Stratis.Bitcoin code warnings #1138

Draft
wants to merge 1 commit into
base: release/1.6.0.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Stratis.Bitcoin.Features.Api/ApiSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ApiSettings : BaseSettings
private string apiHost = DefaultApiHost;

// If a port is set in the -apiuri, it takes precedence over the default port or the port passed in -apiport.
public Uri ApiUri { get { Uri uri = new Uri(this.ApiHost); return uri.IsDefaultPort ? new Uri($"{this.ApiHost}:{this.apiPort ?? this.nodeSettings.Network.DefaultAPIPort}") : uri; } }
public Uri ApiUri { get { Uri uri = new Uri(this.ApiHost); return uri.IsDefaultPort ? new Uri($"{this.ApiHost}:{this.apiPort ?? this.NodeSettings.Network.DefaultAPIPort}") : uri; } }

/// <summary>Port of node's API interface.</summary>
[CommandLineOption("apiport", "Port of node's API interface.")]
Expand Down
4 changes: 2 additions & 2 deletions src/Stratis.Bitcoin.Features.Miner/MinerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public class MinerSettings : BaseSettings
public string WalletName { get; set; } = null;

[CommandLineOption("blockmaxsize", "Maximum block size (in bytes) for the miner to generate.")]
private uint BlockMaxSize { get { return this.blockMaxSize ?? this.nodeSettings.Network.Consensus.Options.MaxBlockSerializedSize; } set { this.blockMaxSize = value; } }
private uint BlockMaxSize { get { return this.blockMaxSize ?? this.NodeSettings.Network.Consensus.Options.MaxBlockSerializedSize; } set { this.blockMaxSize = value; } }
private uint? blockMaxSize = null;

[CommandLineOption("blockmaxweight", "Maximum block weight (in weight units) for the miner to generate.")]
private uint BlockMaxWeight { get { return this.blockMaxWeight ?? this.nodeSettings.Network.Consensus.Options.MaxBlockWeight; } set { this.blockMaxWeight = value; } }
private uint BlockMaxWeight { get { return this.blockMaxWeight ?? this.NodeSettings.Network.Consensus.Options.MaxBlockWeight; } set { this.blockMaxWeight = value; } }
private uint? blockMaxWeight = null;

[CommandLineOption("blockmintxfee", "Set lowest fee rate (in BTC/kvB) for transactions to be included in block creation.")]
Expand Down
2 changes: 1 addition & 1 deletion src/Stratis.Bitcoin/Configuration/NodeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class NodeSettings : IDisposable

/// <summary>A factory responsible for creating a Full Node logger instance.</summary>
public ILoggerFactory LoggerFactory
{
{
get
{
if (loggerFactory == null)
Expand Down
4 changes: 2 additions & 2 deletions src/Stratis.Bitcoin/Configuration/Settings/BaseSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public CommandLineOptionAttribute(string option, string description, bool canLog

public abstract class BaseSettings
{
protected readonly NodeSettings nodeSettings;
protected NodeSettings NodeSettings { get; private set; }

private static string TypeDescription(Type type)
{
Expand Down Expand Up @@ -62,7 +62,7 @@ public BaseSettings(NodeSettings nodeSettings)
{
Guard.NotNull(nodeSettings, nameof(nodeSettings));

this.nodeSettings = nodeSettings;
this.NodeSettings = nodeSettings;

ILogger logger = nodeSettings.LoggerFactory.CreateLogger(this.GetType().FullName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static long CalculateMinBalance(this IEnumerable<AddressBalanceChange> ba
foreach (AddressBalanceChange change in balancesByHeight)
{
balance += change.Satoshi;

if (change.BalanceChangedHeight < startHeight)
continue;

Expand Down
2 changes: 1 addition & 1 deletion src/Stratis.Bitcoin/Database/ReadWriteBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Stratis.Bitcoin.Database
/// <summary>
/// A batch that can be used to record changes that can be applied atomically.
/// </summary>
/// <remarks>The supplied <see cref="Get"/> method will immediately reflect any changes that have
/// <remarks>The supplied <see cref="Get"/> method will immediately reflect any changes that have
/// been made or retrieve the value from the underlying database. In contrast the database <see cref="IDb.Get"/> method
/// will only show the changes after the <see cref="Write"/> method is called.</remarks>
public class ReadWriteBatch : IDbBatch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Stratis.Bitcoin.EventBus.CoreEvents
namespace Stratis.Bitcoin.EventBus.CoreEvents
{
public class ConsensusManagerStatusEvent : EventBase
{
public readonly bool IsIbd;
public readonly int? HeaderHeight;
public bool IsIbd { get; private set; }

public int? HeaderHeight { get; private set; }

public ConsensusManagerStatusEvent(bool isIbd, int? headerHeight)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Stratis.Bitcoin.Persistence.KeyValueStores
{
public class KeyValueRepository<T> : IKeyValueRepository where T : IDb, new()
public class KeyValueRepository<TDB> : IKeyValueRepository where TDB : IDb, new()
{
/// <summary>Access to database.</summary>
private readonly IDb db;
Expand All @@ -25,7 +25,7 @@ public KeyValueRepository(string folder, DBreezeSerializer dBreezeSerializer)
this.dBreezeSerializer = dBreezeSerializer;

// Open a connection to a new DB and create if not found
this.db = new T();
this.db = new TDB();
this.db.Open(folder);
}

Expand Down