Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ Block::Block(uint32_t nIndexIn, const string &sDataIn) : _nIndex(nIndexIn), _sDa

void Block::MineBlock(uint32_t nDifficulty)
{
char cstr[nDifficulty + 1];
#if (_MSC_VER >= 1500)
char* cstr = new char[nDifficulty + 1];
#else
char cstr[nDifficulty + 1];
#endif

for (uint32_t i = 0; i < nDifficulty; ++i)
{
cstr[i] = '0';
Expand All @@ -32,6 +37,10 @@ void Block::MineBlock(uint32_t nDifficulty)
while (sHash.substr(0, nDifficulty) != str);

cout << "Block mined: " << sHash << endl;

#if (_MSC_VER >= 1500)
delete[] cstr;
#endif
}

inline string Block::_CalculateHash() const
Expand Down
1 change: 1 addition & 0 deletions Block.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cstdint>
#include <iostream>
#include <sstream>
#include <time.h>

using namespace std;

Expand Down