Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

More XML docs for memory pool classes. #355

Merged
merged 6 commits into from
Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from 4 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 Stratis.Bitcoin.IntegrationTests/FeeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void BlockPolicyEstimates()
{
Assert.True(mpool.EstimateSmartFee(i, out answerFound).FeePerK >= mpool.EstimateFee(i).FeePerK);
Assert.True(mpool.EstimateSmartFee(i, out answerFound).FeePerK >= mpool.GetMinFee(1).FeePerK);
Assert.True(mpool.EstimateSmartPriority(i, out answerFound) == BlockPolicyEstimator.INF_PRIORITY);
Assert.True(mpool.EstimateSmartPriority(i, out answerFound) == BlockPolicyEstimator.InfPriority);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Stratis.Bitcoin.Tests/MemoryPool/MempoolPersistenceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void SaveStreamTest()
}

Assert.True(actualStreamLength > 0);
Assert.Equal(MempoolPersistence.MEMPOOL_DUMP_VERSION, actualVersion);
Assert.Equal(MempoolPersistence.MempoolDumpVersion, actualVersion);
Assert.Equal(numTx, actualCount);
Assert.Equal(loaded, toSave.ToArray());
}
Expand Down
287 changes: 181 additions & 106 deletions Stratis.Bitcoin/Features/MemoryPool/Fee/BlockPolicyEstimator.cs

Large diffs are not rendered by default.

212 changes: 133 additions & 79 deletions Stratis.Bitcoin/Features/MemoryPool/Fee/TxConfirmStats.cs

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions Stratis.Bitcoin/Features/MemoryPool/MempoolBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// </summary>
public class MempoolBehavior : NodeBehavior
{
#region Fields

/// <summary>
/// Average delay between trickled inventory transmissions in seconds.
/// Blocks and whitelisted receivers bypass this, outbound peers get half this delay.
Expand Down Expand Up @@ -66,10 +64,6 @@ public class MempoolBehavior : NodeBehavior
/// </summary>
private readonly Dictionary<uint256, uint256> filterInventoryKnown;

#endregion

#region Constructors

/// <summary>
/// Constructs an instance of memory pool behavior.
/// </summary>
Expand Down Expand Up @@ -124,10 +118,6 @@ public MempoolBehavior(
{
}

#endregion

#region Properties

/// <summary>Time of last memory pool request in unix time.</summary>
public long LastMempoolReq { get; private set; }

Expand Down Expand Up @@ -157,10 +147,6 @@ public bool CanSend
}
}

#endregion

#region NodeBehavior Overrides

/// <inheritdoc />
protected override void AttachCore()
{
Expand All @@ -179,10 +165,6 @@ public override object Clone()
return new MempoolBehavior(this.validator, this.manager, this.orphans, this.connectionManager, this.chainState, this.signals, this.logger);
}

#endregion

#region Message Handlers

/// <summary>
/// Handler for processing incoming message from node.
/// </summary>
Expand Down Expand Up @@ -247,10 +229,6 @@ private Task AttachedNode_MessageReceivedAsync(Node node, IncomingMessage messag
return Task.CompletedTask;
}

#endregion

#region Message Processing

/// <summary>
/// Send the memory pool payload to the attached node.
/// Gets the transaction info from the memory pool and sends to the attached node.
Expand Down Expand Up @@ -445,10 +423,6 @@ private async Task SendAsTxInventory(Node node, IEnumerable<uint256> trxList)
}
}

#endregion

#region Operations

/// <summary>
/// Relays a transaction to the connected nodes.
/// </summary>
Expand Down Expand Up @@ -516,7 +490,5 @@ public async Task SendTrickle()
if (sends.Any())
await this.SendAsTxInventory(this.AttachedNode, sends);
}

