Skip to content

Commit 595a9bb

Browse files
do some error checking on the users ETH account
1 parent 680b1a7 commit 595a9bb

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

ethminer/MinerAux.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,25 @@ class MinerCLI
416416
exit(-1);
417417
}
418418
string mAcct = ProgOpt::Get("0xBitcoin", "MinerAcct");
419-
string notset("0x....");
420-
if ("" == mAcct || notset == mAcct.substr(0, notset.length()))
419+
LowerCase(mAcct);
420+
u256 mAcctNum;
421+
try
421422
{
422-
LogS << "Please set 'MinerAcct' in tokenminer.ini to a valid ETH account";
423+
mAcctNum = u256(mAcct);
424+
}
425+
catch (...)
426+
{
427+
LogS << "'MinerAcct' contains invalid characters in tokenminer.ini";
428+
exit(0);
429+
}
430+
if (mAcct.substr(0, 2) != "0x")
431+
{
432+
LogS << "Invalid 'MinerAcct' in tokenminer.ini - Miner account should start with '0x'";
433+
exit(0);
434+
}
435+
if (mAcctNum == 0 || mAcct.length() != 42)
436+
{
437+
LogS << "Invalid 'MinerAcct' in tokenminer.ini";
423438
exit(0);
424439
}
425440
LogD << " ";

0 commit comments

Comments
 (0)