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

Light client inconsistently reporting transaction not found for a non-existent transaction. #144

Open
jordanmack opened this issue May 9, 2023 · 3 comments

Comments

@jordanmack
Copy link

jordanmack commented May 9, 2023

I set up a local testnet ckb light client and I'm trying to query for the following transaction.

https://explorer.nervos.org/transaction/0x4bb9a6969c516dcf98f5b79271b056294190ddb3c70509f3fb089fe1097efa33

The results I get are inconsistent using fetch_transaction. If I query repeatedly I get "not_found", "fetching", and "added". It should never be present since this hash is a mainnet transaction, not testnet. Are these results expected?

Query

{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "fetch_transaction",
  "params": ["0x4bb9a6969c516dcf98f5b79271b056294190ddb3c70509f3fb089fe1097efa33"]
}

Results

{
	"jsonrpc": "2.0",
	"result": {
		"status": "not_found"
	},
	"id": 42
}
{
	"jsonrpc": "2.0",
	"result": {
		"first_sent": "0x187fef819ab",
		"status": "fetching"
	},
	"id": 42
}
{
	"jsonrpc": "2.0",
	"result": {
		"status": "added",
		"timestamp": "0x187fef9f6e6"
	},
	"id": 42
}

A query using get_transaction always returns unknown.

@quake
Copy link
Member

quake commented May 17, 2023

yes, it's by design.

@jordanmack
Copy link
Author

When is fetch_transaction supposed to be used? I do not understand it's usage based on the RPC description.

@quake
Copy link
Member

quake commented May 25, 2023

When the user sends a transaction through the light client, it will verify the transaction locally before broadcasting to the network, and if the inputs or cell deps are not locally available, for example, if a lock or type script is used that is not in the genesis block, it needs to be pre-fetched with this rpc before it can be verified successfully.

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

2 participants