Skip to content

Commit

Permalink
Fix propagation of results from mining threads to main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Vort committed Jul 7, 2023
1 parent f12be04 commit 370d8db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vanitygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

static bool found = false;
static size_t MutateByte;
static uint32_t FoundNonce=0;
static uint8_t * KeyBuf;

unsigned int count_cpu;
Expand Down Expand Up @@ -288,6 +289,7 @@ bool thread_find(uint8_t * buf, const char * prefix, int id_thread, unsigned lon
ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52);
std::cout << "\nFound address: " << addr << std::endl;
found = true;
FoundNonce=*nonce;
return true;
}

Expand Down Expand Up @@ -450,6 +452,8 @@ int main (int argc, char * argv[])
for (unsigned int j = 0; j < (unsigned int)options.threads;j++)
threads[j].join();

memcpy (KeyBuf + MutateByte, &FoundNonce, 4);

if(options.outputpath.empty()) options.outputpath.assign(DEF_OUTNAME);

std::ofstream f (options.outputpath, std::ofstream::binary);
Expand Down

0 comments on commit 370d8db

Please sign in to comment.