Browse Source

Remove some debug output.

Make hash construction safer.
cl-refactor
Gav Wood 11 years ago
parent
commit
bdeaf497b0
  1. 2
      libethereum/BlockChain.cpp
  2. 2
      libethereum/Common.cpp
  3. 3
      libethereum/Common.h
  4. 8
      test/main.cpp

2
libethereum/BlockChain.cpp

@ -212,7 +212,7 @@ void BlockChain::checkConsistency()
for (it->SeekToFirst(); it->Valid(); it->Next())
if (it->key().size() == 32)
{
h256 h((byte const*)it->key().data());
h256 h((byte const*)it->key().data(), h256::ConstructFromPointer);
auto dh = details(h);
auto p = dh.parent;
if (p != h256())

2
libethereum/Common.cpp

@ -38,7 +38,7 @@
using namespace std;
using namespace eth;
#define ETH_ADDRESS_DEBUG 1
//#define ETH_ADDRESS_DEBUG 1
// Logging
int eth::g_logVerbosity = 8;

3
libethereum/Common.h

@ -78,11 +78,12 @@ class FixedHash
public:
enum { size = N };
enum ConstructFromPointerType { ConstructFromPointer };
FixedHash() { m_data.fill(0); }
FixedHash(Arith const& _arith) { toBigEndian(_arith, m_data); }
explicit FixedHash(bytes const& _b) { memcpy(m_data.data(), _b.data(), std::min<uint>(_b.size(), N)); }
explicit FixedHash(byte const* _bs) { memcpy(m_data.data(), _bs, N); }
explicit FixedHash(byte const* _bs, ConstructFromPointerType) { memcpy(m_data.data(), _bs, N); }
operator Arith() const { return fromBigEndian<Arith>(m_data); }

8
test/main.cpp

@ -41,10 +41,10 @@ int main(int argc, char** argv)
std::cout << asHex(s.out()) << std::endl;
std::cout << sha3(s.out()) << std::endl;*/
// hexPrefixTest();
// rlpTest();
// trieTest();
// daggerTest();
hexPrefixTest();
rlpTest();
trieTest();
daggerTest();
cryptoTest();
// stateTest();
// peerTest(argc, argv);

Loading…
Cancel
Save