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

Transactions returned by account_tx should include date #36

Closed
r0bertz opened this Issue Apr 20, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@r0bertz
Contributor

r0bertz commented Apr 20, 2018

Try the command here: https://ripple.com/build/websocket-tool/#account_tx

You can see the date field in 'tx'.

I am going to move the Date field I added to TxResult back to TxBase. I will make it omitempty.

@donovanhide

This comment has been minimized.

Contributor

donovanhide commented Apr 20, 2018

It's more complicated than you think. JSON fields with lower case field names are added by the RPC handlers, but are not part of the ledger format. The data package is not concerned with any of the RPC stuff, only handling the true ledger and transaction formats that get serialized into the node store. There are tons of weird inconsistencies in what is returned by the RPC handlers. You will no doubt encounter them soon enough :-)

@r0bertz

This comment has been minimized.

Contributor

r0bertz commented Apr 20, 2018

@donovanhide

This comment has been minimized.

Contributor

donovanhide commented Apr 20, 2018

Just because the getJSON method is defined in a different place doesn't mean it is not used by the RPC handler. You won't find a date field here, which is my point:

https://github.com/ripple/rippled/blob/eaff9a0e6aec0ad077f118501791c7684debcfd5/src/ripple/protocol/impl/TxFormats.cpp

@r0bertz

This comment has been minimized.

Contributor

r0bertz commented Apr 21, 2018

I opened an issue at ripple/rippled hoping maybe someone can give a definitive answer.

BTW, I didn't mean it was not used by the RPC handler. I was trying to find out if the transaction date is recorded in ledger.

@r0bertz

This comment has been minimized.

Contributor

r0bertz commented Apr 21, 2018

I closed the issue on ripple/rippled. I realized the stupidity of adding Date to TxBase since Date, i.e. close time, is a property of ledger, not transaction. One ledger contains multiple transactions. But still, I think we should return Date in account_tx result somewhere.

I think we should put it here, alongside ledger index:
https://github.com/r0bertz/ripple/blob/master/data/metadata.go#L57

Do you have a better suggestion?

@r0bertz

This comment has been minimized.

Contributor

r0bertz commented Apr 22, 2018

// i.e. returned from `tx` command.

The TransactionsWithMetaData MarshalJSON function has two issues.

First, if transaction has 'tx' and 'meta', it's returned by 'account_tx' not 'tx'. So the comment is wrong.

Second, there are at least 3 formats instead of 2. They are returned by 'account_tx', 'tx' and 'ledger' respectively.

Format 'account_tx' has 'tx' and 'meta' and 'tx' has date, ledger_index.

Format 'tx' doesn't have 'tx', has 'meta'. It has all transaction fields directly under it, including date and ledger_index.

Format 'ledger' is similar to format 'tx', but the name of 'meta' is 'metaData' and it doesn't have date and ledger_index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment