generate difficulty was passing hash by ref (#2008)

and could go out of scope before the callback was called
copy into lambda instead
This commit is contained in:
Russel Waters 2019-05-21 15:16:54 -04:00 committed by GitHub
commit 24734f64cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4353,7 +4353,7 @@ void nano::json_handler::work_generate ()
{
bool use_peers (request.get_optional<bool> ("use_peers") == true);
auto rpc_l (shared_from_this ());
auto callback = [rpc_l, &hash, this](boost::optional<uint64_t> const & work_a) {
auto callback = [rpc_l, hash, this](boost::optional<uint64_t> const & work_a) {
if (work_a)
{
boost::property_tree::ptree response_l;