Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to access the mempool #26

Open
hz61p1 opened this issue Apr 27, 2021 · 8 comments
Open

Error when trying to access the mempool #26

hz61p1 opened this issue Apr 27, 2021 · 8 comments

Comments

@hz61p1
Copy link

hz61p1 commented Apr 27, 2021

Request

curl --header "Content-Type: application/json" --request POST --data '{"IsMempool":true}' http://localhost:17001/api/v1/transaction-info

Response

{"B1KKKiGg":"UpdateTxindex: Error connecting txn for mempool request: \u003c TxHash: 1cb76d55c2c33e94411c6fc83109d0fc1efc286e0d451f790d888238dbdf4236, TxnType: BC1YLfgstADdBR2TPmY4njYCLafatVibpFn4hGRX2i8zDs34X2pQhqV, PubKey: PRIVATE_MESSAGE \u003e: UpdateTxindex: Error connecting txn to UtxoView: ConnectTransaction: : _connectPrivateMessage: : RuleErrorInputSpendsNonexistentUtxo"}

What i expect

Screenshot from 2021-04-27 16-00-00
If you go to the admin panel on the node and the mempool section, you can see that there are statistics, but when receiving data from the mempool, there is an incomprehensible error. In response, I expect to receive the same information as on the explorer.bitclout.com

@redpartyhat
Copy link

Hi hz61p1, thanks for posting an issue! I have been able to reproduce your error on my machine.

To understand why this is happening, you need a little bit of context about the node. The node syncs in two phases. First, it syncs the blockchain. This creates a database full of all the posts, likes, creator coin buys, etc. This first syncing phase is optimized to be as fast as possible and stores just enough information to handle consensus between the nodes. In the second phase of syncing, the node creates a "TxIndex" (assuming the txindex flag is set to true). This creates a more verbose index of information about every transaction in the block chain. This is useful for things like notifications.

The endpoint "/api/v1/transaction-info" relies on the TxIndex in order to provide the caller with transaction info. Therefore, the error you are seeing is likely happening because your node has finished syncing the blockchain but has not finished building the TxIndex. In that state of the world, the call is fetching all of the mempool transactions and attempting to connect them to an unfinished TxIndex so it cannot find the unspent UTXOs necessary and fails.

Unfortunately, the frontend does not tell you the state of the TxIndex at the moment but I'll take a look at adding it. I'll also look at adding a better error if the TxIndex isn't up to date. In the meantime, you can query your node's logs for "UpdateTxindex" (note the "i" is lowercase) as a work around to get the status of your TxIndex.
image

@hz61p1
Copy link
Author

hz61p1 commented Apr 28, 2021

Is it possible to somehow speed up this process?

@maebeam
Copy link
Contributor

maebeam commented Apr 28, 2021

we're working on TxIndex improvements

@redpartyhat
Copy link

Just FYI-- I have added TxIndex status to the admin panel at the bottom of "Detailed Sync Info" so that it is easier to track.
image

@varunkho
Copy link

varunkho commented Apr 29, 2021

We're also facing somewhat similar issue, most of the time the mempool isn't accessible with error like the following, and also the listing transactions by publicKey (address) also fails most of the time with similar error :
{"Ok1nbQQm":"UpdateTxindex: Error connecting txn for mempool request: \u003c TxHash: 0afb28da9b7e26c923495775b46f5895f650b90a48db9a741d66f9928f330a20, TxnType: BC1YLgVQ4wpTso2zCUXmyGaRAcnQ9giKXEAixvAdMcWZgXKw2ndriHa, PubKey: CREATOR_COIN \u003e: UpdateTxindex: Error connecting txn to UtxoView: ConnectTransaction: : _connectCreatorCoin: : RuleErrorInputSpendsNonexistentUtxo"}

Btw, the historic txindexing has completed. Now only for new blocks it has to perform txindex.

@tijno
Copy link
Contributor

tijno commented May 5, 2021

Seems to be fixed now - may be the switch to stable as per #40 which is now live in main.

@rebelinnovator
Copy link

{
"Error": "UpdateTxindex: Error connecting txn: < TxHash: b7d6f0a31a4f083c98c5837ca3f4b929bbec0d00150bf6eb4753b6ce05e5d5e5, TxnType: BC1YLj8LiXjYeH1mT98sjyKMzD3ebMMQxdQHnFy1Y6o8coMii4rq7Az, PubKey: FOLLOW >: UpdateTxindex: Error connecting txn to UtxoView: ConnectTransaction: : _connectFollow: : RuleErrorInputSpendsNonexistentUtxo"
}
Same issue here.

@p3140
Copy link

p3140 commented May 16, 2021

"Last TxIndex Block Height" needs to be equal to "Last Block Height" in order to get api v1 working. If they are not the same then your TxIndex is still in process of updating (this process took about 15 hours for me with 16 gb of ram).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants