| 667 | // ---------------------------------------------------------------------------- |
| 668 | |
| 669 | void VanitySearch::output(string addr,string pAddr,string pAddrHex) { |
| 670 | |
| 671 | #ifdef WIN64 |
| 672 | WaitForSingleObject(ghMutex,INFINITE); |
| 673 | #else |
| 674 | pthread_mutex_lock(&ghMutex); |
| 675 | #endif |
| 676 | |
| 677 | FILE *f = stdout; |
| 678 | bool needToClose = false; |
| 679 | |
| 680 | if (outputFile.length() > 0) { |
| 681 | f = fopen(outputFile.c_str(), "a"); |
| 682 | if (f == NULL) { |
| 683 | printf("Cannot open %s for writing\n", outputFile.c_str()); |
| 684 | f = stdout; |
| 685 | } else { |
| 686 | needToClose = true; |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | if(!needToClose) |
| 691 | printf("\n"); |
| 692 | |
| 693 | fprintf(f, "PubAddress: %s\n", addr.c_str()); |
| 694 | |
| 695 | if (startPubKeySpecified) { |
| 696 | |
| 697 | fprintf(f, "PartialPriv: %s\n", pAddr.c_str()); |
| 698 | |
| 699 | } else { |
| 700 | |
| 701 | switch (searchType) { |
| 702 | case P2PKH: |
| 703 | fprintf(f, "Priv (WIF): p2pkh:%s\n", pAddr.c_str()); |
| 704 | break; |
| 705 | case P2SH: |
| 706 | fprintf(f, "Priv (WIF): p2wpkh-p2sh:%s\n", pAddr.c_str()); |
| 707 | break; |
| 708 | case BECH32: |
| 709 | fprintf(f, "Priv (WIF): p2wpkh:%s\n", pAddr.c_str()); |
| 710 | break; |
| 711 | } |
| 712 | fprintf(f, "Priv (HEX): 0x%s\n", pAddrHex.c_str()); |
| 713 | |
| 714 | } |
| 715 | |
| 716 | if(needToClose) |
| 717 | fclose(f); |
| 718 | |
| 719 | #ifdef WIN64 |
| 720 | ReleaseMutex(ghMutex); |
| 721 | #else |
| 722 | pthread_mutex_unlock(&ghMutex); |
| 723 | #endif |
| 724 | |
| 725 | } |
| 726 |
nothing calls this directly
no outgoing calls
no test coverage detected