bibajz / bitcoin-python-async-rpc

Minimal Bitcoin JSON-RPC Python asynchronous client
MIT License
31 stars 12 forks source link

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

Open Mukhametvaleev opened 1 year ago

bibajz commented 1 year ago

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

Mukhametvaleev commented 1 year ago

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