|
|
@ -258,7 +258,23 @@ int main(int argc, char** argv) |
|
|
|
else if ((arg == "-c" || arg == "--client-name") && i + 1 < argc) |
|
|
|
clientName = argv[++i]; |
|
|
|
else if ((arg == "-a" || arg == "--address" || arg == "--coinbase-address") && i + 1 < argc) |
|
|
|
coinbase = h160(fromHex(argv[++i])); |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
coinbase = h160(fromHex(argv[++i], ThrowType::Throw)); |
|
|
|
} |
|
|
|
catch (BadHexCharacter& _e) |
|
|
|
{ |
|
|
|
cwarn << "invalid hex character, coinbase rejected"; |
|
|
|
cwarn << boost::diagnostic_information(_e); |
|
|
|
break; |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cwarn << "coinbase rejected"; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else if ((arg == "-s" || arg == "--secret") && i + 1 < argc) |
|
|
|
us = KeyPair(h256(fromHex(argv[++i]))); |
|
|
|
else if ((arg == "-d" || arg == "--path" || arg == "--db-path") && i + 1 < argc) |
|
|
@ -532,9 +548,21 @@ int main(int argc, char** argv) |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Secret secret = h256(fromHex(sechex)); |
|
|
|
Address dest = h160(fromHex(hexAddr)); |
|
|
|
c->transact(secret, amount, dest, data, gas, gasPrice); |
|
|
|
try |
|
|
|
{ |
|
|
|
Secret secret = h256(fromHex(sechex)); |
|
|
|
Address dest = h160(fromHex(hexAddr)); |
|
|
|
c->transact(secret, amount, dest, data, gas, gasPrice); |
|
|
|
} |
|
|
|
catch (BadHexCharacter& _e) |
|
|
|
{ |
|
|
|
cwarn << "invalid hex character, transaction rejected"; |
|
|
|
cwarn << boost::diagnostic_information(_e); |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cwarn << "transaction rejected"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -583,8 +611,20 @@ int main(int argc, char** argv) |
|
|
|
auto blockData = bc.block(h); |
|
|
|
BlockInfo info(blockData); |
|
|
|
u256 minGas = (u256)Client::txGas(bytes(), 0); |
|
|
|
Address dest = h160(fromHex(hexAddr)); |
|
|
|
c->transact(us.secret(), amount, dest, bytes(), minGas); |
|
|
|
try |
|
|
|
{ |
|
|
|
Address dest = h160(fromHex(hexAddr, ThrowType::Throw)); |
|
|
|
c->transact(us.secret(), amount, dest, bytes(), minGas); |
|
|
|
} |
|
|
|
catch (BadHexCharacter& _e) |
|
|
|
{ |
|
|
|
cwarn << "invalid hex character, transaction rejected"; |
|
|
|
cwarn << boost::diagnostic_information(_e); |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cwarn << "transaction rejected"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -615,14 +655,30 @@ int main(int argc, char** argv) |
|
|
|
{ |
|
|
|
cnote << "Assembled:"; |
|
|
|
stringstream ssc; |
|
|
|
init = fromHex(sinit); |
|
|
|
try |
|
|
|
{ |
|
|
|
init = fromHex(sinit, ThrowType::Throw); |
|
|
|
} |
|
|
|
catch (BadHexCharacter& _e) |
|
|
|
{ |
|
|
|
cwarn << "invalid hex character, code rejected"; |
|
|
|
cwarn << boost::diagnostic_information(_e); |
|
|
|
init = bytes(); |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cwarn << "code rejected"; |
|
|
|
init = bytes(); |
|
|
|
} |
|
|
|
ssc.str(string()); |
|
|
|
ssc << disassemble(init); |
|
|
|
cnote << "Init:"; |
|
|
|
cnote << ssc.str(); |
|
|
|
} |
|
|
|
u256 minGas = (u256)Client::txGas(init, 0); |
|
|
|
if (endowment < 0) |
|
|
|
if (!init.size()) |
|
|
|
cwarn << "Contract creation aborted, no init code."; |
|
|
|
else if (endowment < 0) |
|
|
|
cwarn << "Invalid endowment"; |
|
|
|
else if (gas < minGas) |
|
|
|
cwarn << "Minimum gas amount is" << minGas; |
|
|
@ -759,8 +815,22 @@ int main(int argc, char** argv) |
|
|
|
if (hexAddr.length() != 40) |
|
|
|
cwarn << "Invalid address length: " << hexAddr.length(); |
|
|
|
else |
|
|
|
coinbase = h160(fromHex(hexAddr)); |
|
|
|
} |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
coinbase = h160(fromHex(hexAddr, ThrowType::Throw)); |
|
|
|
} |
|
|
|
catch (BadHexCharacter& _e) |
|
|
|
{ |
|
|
|
cwarn << "invalid hex character, coinbase rejected"; |
|
|
|
cwarn << boost::diagnostic_information(_e); |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cwarn << "coinbase rejected"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
cwarn << "Require parameter: setAddress HEXADDRESS"; |
|
|
|
} |
|
|
|