:: Re: [Libbitcoin] How to poll with l…
Top Page
Delete this message
Reply to this message
Author: William Swanson
Date:  
To: Amir Taaki
CC: libbitcoin@lists.dyne.org
Subject: Re: [Libbitcoin] How to poll with libbitcoin-client?
I agree that the current cli-based example is a bit complicated. I
originally had everything in one file for teaching purposes, but the
code is harder to follow now that it's been split. We really need a
nice, single-file example program that shows the most basic usage.

Well, here it is:

https://github.com/libbitcoin/libbitcoin-client/pull/73

Hopefully this is clearer.

-William


On Sat, Jan 24, 2015 at 12:37 AM, Phillip Mienk <mienkphi@???> wrote:
> 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
>
>
>
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin
>