bitcoin-python-async-rpc icon indicating copy to clipboard operation
bitcoin-python-async-rpc copied to clipboard

`getbestblockhash` method doesn't allow to set client timeout?

Open Mukhametvaleev opened this issue 2 years ago • 2 comments

Mukhametvaleev avatar Apr 16 '23 19:04 Mukhametvaleev

Hey @Mukhametvaleev , thanks for taking an interest in this library and raising the issue (even though you promtply closed it ;) ).


Actually, to have the ability to set a timeout on every RPC call is a good idea.

Let me think it through a then come up with potential solutions.

Are you in a rush having this feature implemented? It has been some time I touched the code, so I guess I could squeeze in some other ideas that have been brewing in my mind as well. ;)

Thanks again and cheers! Libor

bibajz avatar Apr 16 '23 22:04 bibajz

Hey @Mukhametvaleev , thanks for taking an interest in this library and raising the issue (even though you promtply closed it ;) ).

Actually, to have the ability to set a timeout on every RPC call is a good idea.

Let me think it through a then come up with potential solutions.

Are you in a rush having this feature implemented? It has been some time I touched the code, so I guess I could squeeze in some other ideas that have been brewing in my mind as well. ;)

Thanks again and cheers! Libor

I end up with:

rpc = BitcoinRPC(
    url,
    user,
    password,
    timeout=None,  # <– HERE
)

last_block = await rpc.getbestblockhash()
transaction = await rpc.getrawtransaction(txid, timeout=10)  # <– override timeout above

That`s work for me

Mukhametvaleev avatar Apr 17 '23 00:04 Mukhametvaleev