From be931912c6b9ae646a9fd21579478f0bfa4b4dac Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 1 Jun 2012 20:33:34 -0700 Subject: [PATCH] Nonce code broke the unit test because theAPP is NULL --- src/SHAMap.cpp | 6 ++++-- src/SHAMap.h | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/SHAMap.cpp b/src/SHAMap.cpp index 9188e4997a..1329cb81c6 100644 --- a/src/SHAMap.cpp +++ b/src/SHAMap.cpp @@ -15,17 +15,19 @@ #include "SHAMap.h" #include "Application.h" +uint256 hash_SMN::mNonce; + std::size_t hash_SMN::operator() (const SHAMapNode& mn) const { return mn.getDepth() ^ *reinterpret_cast(mn.getNodeID().begin()) - ^ *reinterpret_cast(theApp->getNonce256().begin()); + ^ *reinterpret_cast(mNonce.begin()); } std::size_t hash_SMN::operator() (const uint256& u) const { return *reinterpret_cast(u.begin()) - ^ *reinterpret_cast(theApp->getNonce256().begin()); + ^ *reinterpret_cast(mNonce.begin()); } SHAMap::SHAMap(uint32 seq) : mSeq(seq), mState(Modifying) diff --git a/src/SHAMap.h b/src/SHAMap.h index 480764cec2..09398794a2 100644 --- a/src/SHAMap.h +++ b/src/SHAMap.h @@ -78,7 +78,12 @@ public: class hash_SMN { + public: + static uint256 mNonce; + + static void setNonce(const uint256& nonce) { mNonce = nonce; } + std::size_t operator() (const SHAMapNode& mn) const; std::size_t operator() (const uint256& u) const;