pokt-network / pocket

Official implementation of the Pocket Network Protocol v1
https://pokt.network
MIT License
61 stars 33 forks source link

[bug][rpc] querying unconfirmed transactions fails #930

Open 0xBigBoss opened 11 months ago

0xBigBoss commented 11 months ago

Querying unconfirmed transactions fail currently due to sharing logic with the indexed transaction. The RPC fails with 500 server code anytime a transaction is in the mempool and you attempt to query it.

The error it fails with is the transaction is not committed https://github.com/pokt-network/pocket/blob/45b1142b18ec2bf9df1890db8d3768e460bdb4d0/utility/transaction.go#L55-L57

See https://github.com/pokt-network/pocket/compare/0xbigboss/bug/query-mempool-error for it failing with the e2e tests.

root@dev-cli-client-565546545b-kjbkg:~# p1 query unconfirmedtxs
{"level":"debug","time":"2023-07-23T19:17:54Z","message":"Debug keybase initializing... Restoring from the embedded backup file..."}
❌ RPC reporting unhealthy status HTTP 500 @ http://pocket-validators:50832

CODE: 135, ERROR: the transaction is not committedError: RPC reporting unhealthy status HTTP 500 @ http://pocket-validators:50832
Olshansk commented 11 months ago

@0xBigBoss We'll take a look if someone can pick this up in the next iteration.

CC @dylanlott for context

h5law commented 11 months ago

@0xBigBoss I think this was introduced in #771 https://github.com/pokt-network/pocket/pull/771/files#diff-659e102b74cf8cae4db311100e475bee88ba1be6dd7b450c1e060dfee2fb3761R371

What is going on is that the unconfirmed transactions by nature are not indexed but we are now looking for them in the TxIndexer which only hold the txs that have already left the mempool.

My best guess would be to revert these changes if possible.

Olshansk commented 11 months ago

My best guess would be to revert these changes if possible.

Let's leave the change as is (it's old and the coebase has evolved a lot since then).

@dylanlott will look into this and would be a good opportunity to add a test for it as well.