Commit a8d20c51 authored by Sergei Zubov's avatar Sergei Zubov

Modify TxMemPool

parent 57183cce
...@@ -31,7 +31,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool ...@@ -31,7 +31,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
.FeatureServices(services => .FeatureServices(services =>
{ {
services.AddSingleton<MempoolSchedulerLock>(); services.AddSingleton<MempoolSchedulerLock>();
services.AddSingleton<ITxMempool, TxMempool>(); services.AddSingleton<ITxMempool, DeStreamTxMempool>();
services.AddSingleton<BlockPolicyEstimator>(); services.AddSingleton<BlockPolicyEstimator>();
services.AddSingleton<IMempoolValidator, DeStreamMempoolValidator>(); services.AddSingleton<IMempoolValidator, DeStreamMempoolValidator>();
services.AddSingleton<MempoolOrphans>(); services.AddSingleton<MempoolOrphans>();
......
using System.Linq;
using Microsoft.Extensions.Logging;
using NBitcoin;
using Stratis.Bitcoin.Configuration;
using Stratis.Bitcoin.Features.MemoryPool.Fee;
using Stratis.Bitcoin.Utilities;
namespace Stratis.Bitcoin.Features.MemoryPool
{
public class DeStreamTxMempool : TxMempool
{
public DeStreamTxMempool(
IDateTimeProvider dateTimeProvider,
BlockPolicyEstimator blockPolicyEstimator,
ILoggerFactory loggerFactory,
NodeSettings nodeSettings)
: base(dateTimeProvider, blockPolicyEstimator, loggerFactory, nodeSettings)
{
}
/// <inheritdoc />
protected override void RemoveConflicts(Transaction tx)
{
foreach (TxIn txInput in tx.Inputs.RemoveChangePointer())
{
NextTxPair it = this.MapNextTx.FirstOrDefault(p => p.OutPoint == txInput.PrevOut);
if (it == null) continue;
Transaction txConflict = it.Transaction;
if (txConflict == tx) continue;
this.ClearPrioritisation(txConflict.GetHash());
this.RemoveRecursive(txConflict);
}
}
}
}
\ No newline at end of file
...@@ -854,7 +854,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool ...@@ -854,7 +854,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// Removes conflicting transactions. /// Removes conflicting transactions.
/// </summary> /// </summary>
/// <param name="tx">Transaction to remove conflicts from.</param> /// <param name="tx">Transaction to remove conflicts from.</param>
private void RemoveConflicts(Transaction tx) protected virtual void RemoveConflicts(Transaction tx)
{ {
// Remove transactions which depend on inputs of tx, recursively // Remove transactions which depend on inputs of tx, recursively
//LOCK(cs); //LOCK(cs);
...@@ -877,7 +877,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool ...@@ -877,7 +877,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// Clears the prioritisation for a transaction. /// Clears the prioritisation for a transaction.
/// </summary> /// </summary>
/// <param name="hash">Transaction hash.</param> /// <param name="hash">Transaction hash.</param>
private void ClearPrioritisation(uint256 hash) protected void ClearPrioritisation(uint256 hash)
{ {
//LOCK(cs); //LOCK(cs);
this.mapDeltas.Remove(hash); this.mapDeltas.Remove(hash);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment