diff --git a/libdevcore/CommonJS.cpp b/libdevcore/CommonJS.cpp index 49062197a..3e951f342 100644 --- a/libdevcore/CommonJS.cpp +++ b/libdevcore/CommonJS.cpp @@ -7,13 +7,13 @@ bytes dev::eth::jsToBytes(std::string const& _s) { if (_s.substr(0, 2) == "0x") // Hex - return fromHex(_s.substr(2)); - else if (_s.find_first_not_of("0123456789") == std::string::npos) - // Decimal - return toCompactBigEndian(bigint(_s)); - else - // Binary - return asBytes(_s); + return fromHex(_s.substr(2)); + else if (_s.find_first_not_of("0123456789") == std::string::npos) + // Decimal + return toCompactBigEndian(bigint(_s)); + else + // Binary + return asBytes(_s); } std::string dev::eth::jsPadded(std::string const& _s, unsigned _l, unsigned _r) diff --git a/libdevcore/CommonJS.h b/libdevcore/CommonJS.h index 564d5de74..ea9d580a3 100644 --- a/libdevcore/CommonJS.h +++ b/libdevcore/CommonJS.h @@ -42,20 +42,20 @@ template FixedHash jsToFixed(std::string const& _s) inline std::string jsToFixed(double _s) { - return toJS(dev::u256(_s * (double)(dev::u256(1) << 128))); + return toJS(dev::u256(_s * (double)(dev::u256(1) << 128))); } template boost::multiprecision::number> jsToInt(std::string const& _s) { - if (_s.substr(0, 2) == "0x") - // Hex - return fromBigEndian>>(fromHex(_s.substr(2))); - else if (_s.find_first_not_of("0123456789") == std::string::npos) - // Decimal - return boost::multiprecision::number>(_s); - else - // Binary - return fromBigEndian>>(asBytes(jsPadded(_s, N))); + if (_s.substr(0, 2) == "0x") + // Hex + return fromBigEndian>>(fromHex(_s.substr(2))); + else if (_s.find_first_not_of("0123456789") == std::string::npos) + // Decimal + return boost::multiprecision::number>(_s); + else + // Binary + return fromBigEndian>>(asBytes(jsPadded(_s, N))); } inline Address jsToAddress(std::string const& _s) { return jsToFixed<20>(_s); } @@ -64,38 +64,38 @@ inline u256 jsToU256(std::string const& _s) { return jsToInt<32>(_s); } inline std::string jsToBinary(std::string const& _s) { - return jsUnpadded(dev::toString(jsToBytes(_s))); + return jsUnpadded(dev::toString(jsToBytes(_s))); } inline std::string jsToDecimal(std::string const& _s) { - return dev::toString(jsToU256(_s)); + return dev::toString(jsToU256(_s)); } inline std::string jsFromBinary(dev::bytes _s, unsigned _padding = 32) { - _s.resize(std::max(_s.size(), _padding)); - return "0x" + dev::toHex(_s); + _s.resize(std::max(_s.size(), _padding)); + return "0x" + dev::toHex(_s); } inline std::string jsFromBinary(std::string const& _s, unsigned _padding = 32) { - return jsFromBinary(asBytes(_s), _padding); + return jsFromBinary(asBytes(_s), _padding); } inline double jsFromFixed(std::string const& _s) { - return (double)jsToU256(_s) / (double)(dev::u256(1) << 128); + return (double)jsToU256(_s) / (double)(dev::u256(1) << 128); } struct TransactionJS { - Secret from; - Address to; - u256 value; - bytes data; - u256 gas; - u256 gasPrice; + Secret from; + Address to; + u256 value; + bytes data; + u256 gas; + u256 gasPrice; }; diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 0de174cfc..d07bb71f3 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -159,8 +159,7 @@ void BlockChain::open(std::string _path, bool _killExisting) m_lastBlockHash = l.empty() ? m_genesisHash : *(h256*)l.data(); - cnote << _path; - cnote << "Opened blockchain DB. Latest: " << currentHash(); + cnote << "Opened blockchain DB. Latest: " << currentHash(); } void BlockChain::close()