Это один из моих методов, и ha sh работает и назначается правильно, но прямо перед выходом из функции "blockHa sh" становится "" и выдает мне вышеуказанную ошибку.
Block::Block(int index, const double amount, const std::string& senderKey,
const std::string&
receiverKey, const std::string& prevHash, time_t timestamp)
:nrTransactions(0)
{
std::string str = std::to_string(amount);
this->blockHash = generateHash(str);
}
Эта функция, по-видимому, является проблемой:
std::string& Block::generateHash(const std::string& str)
{
std::string hash = sha256(str);
return hash;
}
Для первого блока я сделал сумму "0".