#include using namespace libbitcoin; #include namespace python = boost::python; #include "/home/genjix/python-bitcoin/src/primitive.h" namespace ph = std::placeholders; class tracer : public std::enable_shared_from_this, private coroutine { public: typedef std::vector string_list; typedef std::function< void (const std::error_code&, const string_list&)> finish_handler; tracer(async_service& service, blockchain_ptr chain) : strand_(service.get_service()), chain_(chain) { } void start(const message::transaction& tx, finish_handler handle_finish) { auto this_ptr = shared_from_this(); strand_.post( [&, this_ptr, tx, handle_finish]() { tx_ = std::move(tx); handle_finish_ = std::move(handle_finish); this_ptr->run(std::error_code()); }); } void run(const std::error_code& ec); private: io_service::strand strand_; blockchain_ptr chain_; message::transaction tx_; finish_handler handle_finish_; size_t count_; bool stopped_; std::vector