#endregion
}
}
12 changes: 0 additions & 12 deletions Stratis.Bitcoin/Features/MemoryPool/MempoolFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// <seealso cref="https://github.com/bitcoin/bitcoin/blob/6dbcc74a0e0a7d45d20b03bb4eb41a027397a21d/src/txmempool.cpp"/>
public class MempoolFeature : FullNodeFeature, IFeatureStats
{
#region Fields

/// <summary>Node notifications available to subscribe to.</summary>
private readonly Signals.Signals signals;

Expand All @@ -35,10 +33,6 @@ public class MempoolFeature : FullNodeFeature, IFeatureStats
/// <summary>Logger for the memory pool component.</summary>
private readonly ILogger mempoolLogger;

#endregion

#region Constructors

/// <summary>
/// Constructs a memory pool feature.
/// </summary>
Expand Down Expand Up @@ -74,10 +68,6 @@ public void AddFeatureStats(StringBuilder benchLogs)
}
}

#endregion

#region FullNodeFeature Overrides

/// <inheritdoc />
public override void Start()
{
Expand Down Expand Up @@ -105,8 +95,6 @@ public override void Stop()
}
}
}

#endregion
}

/// <summary>
Expand Down
16 changes: 0 additions & 16 deletions Stratis.Bitcoin/Features/MemoryPool/MempoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class MempoolAsyncLock : AsyncLock
/// </summary>
public class MempoolManager
{
#region Fields

/// <summary>Memory pool persistence methods for loading and saving from storage.</summary>
private IMempoolPersistence mempoolPersistence;

Expand All @@ -33,10 +31,6 @@ public class MempoolManager
/// <summary>Transaction memory pool for managing transactions in the memory pool.</summary>
private readonly TxMempool memPool;

#endregion

#region Constructors

/// <summary>
/// Constructs an instance of a memory pool manager object.
/// </summary>
Expand Down Expand Up @@ -68,10 +62,6 @@ public MempoolManager(
this.mempoolLogger = loggerFactory.CreateLogger(this.GetType().FullName);
}

#endregion

#region Properties

/// <summary>Lock for memory pool access.</summary>
public MempoolAsyncLock MempoolLock { get; }

Expand All @@ -90,10 +80,6 @@ public MempoolManager(
/// <summary>Access to memory pool validator performance counter.</summary>
public MempoolPerformanceCounter PerformanceCounter => this.Validator.PerformanceCounter;

#endregion

#region Operations

/// <summary>
/// Gets the memory pool transactions.
/// </summary>
Expand Down Expand Up @@ -249,7 +235,5 @@ public Task RemoveForBlock(Block block, int blockHeight)
this.Validator.PerformanceCounter.SetMempoolDynamicSize(this.memPool.DynamicMemoryUsage());
});
}

#endregion
}
}
16 changes: 0 additions & 16 deletions Stratis.Bitcoin/Features/MemoryPool/MempoolOrphans.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// </summary>
public class MempoolOrphans
{
#region Fields

/// <summary>Expiration time for orphan transactions in seconds.</summary>
private const long OrphanTxExpireTime = 20 * 60;

Expand Down Expand Up @@ -70,10 +68,6 @@ public class MempoolOrphans
/// <summary>Location on chain when rejects are validated.</summary>
private uint256 hashRecentRejectsChainTip;

#endregion

#region Constructors

/// <summary>
/// Constructs a memory pool orphan manager object.
/// </summary>
Expand Down Expand Up @@ -116,20 +110,12 @@ public MempoolOrphans(
this.mempoolLogger = loggerFactory.CreateLogger(this.GetType().FullName);
}

#endregion

#region Properties

/// <summary>A lock for managing asynchronous access to memory pool.</summary>
public MempoolAsyncLock MempoolLock { get; }

/// <summary>Memory pool validator for validating transactions.</summary>
public IMempoolValidator Validator { get; } // public for testing

#endregion

#region Operations

/// <summary>
/// Object representing an orphan transaction information.
/// When modifying, adapt the copy of this definition in tests/DoS_tests.
Expand Down Expand Up @@ -450,7 +436,5 @@ public Task EraseOrphansFor(ulong peer)
//return true;
}).Unwrap();
}

#endregion
}
}
Loading