Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Dev (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Weichhold authored Oct 7, 2018
1 parent c0101ee commit 55b4454
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ $RECYCLE.BIN/

logs/

src/MiningCore/config\.json
/src/MiningCore/config2.json
src/Miningcore/config.json
src/Miningcore/config2.json
5 changes: 3 additions & 2 deletions src/Miningcore/Api/Extensions/MiningPoolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ namespace Miningcore.Api.Extensions
{
public static class MiningPoolExtensions
{
public static PoolInfo ToPoolInfo(this PoolConfig poolConfig,
public static PoolInfo ToPoolInfo(this PoolConfig poolConfig,
IComponentContext ctx, IMapper mapper, Persistence.Model.PoolStats stats, IMiningPool pool)
{
var poolInfo = mapper.Map<PoolInfo>(poolConfig);
var poolInfo = mapper.Map<PoolInfo>(poolConfig,
options=> options.Items.Add(AutoMapperProfile.AutofacContextItemName, ctx));

// enrich with basic information
poolInfo.Coin.Algorithm = GetPoolAlgorithm(ctx, poolConfig);
Expand Down
15 changes: 14 additions & 1 deletion src/Miningcore/AutoMapperProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ portions of the Software.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

using Autofac;
using AutoMapper;
using Miningcore.Blockchain;
using Miningcore.Configuration;
Expand All @@ -29,6 +30,8 @@ namespace Miningcore
{
public class AutoMapperProfile : Profile
{
public const string AutofacContextItemName = "ctx";

public AutoMapperProfile()
{
//////////////////////
Expand All @@ -52,7 +55,17 @@ public AutoMapperProfile()
.ForMember(dest => dest.Created, opt => opt.Ignore());

// API
CreateMap<PoolConfig, Api.Responses.PoolInfo>();
CreateMap<CoinTemplate, Api.Responses.ApiCoinConfig>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.Symbol))
.ForMember(dest => dest.Algorithm, opt => opt.ResolveUsing((src, dst, member, resolutionContext)=>
{
var ctx = (IComponentContext) resolutionContext.Items[AutofacContextItemName];
return src.GetAlgorithmName(ctx);
}));

CreateMap<PoolConfig, Api.Responses.PoolInfo>()
.ForMember(dest => dest.Coin, opt => opt.MapFrom(src => src.Template));

CreateMap<PoolStats, Api.Responses.PoolInfo>();
CreateMap<PoolStats, Api.Responses.AggregatedPoolStats>();
CreateMap<Block, Api.Responses.Block>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ private Network NBitcoinNetworkType
}
}

#region Overrides of ZCashJob

protected Transaction CreateOutputTransaction()
{
rewardToPool = new Money(BlockTemplate.CoinbaseValue, MoneyUnit.Satoshi);
Expand Down Expand Up @@ -241,7 +239,5 @@ public override void Init(EquihashBlockTemplate blockTemplate, string jobId,
false
};
}

#endregion
}
}
2 changes: 1 addition & 1 deletion src/Miningcore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ private static void OnProcessExit(object sender, EventArgs e)

private static void Shutdown()
{
logger.Info(() => "Shutdown ...");
logger?.Info(() => "Shutdown ...");
Console.WriteLine("Shutdown...");

foreach(var pool in pools.Values)
Expand Down
2 changes: 1 addition & 1 deletion src/Miningcore/coins.json
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@
]
},
"coinbaseTxVersion": 2,
"coinbaseTxAppendData": "Flo MiningCore",
"coinbaseTxAppendData": "Flo Miningcore",
"shareMultiplier": 65536,
"hashrateMultiplier": 1.5,
"explorerBlockLink": "https://florincoin.info/block/0",
Expand Down

0 comments on commit 55b4454

Please sign in to comment.