-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an interface to override services from the network class (#438)
- Loading branch information
1 parent
729ec43
commit faa5f75
Showing
7 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using Blockcore.Builder.Feature; | ||
using Blockcore.Configuration; | ||
using Blockcore.Networks; | ||
using Blockcore.Persistence; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Blockcore.Builder | ||
{ | ||
/// <summary> | ||
/// Allow specific network implementation to override services. | ||
/// </summary> | ||
public interface IFullNodeBuilderServiceOverride | ||
{ | ||
/// <summary> | ||
/// Intercept the builder to override services. | ||
/// </summary> | ||
void OverrideServices(IFullNodeBuilder builder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Networks/Blockcore.Networks.Strax/Staking/MiningServiceOverride.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Blockcore.Builder; | ||
using Blockcore.Features.Miner.Interfaces; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
namespace Blockcore.Networks.Strax.Staking | ||
{ | ||
/// <summary> | ||
/// Full node builder allows constructing a full node using specific components. | ||
/// </summary> | ||
public class MiningServiceOverride : IFullNodeBuilderServiceOverride | ||
{ | ||
public void OverrideServices(IFullNodeBuilder builder) | ||
{ | ||
var replace = ServiceDescriptor.Singleton<IPosMinting, StraxMinting>(); | ||
|
||
builder.Services.Replace(replace); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters