// Copyright (c) 2011-2016 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include namespace Tests { class NodeCallback { public: CryptoNote::INode::Callback callback() { prom = std::promise(); // reset std::promise result = prom.get_future(); return [this](std::error_code ec) { std::promise localPromise(std::move(prom)); localPromise.set_value(ec); }; } std::error_code get() { return result.get(); } private: std::promise prom; std::future result; }; }