Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit 163ddf5

Browse files
committed
resolve merge conflict for frequent work changes
1 parent d0fdc1c commit 163ddf5

File tree

3 files changed

+48
-23
lines changed

3 files changed

+48
-23
lines changed

ethminer/MinerAux.h

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ class MinerCLI
770770
f.start("opencl", false);
771771
else if (_m == MinerType::CUDA)
772772
f.start("cuda", false);
773-
WorkPackage current, previous;
773+
EthashProofOfWork::WorkPackage current;
774774
std::mutex x_current;
775775
while (m_running)
776776
try
@@ -810,9 +810,6 @@ class MinerCLI
810810
if (hh != current.headerHash)
811811
{
812812
x_current.lock();
813-
previous.headerHash = current.headerHash;
814-
previous.seedHash = current.seedHash;
815-
previous.boundary = current.boundary;
816813
current.headerHash = hh;
817814
current.seedHash = newSeedHash;
818815
current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight);
@@ -824,9 +821,11 @@ class MinerCLI
824821
}
825822
cnote << "Solution found; Submitting to" << _remote << "...";
826823
cnote << " Nonce:" << solution.nonce.hex();
827-
if (EthashAux::eval(current.seedHash, current.headerHash, solution.nonce).value < current.boundary)
824+
cnote << " headerHash:" << solution.headerHash.hex();
825+
cnote << " mixHash:" << solution.mixHash.hex();
826+
if (EthashAux::eval(solution.seedHash, solution.headerHash, solution.nonce).value < solution.boundary)
828827
{
829-
bool ok = prpc->eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(current.headerHash), "0x" + toString(solution.mixHash));
828+
bool ok = prpc->eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(solution.headerHash), "0x" + toString(solution.mixHash));
830829
if (ok) {
831830
cnote << "B-) Submitted and accepted.";
832831
f.acceptedSolution(false);
@@ -837,19 +836,6 @@ class MinerCLI
837836
}
838837
//exit(0);
839838
}
840-
else if (EthashAux::eval(previous.seedHash, previous.headerHash, solution.nonce).value < previous.boundary)
841-
{
842-
bool ok = prpc->eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(previous.headerHash), "0x" + toString(solution.mixHash));
843-
if (ok) {
844-
cnote << "B-) Submitted and accepted.";
845-
f.acceptedSolution(true);
846-
}
847-
else {
848-
cwarn << ":-( Not accepted.";
849-
f.rejectedSolution(true);
850-
}
851-
//exit(0);
852-
}
853839
else {
854840
f.failedSolution();
855841
cwarn << "FAILURE: GPU gave incorrect result!";

libethcore/EthashAux.h

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,48 @@ namespace eth
3434

3535
struct Solution
3636
{
37-
Nonce nonce;
38-
h256 mixHash;
39-
};
37+
struct Solution
38+
{
39+
Nonce nonce;
40+
h256 mixHash;
41+
h256 headerHash;
42+
h256 seedHash;
43+
h256 boundary;
44+
};
45+
46+
struct Result
47+
{
48+
h256 value;
49+
h256 mixHash;
50+
};
51+
52+
struct WorkPackage
53+
{
54+
WorkPackage() = default;
55+
WorkPackage(Ethash::BlockHeader const& _bh) :
56+
boundary(_bh.boundary()),
57+
headerHash(_bh.hashWithout()),
58+
seedHash(_bh.seedHash())
59+
{ }
60+
void reset() { headerHash = h256(); }
61+
operator bool() const { return headerHash != h256(); }
62+
63+
h256 boundary;
64+
h256 headerHash; ///< When h256() means "pause until notified a new work package is available".
65+
h256 seedHash;
66+
67+
uint64_t startNonce = 0;
68+
int exSizeBits = -1;
69+
};
70+
71+
static const WorkPackage NullWorkPackage;
72+
73+
/// Default value of the local work size. Also known as workgroup size.
74+
static const unsigned defaultLocalWorkSize;
75+
/// Default value of the global work size as a multiplier of the local work size
76+
static const unsigned defaultGlobalWorkSizeMultiplier;
77+
/// Default value of the milliseconds per global work size (per batch)
78+
static const unsigned defaultMSPerBatch;
4079

4180
struct Result
4281
{

libethcore/EthashGPUMiner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ bool EthashGPUMiner::report(uint64_t _nonce)
125125
Nonce n = (Nonce)(u64)_nonce;
126126
Result r = EthashAux::eval(work().seedHash, work().headerHash, n);
127127
if (r.value < work().boundary)
128-
return submitProof(Solution{n, r.mixHash});
128+
return submitProof(Solution{n, r.mixHash, work().headerHash, work().seedHash, work().boundary});
129129
return false;
130130
}
131131

0 commit comments

Comments
 (0)