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

Ltc fix #1563

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Ltc fix #1563

wants to merge 6 commits into from

Conversation

jon4hz
Copy link
Contributor

@jon4hz jon4hz commented Dec 28, 2022

This might fix #1546.

I added "mweb" to the blockTemplateRpcExtraParams. However I don't have an LTC pool, so I couldn't test it yet.
@btclinux it would be great, if you could test that.

All other changes from the autoformatter (if you want me to revert does, let me know).

@oliverw
Copy link
Owner

oliverw commented Jan 31, 2023

Whats the status of this PR? Tests are failing and discussion of #1546 is inconclusive?

@jon4hz
Copy link
Contributor Author

jon4hz commented Jan 31, 2023

The failing tests are unrelated to this PR.
However as I said, I didn't test it, it's more of a suggestion to try.
Reading the discussion in #1546 I guess the pool has to add some extra info when submitting the block. (see bottom of https://github.com/litecoin-project/litecoin/blob/0.21/doc/mweb/mining-changes.md).

@oliverw
Copy link
Owner

oliverw commented Jan 31, 2023

This comment suggests that the change did not have any effect. Hmm.

@jon4hz jon4hz marked this pull request as draft February 1, 2023 14:24
@jon4hz
Copy link
Contributor Author

jon4hz commented Feb 5, 2023

I think this should do the trick. I was able to mine blocks on the litecoin testnet :)

[2023-02-06 00:36:49.1528] [I] [ltc1] Submitting block 2653615 [e925a32cf1b982e1d7bd1e9c58c1f90104584cd98db567bd185e0be8f4860552] 
[2023-02-06 00:36:49.1550] [I] [ltc1] Daemon accepted block 2653615 [e925a32cf1b982e1d7bd1e9c58c1f90104584cd98db567bd185e0be8f4860552] submitted by mrSJA4vSqSj5EWEwnwANmTka4AnCoEtq9z 

@jon4hz jon4hz marked this pull request as ready for review February 5, 2023 23:39
@VaderCoinCryptoNote
Copy link

Mining Core does not start, the error is not UNDERSTANDABLE to me, can someone please help me?

[2023-02-11 18:00:08.6447] [I] [Core] Version 50.0.1.0-ltc-fix [4d20384]
[2023-02-11 18:00:08.6793] [I] [Core] Runtime .NET 6.0.13 on Linux 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 [X64]
[2023-02-11 18:00:08.6905] [I] [Core] Prometheus Metrics API listening on http://127.0.0.1:4000/metrics
[2023-02-11 18:00:08.6905] [I] [Core] WebSocket Events streaming on ws://127.0.0.1:4000/notifications
[2023-02-11 18:00:09.9427] [I] [XmlKeyManager] User profile is available. Using '/home/fluffelbuff/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
[2023-02-11 18:00:09.9794] [I] [ShareRecorder] Online
[2023-02-11 18:00:10.0393] [I] [PayoutManager] Online
[2023-02-11 18:00:10.0411] [I] [StatsRecorder] Online
[2023-02-11 18:00:10.1483] [I] [Core] 123 coins loaded from '/home/fluffelbuff/Downloads/ltc-pool/miningcore/build/coins.json'
[2023-02-11 18:00:10.1726] [I] [ltc1] Starting Pool ...
[2023-02-11 18:00:10.1726] [I] [ltc1] ExtraNonceProvider using 4 bits for instance id, 28 bits for 268435455 values, instance id = 0x6
[2023-02-11 18:00:10.1812] [I] [ltc1] Starting Job Manager ...
[2023-02-11 18:00:10.2674] [I] [ltc1] All daemons online
[2023-02-11 18:00:10.2724] [I] [Core] API Access to /api/admin restricted to 127.0.0.1,::1,::ffff:127.0.0.1
[2023-02-11 18:00:10.2725] [I] [Core] API Access to /metrics restricted to 127.0.0.1,::1,::ffff:127.0.0.1
[2023-02-11 18:00:10.2927] [I] [ltc1] All daemons synched with blockchain
[2023-02-11 18:00:10.2927] [F] [Diagnostics] Application startup exception System.NullReferenceException: Object reference not set to an instance of an object.
at Miningcore.Program.<>c.

