XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.5k stars 1.45k forks source link

Running `ledger_request` does not provide access to transactions in that ledger. #2800

Open RaghavSood opened 5 years ago

RaghavSood commented 5 years ago

rippled 1.1.1

I'm running a rippled instance with a limited history, and would like to query past transactions. I have the transaction ID and the ledger index for the ledger it belongs to.

Expected Behaviour

rippled ledger_request 43459471 # run as many times as necessary to receive a successfully acquired status
rippled tx 89584DA17D646BE894DC1C17BEACC78B055144A8CB677BCB61800A2E26F9664A # Fetch tx info

Actual Behaviour

The ledger_request succeeds, but attempting to retrieve the transaction still returns txnNotFound. I have also tried to run ledger_cleaner with the given ledger to attempt to fix any missing nodes, and to import the ledger immediately before the one my tx is in, since the docs say you need a previous state to replay the tx. I have also then run ledger_cleaner again.

However, in all scenarios, I consistently get txnNotFound.

After all this, according to server info, I have:

"complete_ledgers" : "43522088-43529425,43529610-43529693,43530243-43530252,43530390-43530393,43530627,43530853-43530930,43531070-43531137,43531238-43531407,43531508,43531730-43531870,43532121-43532204,43532316-43532352,43532481-43532482,43532654-43532752,43532857-43532865,43532980-43533000,43533123,43534437-43534510,43534540-43543085",

The desired ledger of 43459471 is outside this range, although it is my understanding that ledger_request should fetch it.

mDuo13 commented 5 years ago

Right, the server doesn't add the one-off ledger to its available history, and that's annoying. It should be better.

For now, you may be able to work around the issue by using transaction_entry with the ledger and transaction hash rather than using tx. (See also #2598 to add that functionality to tx so you don't have to use the deprecated transaction_entry command.)

RaghavSood commented 5 years ago

I've already tried that, but I've had mixed results. transaction_entry worked for me once, but now when I run rippled transaction_entry 89584DA17D646BE894DC1C17BEACC78B055144A8CB677BCB61800A2E26F9664A 43459471 after ledger_request says the ledger is available, I just get ledgerNotFound responses. I've tried with multiple transactions, and I'm not sure what changed.

nbougalis commented 3 years ago

We should reconsider the decision to not save a ledger that is explicitly requested via ledger_request in the database.

mDuo13 commented 3 years ago

While we're at it, consider fixing #1873 as well.