dagurval / electrum-cash-protocol

Electrum Cash protocol reference
MIT License
9 stars 6 forks source link

Fetch block chain tip without subscribing #9

Closed dagurval closed 4 years ago

dagurval commented 4 years ago

Currently it looks like you have to subscribe to headers if you want to know the block chain tip

cculianu commented 4 years ago

Hmm. Yeah I guess that's an imperfection. blockchain.headers.gettip? get_tip? tip?

dagurval commented 4 years ago

It's kind of annoying when I just want to hack together a script that pulls the tip every few seconds. Now I have to do the proper way :-).

dagurval commented 4 years ago

I like blockchain.headers.tip.

it's kind of weird though when the two existing header methods are under blockchain.block, while one is in blockchain.headers.

cculianu commented 4 years ago

Ah yeah that makes sense. And I believe right now it actually complains that you're already subscribed, right? IIRC...

I like blockchain.headers.tip.

So do I. Feel free to go with that one. I guess takes 0 parameters [] and returns the same result you'd get from headers.subscribe, right?

dagurval commented 4 years ago

I guess takes 0 parameters [] and returns the same result you'd get from headers.subscribe, right?

:+1:

dagurval commented 4 years ago

Closing in favour of #20