b__0_9(JsonOptions options) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 181
at Microsoft.Extensions.Options.ConfigureNamedOptions1.Configure(String name, TOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value() at Microsoft.AspNetCore.Mvc.MvcCoreMvcOptionsSetup.Configure(MvcOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value() at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action1 configureRoutes)
at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app)
at Miningcore.Program.<>c__DisplayClass0_0.b__5(IApplicationBuilder app) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 233
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass17_0.b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken) at Miningcore.Program.<>c.b__0_9(JsonOptions options) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 181
at Microsoft.Extensions.Options.ConfigureNamedOptions1.Configure(String name, TOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value() at Microsoft.AspNetCore.Mvc.MvcCoreMvcOptionsSetup.Configure(MvcOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value() at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action1 configureRoutes)
at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app)
at Miningcore.Program.<>c__DisplayClass0_0.b__5(IApplicationBuilder app) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 233
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass17_0.b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
[2023-02-11 18:00:10.3338] [I] [Lifetime] Application is shutting down...
[2023-02-11 18:00:10.3316] [E] [ltc1] System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed. System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters)
at Autofac.ResolutionExtensions.ResolveNamed[TService](IComponentContext context, String serviceName, IEnumerable1 parameters) at Miningcore.Crypto.HashAlgorithmFactory.InstantiateHash(IComponentContext ctx, String name, Object[] parameters) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Crypto/HashAlgorithmFactory.cs:line 47 at Miningcore.Crypto.HashAlgorithmFactory.GetHash(IComponentContext ctx, JObject definition) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Crypto/HashAlgorithmFactory.cs:line 25 at Miningcore.Configuration.BitcoinTemplate.<.ctor>b__89_1() in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Configuration/ClusterConfigExtensions.cs:line 36 at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at System.Lazy1.get_Value() at Miningcore.Configuration.BitcoinTemplate.get_HeaderHasherValue() in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Configuration/ClusterConfigExtensions.cs:line 53 at Miningcore.Blockchain.Bitcoin.BitcoinJobManager.PostChainIdentifyConfigure() in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs:line 116 at Miningcore.Blockchain.Bitcoin.BitcoinJobManagerBase1.PostStartInitAsync(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs:line 471
at Miningcore.Blockchain.JobManagerBase1.StartAsync(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/JobManagerBase.cs:line 112 at Miningcore.Blockchain.Bitcoin.BitcoinPool.SetupJobManager(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/Bitcoin/BitcoinPool.cs:line 368 at Miningcore.Mining.PoolBase.RunAsync(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Mining/PoolBase.cs:line 392 at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException() at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.ResolveNamed[TService](IComponentContext context, String serviceName, IEnumerable1 parameters)
at Miningcore.Crypto.HashAlgorithmFactory.InstantiateHash(IComponentContext ctx, String name, Object[] parameters) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Crypto/HashAlgorithmFactory.cs:line 47
at Miningcore.Crypto.HashAlgorithmFactory.GetHash(IComponentContext ctx, JObject definition) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Crypto/HashAlgorithmFactory.cs:line 25
at Miningcore.Configuration.BitcoinTemplate.<.ctor>b__89_1() in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Configuration/ClusterConfigExtensions.cs:line 36
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at System.Lazy1.get_Value()
at Miningcore.Configuration.BitcoinTemplate.get_HeaderHasherValue() in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Configuration/ClusterConfigExtensions.cs:line 53
at Miningcore.Blockchain.Bitcoin.BitcoinJobManager.PostChainIdentifyConfigure() in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs:line 116
at Miningcore.Blockchain.Bitcoin.BitcoinJobManagerBase1.PostStartInitAsync(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs:line 471 at Miningcore.Blockchain.JobManagerBase1.StartAsync(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/JobManagerBase.cs:line 112
at Miningcore.Blockchain.Bitcoin.BitcoinPool.SetupJobManager(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Blockchain/Bitcoin/BitcoinPool.cs:line 368
at Miningcore.Mining.PoolBase.RunAsync(CancellationToken ct) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Mining/PoolBase.cs:line 392
System.NullReferenceException: Object reference not set to an instance of an object.
at Miningcore.Program.<>c.b__0_9(JsonOptions options) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 181
at Microsoft.Extensions.Options.ConfigureNamedOptions1.Configure(String name, TOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value() at Microsoft.AspNetCore.Mvc.MvcCoreMvcOptionsSetup.Configure(MvcOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value() at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action1 configureRoutes)
at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app)
at Miningcore.Program.<>c__DisplayClass0_0.b__5(IApplicationBuilder app) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 233
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass17_0.b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Miningcore.Program.Main(String[] args) in /home/fluffelbuff/Downloads/ltc-pool/miningcore/src/Miningcore/Program.cs:line 245
Cluster cannot start. Good Bye!

@jon4hz
Copy link
Contributor Author

jon4hz commented Feb 11, 2023

I'm not exactly sure what's causing your error but it's most likely an error on your side. If you start a litecoin pool based on this PR, the pool definitely does start.

[2023-02-11 20:29:04.3857] [I] [Core] Version 74.1.0.0-ltc-fix [4d203849eee11f2a2ddd2cc484b4c6cfe80665c6] 
[2023-02-11 20:29:04.3996] [I] [Core] Runtime .NET 6.0.13 on Linux 5.15.91-1-MANJARO #1 SMP PREEMPT Wed Feb 1 12:03:19 UTC 2023 [X64] 
[2023-02-11 20:29:04.4137] [I] [Core] Prometheus Metrics API listening on http://0.0.0.0:5000/metrics 
[2023-02-11 20:29:04.4137] [I] [Core] WebSocket Events streaming on ws://0.0.0.0:5000/notifications 
[2023-02-11 20:29:05.0668] [I] [XmlKeyManager] User profile is available. Using '/home/jonah/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest. 
[2023-02-11 20:29:05.0888] [I] [ShareRecorder] Online 
[2023-02-11 20:29:05.1204] [I] [PayoutManager] Online 
[2023-02-11 20:29:05.1204] [I] [StatsRecorder] Online 
[2023-02-11 20:29:05.1882] [I] [Core] 123 coins loaded from '/home/jonah/projects/miningcore/src/Miningcore/bin/Debug/net6.0/coins.json' 
[2023-02-11 20:29:05.2026] [I] [ltc1] Starting Pool ... 
[2023-02-11 20:29:05.2134] [I] [ltc1] ExtraNonceProvider using 4 bits for instance id, 28 bits for 268435455 values, instance id = 0x7 
[2023-02-11 20:29:05.2172] [I] [ltc1] Starting Job Manager ... 
[2023-02-11 20:29:05.2594] [I] [Core] API Access to /api/admin restricted to 127.0.0.1,::1,::ffff:127.0.0.1 
[2023-02-11 20:29:05.2595] [I] [Core] API Access to /metrics restricted to 127.0.0.1,::1,::ffff:127.0.0.1 
[2023-02-11 20:29:05.2595] [I] [ltc1] All daemons online 
[2023-02-11 20:29:05.2721] [I] [ltc1] All daemons synched with blockchain 
[2023-02-11 20:29:05.2950] [I] [ltc1] Interpreting pool address tltc1qfm86d7n6hmfj288ltc39a4m4n93hhls6epdxgd as type Litecoin 
[2023-02-11 20:29:05.3239] [I] [Core] API access limited to 500 requests per 1s, except from 127.0.0.1 
[2023-02-11 20:29:05.3239] [I] [ltc1] Job Manager Online 
[2023-02-11 20:29:05.3309] [I] [Lifetime] Now listening on: http://0.0.0.0:5000 
[2023-02-11 20:29:05.3309] [I] [Lifetime] Application started. Press Ctrl+C to shut down. 
[2023-02-11 20:29:05.3309] [I] [Lifetime] Hosting environment: Production 
[2023-02-11 20:29:05.3309] [I] [Lifetime] Content root path: /home/jonah/projects/miningcore/src/Miningcore/bin/Debug/net6.0/ 
[2023-02-11 20:29:05.8712] [I] [ltc1] Detected new block 2659263 [POLL] 
[2023-02-11 20:29:05.8745] [I] [ltc1] Broadcasting job 00000001 
[2023-02-11 20:29:05.9279] [I] [ltc1] Pool Online 
[2023-02-11 20:29:05.9301] [I] [ltc1] 

Mining Pool:            ltc1
Coin Type:              LTC [LTC]
Network Connected:      TestNet
Detected Reward Type:   POW
Current Block Height:   2659263
Current Connect Peers:  5
Network Difficulty:     0.001279155413
Network Hash Rate:      3.26 KH/s
Stratum Port(s):        4600, 4601
Pool Fee:               1%
 
[2023-02-11 20:29:05.9347] [I] [ltc1] Stratum ports 0.0.0.0:4600, 0.0.0.0:4601 online 
[2023-02-11 20:29:15.3345] [I] [ltc1] Broadcasting job 00000002 
^C[2023-02-11 20:29:17.4736] [I] [Lifetime] Application is shutting down... 
$ git show --summary --stat
commit 4d203849eee11f2a2ddd2cc484b4c6cfe80665c6 (HEAD -> ltc-fix, origin/ltc-fix)
Author: jon4hz <me@jon4hz.io>
Date:   Mon Feb 6 02:58:52 2023 +0100

    fix(litecoin): support for native segwit pool wallet

 examples/litecoin_dash_pool.json                           |  3 ++-
 examples/litecoin_pool.json                                |  3 ++-
 src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs      |  5 +++++
 src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs |  3 +++
 src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs          | 13 +++++++++++++
 5 files changed, 25 insertions(+), 2 deletions(-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants