diff options
Diffstat (limited to 'src/main_gui.cpp')
| -rw-r--r-- | src/main_gui.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 976cd42..2484592 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp | |||
| @@ -70,6 +70,9 @@ static void PrintUsage() | |||
| 70 | printf("Wallet:\n"); | 70 | printf("Wallet:\n"); |
| 71 | printf(" /backupwallet=FILE (write a wallet.dat that opens on its own,\n"); | 71 | printf(" /backupwallet=FILE (write a wallet.dat that opens on its own,\n"); |
| 72 | printf(" then exit; run it again after new addresses)\n"); | 72 | printf(" then exit; run it again after new addresses)\n"); |
| 73 | printf(" /dumpwallet=FILE (export private keys as text -- readable by\n"); | ||
| 74 | printf(" anyone, so guard it like cash)\n"); | ||
| 75 | printf(" /importwallet=FILE (load keys from such a file back in)\n"); | ||
| 73 | printf("\n"); | 76 | printf("\n"); |
| 74 | printf("Each option also accepts '-' instead of '/'.\n"); | 77 | printf("Each option also accepts '-' instead of '/'.\n"); |
| 75 | } | 78 | } |
| @@ -245,6 +248,36 @@ int main(int argc, char* argv[]) | |||
| 245 | return fOk ? 0 : 1; | 248 | return fOk ? 0 : 1; |
| 246 | } | 249 | } |
| 247 | 250 | ||
| 251 | string strDump = argval2(argc, argv, "/dumpwallet", "-dumpwallet"); | ||
| 252 | if (!strDump.empty()) | ||
| 253 | { | ||
| 254 | bool fOk = DumpWallet(strDump); | ||
| 255 | if (fOk) | ||
| 256 | { | ||
| 257 | printf("Wrote %s\n", strDump.c_str()); | ||
| 258 | printf("It holds your private keys as readable text. Anyone with the file " | ||
| 259 | "can spend these coins -- keep it off shared storage and delete it " | ||
| 260 | "once you have it somewhere safe.\n"); | ||
| 261 | } | ||
| 262 | else | ||
| 263 | fprintf(stderr, "Export failed -- nothing was written.\n"); | ||
| 264 | DBFlush(true); | ||
| 265 | return fOk ? 0 : 1; | ||
| 266 | } | ||
| 267 | |||
| 268 | string strImport = argval2(argc, argv, "/importwallet", "-importwallet"); | ||
| 269 | if (!strImport.empty()) | ||
| 270 | { | ||
| 271 | int nAdded = 0, nSkipped = 0; | ||
| 272 | bool fOk = ImportWallet(strImport, nAdded, nSkipped); | ||
| 273 | if (fOk) | ||
| 274 | printf("Imported %d key(s); %d were already here.\n", nAdded, nSkipped); | ||
| 275 | else | ||
| 276 | fprintf(stderr, "Import failed.\n"); | ||
| 277 | DBFlush(true); | ||
| 278 | return fOk ? 0 : 1; | ||
| 279 | } | ||
| 280 | |||
| 248 | ReacceptWalletTransactions(); | 281 | ReacceptWalletTransactions(); |
| 249 | 282 | ||
| 250 | if (!StartNode(strErrors)) { fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); return 1; } | 283 | if (!StartNode(strErrors)) { fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); return 1; } |