diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 7b3e555..3de3db0 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -4040,8 +4040,29 @@ connected: | |||
| 4040 | jobShared.jobSeq++; | 4040 | jobShared.jobSeq++; |
| 4041 | jobShared.haveJob = true; | 4041 | jobShared.haveJob = true; |
| 4042 | } | 4042 | } |
| 4043 | LogPrint("worker", "[pool->worker] new job %s received\n", | 4043 | // Log the chain position the pool is |
| 4044 | jobId.c_str()); | 4044 | // building on, so a stale or private |
| 4045 | // fork is auditable from worker logs. | ||
| 4046 | // The prevhash comes from the header we | ||
| 4047 | // actually hash (== p[2] of the notify); | ||
| 4048 | // a brief cs_main lookup is safe here -- | ||
| 4049 | // this thread holds no other lock. | ||
| 4050 | uint256 hashPrev; | ||
| 4051 | memcpy(&hashPrev, header + 4, 32); | ||
| 4052 | int nPrevHeight = -1; | ||
| 4053 | CRITICAL_BLOCK(cs_main) | ||
| 4054 | { | ||
| 4055 | map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrev); | ||
| 4056 | if (mi != mapBlockIndex.end()) | ||
| 4057 | nPrevHeight = (*mi).second->nHeight; | ||
| 4058 | } | ||
| 4059 | if (nPrevHeight >= 0) | ||
| 4060 | LogPrint("worker", "[pool->worker] new job %s received, prevhash %s (known, job height %d)\n", | ||
| 4061 | jobId.c_str(), hashPrev.GetHex().c_str(), | ||
| 4062 | nPrevHeight + 1); | ||
| 4063 | else | ||
| 4064 | LogPrint("worker", "[pool->worker] new job %s received, prevhash %s (unknown to our chain)\n", | ||
| 4065 | jobId.c_str(), hashPrev.GetHex().c_str()); | ||
| 4045 | SetParticipantMiningStatus("hashing job " + jobId); | 4066 | SetParticipantMiningStatus("hashing job " + jobId); |
| 4046 | } | 4067 | } |
| 4047 | } | 4068 | } |