Skip to content

Asyncio.exceptions.CancelledError inconsistently triggers when using preparesignedtx #61

@PogoDigitalism

Description

@PogoDigitalism

Asyncio.exceptions.CancelledError inconsistently triggers when using preparesignedtx

Example of my code:

# example below on how self.pk is generated
self.pk = hex(secrets.randbits(256))[2:] 


# another class function object
c = cryptos.Bitcoin(testnet=False)

create_signed_tx = c.preparesignedtx(self.pk, 
 self.mainnetAddress,
 self.recipientAddress,
 self.bitcoinTotal-self.est_fee,
 fee=self.est_fee)

self.pk is a key existing out of 256 randomly generated binary digits that are converted into a hexadecimal string (with the 0x, cut off)
self.mainnetAddress is a mainnet bc1 address generated from self.pk.

What causes this CancelledError? Is this a library issue or is this an error on my end.
Does preparesignedtx require a private key in Wallet Import Format?

Full error log:


 Traceback (most recent call last):
   File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/coins_async/base.py", line 1028, in preparesignedtx
     return await self.preparesignedmultirecipienttx(privkey, frm, outs, change_addr=change_addr,
  File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/coins_async/base.py", line 1011, in preparesignedmultirecipienttx
     tx = await self.preparemultitx(frm, outs, fee=fee, change_addr=change_addr,
   File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/coins_async/base.py", line 982, in preparemultitx
     unspents = await self.unspent(frm)
   File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/coins_async/base.py", line 397, in unspent
     unspents = await self.client.unspent(value)
File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/electrumx_client/client.py", line 508, in unspent
return await self.send_request("blockchain.scripthash.listunspent", scripthash)
File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/electrumx_client/client.py", line 389, in send_request
await self._ensure_connected()
 File "/workspace/.heroku/python/lib/python3.9/site-packages/cryptos/electrumx_client/client.py", line 351, in _ensure_connected
done, pending = await asyncio.wait([is_connected_task, self._connection_task],
File "/workspace/.heroku/python/lib/python3.9/asyncio/tasks.py", line 413, in wait
return await _wait(fs, timeout, return_when, loop)
 File "/workspace/.heroku/python/lib/python3.9/asyncio/tasks.py", line 529, in _wait
await waiter
 asyncio.exceptions.CancelledError

Regards,
Pogo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions