lbryio / lbry-sdk

The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.
https://lbry.com
MIT License
7.2k stars 483 forks source link

test_transaction_show: AttributeError: 'dict' object has no attribute 'id' #3665

Closed moodyjon closed 1 year ago

moodyjon commented 1 year ago

test_transaction_show needs some kind of fix to wait for the transaction to be available. The sleep(0.2) is not a guarantee that it's in the wallet DB. In this case, even the fallback logic that asks hub to find it may not work.

https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596

test_transaction_show (integration.transactions.test_transaction_commands.TransactionCommandsTestCase) ... 2022-09-15 18:42:09,957 - asyncio - WARNING - Executing <Task pending coro=<CommandTestCase.asyncSetUp() running at /home/runner/work/lbry-sdk/lbry-sdk/lbry/testcase.py:415> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7eff6dd33990>()] created at /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/base_events.py:395> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/base_events.py:157] created at /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/base_events.py:566> took 0.378 seconds
[93](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:94)
2022-09-15 18:42:10,777 - elasticsearch - WARNING - GET http://localhost:9200/_template/c0342065774a4d25b1beec96598253c8claims [status:404 request:0.004s]
[94](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:95)
2022-09-15 18:42:11,873 - lbry.wallet.network - WARNING - wait reconnect+keepalive
[95](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:96)
2022-09-15 18:42:12,001 - lbry.wallet.ledger - WARNING - initial status update address mmAYr7M7kTCjDfbPrpgHpVN58QYnET3tsF status None
[...snip...]
[133](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:134)
2022-09-15 18:42:13,726 - lbry.wallet.ledger - WARNING - updated address: mmAYr7M7kTCjDfbPrpgHpVN58QYnET3tsF history: 622bc0cda9d5cf356ecbb2172d31f09c2c3e4a1f625d7d229411096ad7243017:201:a4a8df2deaedb00a1b7d2e92550453c1fe6b6b5de7f4025a405469a67089505f:0:
[134](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:135)
2022-09-15 18:42:13,748 - lbry.wallet.ledger - WARNING - initial status update address myzui3ubeWRAmzkSJbdHShfeqTTU9o9mm7 status None
[135](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:136)
2022-09-15 18:42:13,984 - lbry.wallet.ledger - WARNING - initial status update address mkmNs3bDigDvUNyjQj26bhdJqFby6EXKvE status None
[136](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:137)
2022-09-15 18:42:13,984 - lbry.wallet.ledger - WARNING - initial status update address n1F7KVResXS2KYdFhdQbZsFvCem3ZHfkRm status None
[137](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:138)
2022-09-15 18:42:13,985 - lbry.wallet.ledger - WARNING - initial status update address mzRKJkB2D3AzanuCMsqRRKDJsRNNsyqYVD status None
[138](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:139)
2022-09-15 18:42:13,985 - lbry.wallet.ledger - WARNING - initial status update address mx5BREokLeeDKQzwRfki3kBYkvbJKe24Cv status None
[139](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:140)
2022-09-15 18:42:14,307 - lbry.wallet.ledger - WARNING - status update address mvS49mJLvvMJLgbg9hYcc1b55p2FY4Z2ng status 72facda13a000bc4d92cbb5ac48219a2aba09c7b9e7238479cb48e85710999e6
[140](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:141)
2022-09-15 18:42:14,309 - lbry.wallet.ledger - WARNING - status update address mwZ6PNHUoC6rsAEk7jAd9mPYcHBbWyKURS status 72facda13a000bc4d92cbb5ac48219a2aba09c7b9e7238479cb48e85710999e6
[141](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:142)
2022-09-15 18:42:14,312 - lbry.wallet.ledger - WARNING - status update address mmAYr7M7kTCjDfbPrpgHpVN58QYnET3tsF status a03d20b95304d4bab1fda56cd85ccb809822edcf4d5b392815f94cf363e20617
[142](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:143)
2022-09-15 18:42:14,314 - lbry.wallet.ledger - WARNING - status update address mvS49mJLvvMJLgbg9hYcc1b55p2FY4Z2ng status 72facda13a000bc4d92cbb5ac48219a2aba09c7b9e7238479cb48e85710999e6
[143](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:144)
2022-09-15 18:42:14,317 - lbry.wallet.ledger - WARNING - status update address mwZ6PNHUoC6rsAEk7jAd9mPYcHBbWyKURS status 72facda13a000bc4d92cbb5ac48219a2aba09c7b9e7238479cb48e85710999e6
[144](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:145)
2022-09-15 18:42:14,319 - lbry.wallet.ledger - WARNING - status update address mmAYr7M7kTCjDfbPrpgHpVN58QYnET3tsF status a03d20b95304d4bab1fda56cd85ccb809822edcf4d5b392815f94cf363e20617
[145](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:146)
2022-09-15 18:42:14,351 - lbry.wallet.ledger - WARNING - updated address: mvS49mJLvvMJLgbg9hYcc1b55p2FY4Z2ng history: a4a8df2deaedb00a1b7d2e92550453c1fe6b6b5de7f4025a405469a67089505f:207:
[146](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:147)
2022-09-15 18:42:14,356 - lbry.wallet.ledger - WARNING - updated address: mwZ6PNHUoC6rsAEk7jAd9mPYcHBbWyKURS history: a4a8df2deaedb00a1b7d2e92550453c1fe6b6b5de7f4025a405469a67089505f:207:
[147](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:148)
2022-09-15 18:42:14,366 - lbry.wallet.ledger - WARNING - updated address: mmAYr7M7kTCjDfbPrpgHpVN58QYnET3tsF history: 622bc0cda9d5cf356ecbb2172d31f09c2c3e4a1f625d7d229411096ad7243017:201:a4a8df2deaedb00a1b7d2e92550453c1fe6b6b5de7f4025a405469a67089505f:207:
[148](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:149)
2022-09-15 18:42:14,697 - lbry.wallet.network - WARNING - Wallet server (localhost:50002) returned an error. Code: 1 Message: No such mempool or blockchain transaction.
[149](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:150)
ERROR

Note the message "Wallet server (localhost:50002) returned an error. Code: 1 Message: No such mempool or blockchain transaction."

======================================================================
[1068](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1069)
ERROR: test_transaction_show (integration.transactions.test_transaction_commands.TransactionCommandsTestCase)
[1069](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1070)
----------------------------------------------------------------------
[1070](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1071)
Traceback (most recent call last):
[1071](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1072)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/testcase.py", line 145, in run
[1072](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1073)
    self.loop.run_until_complete(maybe_coroutine)
[1073](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1074)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
[1074](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1075)
    return future.result()
[1075](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1076)
  File "/home/runner/work/lbry-sdk/lbry-sdk/tests/integration/transactions/test_transaction_commands.py", line 34, in test_transaction_show
[1076](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1077)
    self.assertEqual(tx.id, sendtxid)
[1077](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1078)
AttributeError: 'dict' object has no attribute 'id'
[1078](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1079)

[1079](https://github.com/moodyjon/lbry-sdk/actions/runs/3062809998/jobs/4944195596#step:11:1080)
----------------------------------------------------------------------

Test code:

        # someone's tx
        change_address = await self.blockchain.get_raw_change_address()
        sendtxid = await self.blockchain.send_to_address(change_address, 10)
        await asyncio.sleep(0.2)
        tx = await self.daemon.jsonrpc_transaction_show(sendtxid)
        self.assertEqual(tx.id, sendtxid)               <<<<<<<<<<<<<<<<<< FAIL here, tx is probably an error response
        self.assertEqual(tx.height, -1)
moodyjon commented 1 year ago

Another: https://github.com/moodyjon/lbry-sdk/actions/runs/3090413234/jobs/4999177142 https://github.com/moodyjon/lbry-sdk/actions/runs/3090620924/jobs/4999656754

moodyjon commented 1 year ago

Another: https://github.com/moodyjon/lbry-sdk/actions/runs/3099633718/jobs/5019008241