-
Notifications
You must be signed in to change notification settings - Fork 76
insert delivered_amount based on close time #252
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
Conversation
| std::shared_ptr<ripple::TxMeta const> const& meta, | ||
| uint32_t date) | ||
| { | ||
| if (canHaveDeliveredAmount(txn, meta)) |
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.
Do we also need to change canHaveDeliveredAmount?
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.
Don't think so, that function is just looking at the transaction to see if its the type of transaction that could have a delivered amount.
| if (canHaveDeliveredAmount(txn, meta)) | ||
| { | ||
| if (auto amt = getDeliveredAmount(txn, meta, meta->getLgrSeq())) | ||
| if (auto amt = getDeliveredAmount(txn, meta, meta->getLgrSeq(), date)) |
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.
Can we do a cpp17 style if statement 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.
Like : if (auto amt = getDeliveredAmount(txn, meta, meta->getLgrSeq(), date); amt)?
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.
Yes. I like that better, but if you hate it feel free to leave it
| if (ledgerSequence >= 4594095) | ||
| if (ledgerSequence >= 4594095 || date > 446000000) | ||
| { | ||
| return txn->getFieldAmount(ripple::sfAmount); |
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.
Is it guaranteed that in this case sfAmount will be delivered_amount?
If a transaction is a partial payment, will it always have delivered_amount in the metadata?
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.
According to the comment (which I copied from rippled), delivered amount will be in the metadata for partial payments after this ledger. The metadata is checked prior to this, at the beginning of the function.
Previously, we were only checking the ledger sequence to determine if we should insert delivered amount. This works on mainnet, but could fail on other networks that are newer
This change is