:: Re: [Libbitcoin] How to poll with l…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Phillip Mienk
Ημερομηνία:  
Προς: Amir Taaki
Υ/ο: libbitcoin@lists.dyne.org
Αντικείμενο: Re: [Libbitcoin] How to poll with libbitcoin-client?
I believe you're on the right track. The approach used in
libbitcoin-explorer (
https://github.com/libbitcoin/libbitcoin-explorer/blob/master/src/obelisk_client.cpp#L77)
looks similar. It avoids the global stopped flag and relies on the
existence of an outstanding callback known to the codec.

Utilizing a similar approach you could removed the global flag and rely on
the success handler for fetch_history to call
obelisk_codec::fetch_transaction, keeping the loop alive (requiring codec
access either via closure or scope state). I personally prefer this as it
allows avoidance of global state.

I don't believe the approach is over-engineered, and in the case of
libbitcoin-explorer the approach was determined to avoid expiration
callback mistakes.

-- Phillip



On Fri, Jan 23, 2015 at 7:59 PM, Amir Taaki <genjix@???> wrote:

> Hi,
>
> I just have a simple app which will first fetch_history, then fetch a
> transaction.
>
> How should I write this poller code? I was very confused by the cli.cpp
> example in libbitcoin-client.
>
> https://github.com/darkwallet/darkleaks/blob/master/dl_check_addr.cpp#L122
>
> Is this over-engineered for my case / is there something simpler I can do?
>
> Thanks.
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin
>