XRPLF / rippled

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

account_tx not returning received transactions #2832

Closed tgreco closed 5 years ago

tgreco commented 5 years ago

I am running:

/usr/bin/curl -H "Content-Type: application/json" -X POST -d '{"method": "account_tx","params": [{"account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq","binary": false,"forward": false,"ledger_index_max": -1,"ledger_index_min": -1}]}' http://127.0.0.1:5005

However the only thing returned are sent transactions not received.

I am getting

[ { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20778043", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20768053" }, "PreviousTxnID": "2446C96FD6200541FA0BD5FB2E73D8346F8D7F6AEC392DAC7259793510EB05BD", "PreviousTxnLgrSeq": 44603835 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39200851", "Flags": 131072, "OwnerCount": 0, "Sequence": 40 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39210851", "Sequence": 39 }, "PreviousTxnID": "2446C96FD6200541FA0BD5FB2E73D8346F8D7F6AEC392DAC7259793510EB05BD", "PreviousTxnLgrSeq": 44603835 } } ], "TransactionIndex": 5, "TransactionResult": "tesSUCCESS", "delivered_amount": "9990" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "9990", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44603965, "Sequence": 39, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "304402203C4AA51DC1469486715490C7C0AD04511DDDBBFD6E0550A30A0221D95BD2A50402205F108A7126A801C66832D089AB6464A563D7C0D60E24543F4CABF40C684B268B", "date": 601534540, "hash": "80505FFBFABC9359EA31298BA6388693B56B40FD290F455C650E2A85ED973C00", "inLedger": 44603963, "ledger_index": 44603963 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20768053", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20758063" }, "PreviousTxnID": "20ABA0226A0B80FD131F396A4735A1BAF133DDA342CC5D279C6715F825A9EE90", "PreviousTxnLgrSeq": 44603509 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39210851", "Flags": 131072, "OwnerCount": 0, "Sequence": 39 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39220851", "Sequence": 38 }, "PreviousTxnID": "20ABA0226A0B80FD131F396A4735A1BAF133DDA342CC5D279C6715F825A9EE90", "PreviousTxnLgrSeq": 44603509 } } ], "TransactionIndex": 15, "TransactionResult": "tesSUCCESS", "delivered_amount": "9990" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "9990", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44603837, "Sequence": 38, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "30440220442A89C01B64403AD1CEFDE34461E07194C68561942043486EDAEF2D13713EFB022005FD2CC8C6F3CB1917D36EB4FC8C042D343A0E069173B6FB97230B761FDA9EDE", "date": 601534080, "hash": "2446C96FD6200541FA0BD5FB2E73D8346F8D7F6AEC392DAC7259793510EB05BD", "inLedger": 44603835, "ledger_index": 44603835 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20758063", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20748073" }, "PreviousTxnID": "B9506986CD97BC8E531A62D8A0B11ED0936450830D048EB8388E0A2C6B61B16D", "PreviousTxnLgrSeq": 44601301 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39220851", "Flags": 131072, "OwnerCount": 0, "Sequence": 38 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39230851", "Sequence": 37 }, "PreviousTxnID": "B9506986CD97BC8E531A62D8A0B11ED0936450830D048EB8388E0A2C6B61B16D", "PreviousTxnLgrSeq": 44601301 } } ], "TransactionIndex": 4, "TransactionResult": "tesSUCCESS", "delivered_amount": "9990" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "9990", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44603511, "Sequence": 37, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "30450221009D5E6F01FAC5B65A54D4EB8F0F6E8E32AC2A1FF3D543024F3D3475700835288B02204BAC2C9A61A231D8A5EFB81E9D9BF764AC7D05A6B201F59D6DBC9D8AEC30DEEB", "date": 601532891, "hash": "20ABA0226A0B80FD131F396A4735A1BAF133DDA342CC5D279C6715F825A9EE90", "inLedger": 44603509, "ledger_index": 44603509 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20748073", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20748063" }, "PreviousTxnID": "9159A7E99CE58925CC3DC3D4C49004D29131BF811EA1743BE560E126F6F47C44", "PreviousTxnLgrSeq": 44601235 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39230851", "Flags": 131072, "OwnerCount": 0, "Sequence": 37 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39230871", "Sequence": 36 }, "PreviousTxnID": "9159A7E99CE58925CC3DC3D4C49004D29131BF811EA1743BE560E126F6F47C44", "PreviousTxnLgrSeq": 44601235 } } ], "TransactionIndex": 9, "TransactionResult": "tesSUCCESS", "delivered_amount": "10" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "10", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44601303, "Sequence": 36, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "3044022035B7D96E4E24609E6F228C365F43291FF01DBDA6A006894570837722BF8249C702200311028B4FD6944A0B01ACB7D09157739D8366A6262423018291A991BE7F5945", "date": 601524802, "hash": "B9506986CD97BC8E531A62D8A0B11ED0936450830D048EB8388E0A2C6B61B16D", "inLedger": 44601301, "ledger_index": 44601301 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20748063", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20747173" }, "PreviousTxnID": "5AA65C4B784805C770B71386907E461A7F3B646E998A5C03B3A7F2AF085ACA63", "PreviousTxnLgrSeq": 44601232 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39230871", "Flags": 131072, "OwnerCount": 0, "Sequence": 36 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39231771", "Sequence": 35 }, "PreviousTxnID": "5AA65C4B784805C770B71386907E461A7F3B646E998A5C03B3A7F2AF085ACA63", "PreviousTxnLgrSeq": 44601232 } } ], "TransactionIndex": 9, "TransactionResult": "tesSUCCESS", "delivered_amount": "890" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "890", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44601237, "Sequence": 35, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "304402200D967FC498FDC63D093C17A2A99BEF532691E0918072905C42323534BCA0BCB302200EC3A3AEE364D805342741D7E8D993A02C318C5C2E80045AEAA9007DAD60B9A9", "date": 601524561, "hash": "9159A7E99CE58925CC3DC3D4C49004D29131BF811EA1743BE560E126F6F47C44", "inLedger": 44601235, "ledger_index": 44601235 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20747173", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20737283" }, "PreviousTxnID": "DDE4964D7BAB15D00B70813AAE2E9FF5C36C031A43BA12E59B7BBE553FC81CD2", "PreviousTxnLgrSeq": 44601222 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39231771", "Flags": 131072, "OwnerCount": 0, "Sequence": 35 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39241671", "Sequence": 34 }, "PreviousTxnID": "DDE4964D7BAB15D00B70813AAE2E9FF5C36C031A43BA12E59B7BBE553FC81CD2", "PreviousTxnLgrSeq": 44601222 } } ], "TransactionIndex": 3, "TransactionResult": "tesSUCCESS", "delivered_amount": "9890" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "9890", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44601234, "Sequence": 34, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "3045022100AF4D6FE88429100C782196EEE41E5E62F2CCF7D956991AE40DF6D9E475617C6D022020D216645D157B1F9CFCDD196C63C33C2C7C9D78E08E5C8D7FE46E74E63781B7", "date": 601524551, "hash": "5AA65C4B784805C770B71386907E461A7F3B646E998A5C03B3A7F2AF085ACA63", "inLedger": 44601232, "ledger_index": 44601232 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20737283", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20727293" }, "PreviousTxnID": "19D978ADBD0DE43D0B9FD858296EA3CEF21C5F9C6D287F2E7BE636AD8D0FB435", "PreviousTxnLgrSeq": 44601219 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39241671", "Flags": 131072, "OwnerCount": 0, "Sequence": 34 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39251671", "Sequence": 33 }, "PreviousTxnID": "19D978ADBD0DE43D0B9FD858296EA3CEF21C5F9C6D287F2E7BE636AD8D0FB435", "PreviousTxnLgrSeq": 44601219 } } ], "TransactionIndex": 0, "TransactionResult": "tesSUCCESS", "delivered_amount": "9990" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "9990", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44601225, "Sequence": 33, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "30450221009EFB75294CCC2C3CABD8784ACC54062E0E91533BBC1E0A98F733318F33CD518A022075097E645AD3B35CA856E01D8C82151EAF51E4957116D835E6A955DD00674648", "date": 601524520, "hash": "DDE4964D7BAB15D00B70813AAE2E9FF5C36C031A43BA12E59B7BBE553FC81CD2", "inLedger": 44601222, "ledger_index": 44601222 }, "validated": true }, { "meta": { "AffectedNodes": [ { "ModifiedNode": { "FinalFields": { "Account": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Balance": "20727293", "Flags": 0, "OwnerCount": 0, "Sequence": 1 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "8F4405543ACD7523C1572A1CE5D84610BC87977E2E7D27F8B5146C29C8054558", "PreviousFields": { "Balance": "20717303" }, "PreviousTxnID": "81EE5CA54C49F09B3E6796024FC83A49F811F654CC1EC32FBF660F8EFD71ED33", "PreviousTxnLgrSeq": 44587845 } }, { "ModifiedNode": { "FinalFields": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Balance": "39251671", "Flags": 131072, "OwnerCount": 0, "Sequence": 33 }, "LedgerEntryType": "AccountRoot", "LedgerIndex": "AE9C3106B59B29824CBE7ABAF083BB0637C185F023D32B323534FA57B09AB4EC", "PreviousFields": { "Balance": "39261671", "Sequence": 32 }, "PreviousTxnID": "81EE5CA54C49F09B3E6796024FC83A49F811F654CC1EC32FBF660F8EFD71ED33", "PreviousTxnLgrSeq": 44587845 } } ], "TransactionIndex": 2, "TransactionResult": "tesSUCCESS", "delivered_amount": "9990" }, "tx": { "Account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq", "Amount": "9990", "Destination": "rJqGGdzZmk9MJZ6nX1KpEh9TbzqWKHuzeK", "Fee": "10", "Flags": 2147483648, "LastLedgerSequence": 44601221, "Sequence": 32, "SigningPubKey": "037696563F5D4AD52750F62400A2AB537C0585C62D44823212FD62CD2DDF7A1741", "TransactionType": "Payment", "TxnSignature": "3045022100A1D99D227076A557C8CF4CF172C9F6D8E1B5205DA2075E051A8B1C09799624B6022074555A21E94A10B54ED8FE83E3AE6C7FA79ACC94B4FEEB6ADCB06461328143C7", "date": 601524510, "hash": "19D978ADBD0DE43D0B9FD858296EA3CEF21C5F9C6D287F2E7BE636AD8D0FB435", "inLedger": 44601219, "ledger_index": 44601219 }, "validated": true } ]

