Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Unify JSON serialization format of transactions #4775
Unify JSON serialization format of transactions #4775
Changes from 25 commits
65346dc
ee53c5d
aa6de60
76eee5a
92635aa
e4ce8b1
0fb0517
910f125
4d517e2
2b397c9
1a96800
c2a3b52
bdf90e5
2035bbc
1115cef
4e92ee4
9f1d544
e386093
c477eb4
c81bece
ef1276c
54f1d60
625c812
0d8673c
cdb3384
5973390
17e6588
95b6055
b2a8a2d
94c16d8
7770bc5
b5b1118
942e209
c1f2ea4
53e384f
d0060f8
311952f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel
app_.journal("LedgerMaster::IsValidated")
is a descriptive nameThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LedgerMaster
has anm_journal
member. May as well use that. In which case, you won't really need thestream
local. Just fall back to the usual pattern ofJLOG(m_journal.warn())
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know how these names are rendered, but it appears we almost never use them with
::
in the middle ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, i see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it would be more clear if we separate the serialization logic and data initialization in the
getJson()
function.hash
can be directly initialized here ashash = transaction->getTransactionID();
(instead of passing an optional ref-wrapper)This is not a strong opinion, an alternative design suggestion, that's all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this idea?
hash
is getting built the same way, regardless of the code path (to_string(getTransactionID())
). The old code path sticks it into theJson
object; the new way sticks it into anoptional
. What if you undo the changes toSTTx::getJson
, then pull the hash value it builds out here?It would look something like:
Another advantage of initializing it here is that it can be made
const
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. Trouble is that we do not have flexible design choice here, since
Transaction::getJson
is used in quite a few locations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, having seen your (good, but unfortunately breaking API version 1) idea to remove
ledger_index
from inside transaction JSON output, I will try to do that properly both forledger_index
and for transactionhash
. Hopefully in this PR, but unsure as this might come with larger churn that I want here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok done! It wasn't so bad - see the latest commit 95b6055