Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EthereumStratum/2.0.0 implementation to support both ProgPoW and ethash #442

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

hackmod
Copy link

@hackmod hackmod commented Sep 5, 2019

This is a working prototype for EthereumStratum/2.0.0 implementation,
and it supports both ProgPoW and ethash.

(some commits are cherrypicked for a practical reason)

feel free to feedback!

  • unified nicehash + EthereumStratum/2.0.0 support
  • configurable forkBlocks

sammy007 and others added 19 commits June 7, 2018 17:04
Author: Wolfgang Frisch <[email protected]>
Date:   Mon Sep 25 19:24:09 2017 +0200

    NiceHash support: working prototype

unified nicehash + ethproxy and cleanup by hackmod
 * rebased and squashed
 * unified processShare*()
 * unified nicehash + ethproxy
 * height field added to support extended getWork()
 * support mining.extranonce.subscribe for nicehash
 * fixed crash and cleanup
 * remove DifficultyNiceHash using DiffFloatToInit()
 * remove all nicehash specific options
 * BUG: do not modify shareDiff to show hashrate correctly
 * check len(params)
 * Do not terminate connection if miner submits one duplicate share (by nicehashdev, manually applied by hackmod)
 * BUG: old behavior always drop stale jobs
 * sendJob() again after stale share found.
 * cache stale jobs info.
 * use cached headHash/seedHash from stales cache
mining.notify does not have block height information.
but the fourth paramenter is boolean
and can be easily modified to check an addtional block number info.

add a fourth block height parameter to support the progPoW algorithm
…locks

 * check algorithm change and mining.set if it needed
@mathias7799
Copy link

Niice

@da-tai
Copy link

da-tai commented Sep 5, 2019

well done.

@salanki
Copy link

salanki commented Sep 12, 2019

Great job

@butcher21
Copy link

Well done

}

// send worker
if err := cs.sendStratumResult(req.Id, splitData[1]); err != nil {
Copy link

@phatblinkie phatblinkie May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crashes if wallet is not in 0x000.worker format

easy fix is

                    sz := len(splitData)
                    if sz != 2 {
                            fmt.Printf("incorrectly defined wallet: %v adding workername as \"missing\"\n", splitData[0])
                            var missingname = "missing"
                            splitData = append(splitData, missingname)
                    }

                    if err := cs.sendStratumResult(req.Id, splitData[1]); err != nil {
                            return err
                    }

@phatblinkie
Copy link

so if (using pheonixminer) the miner puts the wallet without the format of 0x000.workername the stratum crashes. it tries to split the wallet expecting the . which is not there and bombs.
https://github.com/sammy007/open-ethereum-pool/pull/442/files#r871660599

"miner command= ./PhoenixMiner -pool tls://phat.yourpool.net:8002 -wal 0x4bc7b9d{...}66ecad87e5699c1ec02d531 -worker testrig1 -epsw x -mode 1 -log 0 -mport 0 -etha 0 -ftime 55 -retrydelay 1 -tt 79 -tstop 89 -coin eth -nosni -proto 5"

2022/05/12 17:38:26 Stratum miner connected 0x4bc7b9d69d[...][email protected]
panic: runtime error: index out of range [1] with length 1

goroutine 1654 [running]:
github.com/sammy007/open-ethereum-pool/proxy.(*Session).handleTCPMessage(0xc000134600, 0xc00015e0b0, 0xc000201770, 0x852240, 0xc000201770)
/root/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/stratum.go:258 +0x3cfc
github.com/sammy007/open-ethereum-pool/proxy.(*ProxyServer).handleTCPClient(0xc00015e0b0, 0xc000134600, 0x1, 0x0)
/root/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/stratum.go:121 +0x270
github.com/sammy007/open-ethereum-pool/proxy.(*ProxyServer).ListenTCP.func3(0xc00015e0b0, 0xc000486650, 0x9bfd60, 0xc000045880, 0xc0001b2000, 0xc000134600)
/root/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/stratum.go:82 +0x39
created by github.com/sammy007/open-ethereum-pool/proxy.(*ProxyServer).ListenTCP
/root/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/stratum.go:81 +0x6d7

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

Successfully merging this pull request may close these issues.

7 participants