Proof there is a transaction: Initial hash: 8FD73E2DB62802CAEE7239F3DD5A4AFBBBADD23D5069D80AC1D769F121E12DD1

tgreco commented 5 years ago

It appears it works on new transactions but not the initial transaction where I deposited the 20 XRP to confirm the address.

However, a total of 60 XRP were sent in that transaction so it would be nice to have a way to find that 40 XRP.

ximinez commented 5 years ago

The results you posted here only include the transactions field of the result object. What are the values of the ledger_index_min and ledger_index_max fields? Those indicate which historical fields are available on the server you're querying. I'd be willing to bet that it doesn't include the ledger that your missing transaction is in.

This transaction was successful, and validated in ledger 44527898 on January 19, 2019 11:36 PM UTC.

tgreco commented 5 years ago

Now it seems to be returning nothing.

{"result":{"account":"rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq","ledger_index_max":44622823,"ledger_index_min":44620522,"status":"success","transactions":[]}}

As far as the ledger_index_min parameter even when I pass it into the call the output's ledger_index_min ends up being different than what I passed in.

How come?

I don't think I am passing it incorrectly but here is my curl command:

/usr/bin/curl -H "Content-Type: application/json" -X POST -d '{"method": "account_tx","params": [{"account": "rNriUSXDqVGWkdmFc2oADKqKLy4G2p85Fq","binary": false,"forward": false,"ledger_index_max": -1,"ledger_index_min": 44527898}]} ' http://127.0.0.1:5005

When sending this to the s1.ripple.com JSON-RPC server rather than my own I was able to get the full history.

What would I have to change on my local server to be able to get the full history of my account?

ximinez commented 5 years ago

From https://developers.ripple.com/account_tx.html:

Note: The server may respond with different values of ledger_index_min and ledger_index_max than you provided in the request, for example if it did not have the versions you specified on hand.

Your query looks like it's formatted correctly, which is why the result has "status":"success". The problem is that your rippled node does not have the ledgers which hold the relevant transactions. That's why the results indicate "ledger_index_min":44620522 - node only has ledgers going back to 44620522. If you want to query older ledgers, you need to have those ledgers locally.

Based on the ledgers you do have, my guess is that you have online_delete configures with a value in the low thousands. Assume it's 2000 - what that means is that when your node has about 4000 ledgers, it will delete the oldest ledgers until it has about 2000 left. Only the remaining ledgers can be queried.

If you want older ledgers, there are a few options:

Further reading: