Browse Source

explicit operator bool for hash type

cl-refactor
arkpar 10 years ago
parent
commit
3767677b27
  1. 2
      alethzero/MainWin.cpp
  2. 2
      libdevcore/FixedHash.h
  3. 2
      libdevcrypto/CryptoPP.cpp
  4. 2
      libethcore/ProofOfWork.h
  5. 2
      libethereum/EthereumHost.h
  6. 2
      libethereum/Transaction.h
  7. 2
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  8. 2
      libwhisper/Common.cpp
  9. 4
      mix/ClientModel.cpp

2
alethzero/MainWin.cpp

@ -1629,7 +1629,7 @@ void Main::on_net_triggered()
{
web3()->setIdealPeerCount(ui->idealPeers->value());
web3()->setNetworkPreferences(netPrefs());
ethereum()->setNetworkId(m_privateChain.size() ? sha3(m_privateChain.toStdString()) : 0);
ethereum()->setNetworkId(m_privateChain.size() ? sha3(m_privateChain.toStdString()) : h256());
// TODO: p2p
// if (m_networkConfig.size()/* && ui->usePast->isChecked()*/)
// web3()->restoreNetwork(bytesConstRef((byte*)m_networkConfig.data(), m_networkConfig.size()));

2
libdevcore/FixedHash.h

@ -80,7 +80,7 @@ public:
operator Arith() const { return fromBigEndian<Arith>(m_data); }
/// @returns true iff this is the empty hash.
operator bool() const { return ((Arith)*this) != 0; }
explicit operator bool() const { return ((Arith)*this) != 0; }
// The obvious comparison operators.
bool operator==(FixedHash const& _c) const { return m_data == _c.m_data; }

2
libdevcrypto/CryptoPP.cpp

@ -134,7 +134,7 @@ bool Secp256k1::verify(Signature const& _signature, bytesConstRef _message)
bool Secp256k1::verify(Public const& _p, Signature const& _sig, bytesConstRef _message, bool _hashed)
{
// todo: verify w/o recovery (if faster)
return _p == _hashed ? recover(_sig, _message) : recover(_sig, sha3(_message).ref());
return (bool)_p == _hashed ? (bool)recover(_sig, _message) : (bool)recover(_sig, sha3(_message).ref());
}
Public Secp256k1::recover(Signature _signature, bytesConstRef _message)

2
libethcore/ProofOfWork.h

@ -82,7 +82,7 @@ template <class Evaluator>
std::pair<MineInfo, h256> ProofOfWorkEngine<Evaluator>::mine(h256 const& _root, u256 const& _difficulty, unsigned _msTimeout, bool _continue, bool _turbo)
{
std::pair<MineInfo, h256> ret;
static std::mt19937_64 s_eng((time(0) + (unsigned)m_last));
static std::mt19937_64 s_eng((time(0) + *reinterpret_cast<unsigned*>(m_last.data())));
u256 s = (m_last = h256::random(s_eng));
bigint d = (bigint(1) << 256) / _difficulty;

2
libethereum/EthereumHost.h

@ -94,7 +94,7 @@ private:
h256Set neededBlocks(h256Set const& _exclude);
/// Check to see if the network peer-state initialisation has happened.
bool isInitialised() const { return m_latestBlockSent; }
bool isInitialised() const { return (bool)m_latestBlockSent; }
/// Initialises the network peer-state, doing the stuff that needs to be once-only. @returns true if it really was first.
bool ensureInitialised();

2
libethereum/Transaction.h

@ -81,7 +81,7 @@ public:
Address safeSender() const noexcept;
/// @returns true if transaction is non-null.
operator bool() const { return m_type != NullTransaction; }
explicit operator bool() const { return m_type != NullTransaction; }
/// @returns true if transaction is contract-creation.
bool isCreation() const { return m_type == ContractCreation; }

2
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -704,7 +704,7 @@ std::string WebThreeStubServerBase::eth_transact(Json::Value const& _json)
if (!t.from)
t.from = m_accounts->getDefaultTransactAccount();
if (t.creation)
ret = right160(sha3(rlpList(t.from, client()->countAt(t.from))));;
ret = toJS(right160(sha3(rlpList(t.from, client()->countAt(t.from)))));;
if (!t.gasPrice)
t.gasPrice = 10 * dev::eth::szabo;
if (!t.gas)

2
libwhisper/Common.cpp

@ -71,7 +71,7 @@ bool TopicFilter::matches(Envelope const& _e) const
for (unsigned i = 0; i < t.size(); ++i)
{
for (auto et: _e.topic())
if (((t[i].first ^ et) & t[i].second) == 0)
if (((t[i].first ^ et) & t[i].second) == CollapsedTopicPart())
goto NEXT_TOPICPART;
// failed to match topicmask against any topics: move on to next mask
goto NEXT_TOPICMASK;

4
mix/ClientModel.cpp

@ -370,7 +370,7 @@ void ClientModel::onNewTransaction()
QString function;
QString returned;
bool creation = tr.contractAddress != 0;
bool creation = (bool)tr.contractAddress;
//TODO: handle value transfer
FixedHash<4> functionHash;
@ -403,7 +403,7 @@ void ClientModel::onNewTransaction()
if (creation)
returned = QString::fromStdString(toJS(tr.contractAddress));
Address contractAddress = tr.address != 0 ? tr.address : tr.contractAddress;
Address contractAddress = (bool)tr.address ? tr.address : tr.contractAddress;
auto contractAddressIter = m_contractNames.find(contractAddress);
if (contractAddressIter != m_contractNames.end())
{

Loading…
Cancel
Save