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