-
Notifications
You must be signed in to change notification settings - Fork 59
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
fix(core): include withdrawals in txSummary spent coins #1548
fix(core): include withdrawals in txSummary spent coins #1548
Conversation
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.
Great work @mirceahasegan!
const implicitAssets = await getImplicitAssets(tx); | ||
|
||
const diff = { | ||
assets: subtractTokenMaps([totalOutputValue.assets, totalInputValue.assets]), | ||
coins: totalOutputValue.coins - totalInputValue.coins | ||
// Withdrawals are a type of "own input", which must be accounted for when computing the wallet spent amount. |
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.
Nice description. My first though here is that it would be better added to a type definition, so developers will see it when implementing, but it looks like we're just relying on inference 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.
good point. I'll create an explicit type and add jsdocs for it
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 amended the commit, the only addition being the jsdoc: 6166bfc#diff-a9bcb5ce8c787fb688c6ba5c62595afae666260d468bd5b2ee1bd9a22e868b51R40
|
b62c0b7
to
6166bfc
Compare
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.
Nice work!
Withdrawals are a type of "own input", which must be accounted for when computing the wallet spent amount
3897f94
to
d70e5cd
Compare
Withdrawals are a type of "own input", which must be accounted for when computing the wallet spent amount
Context
txSummaryInspector should factor in
withdrawals
when calculating the spentcoins
.Proposed Solution
`coins = ownOutputs - (ownInputs + ownWithdrawals)
Important Changes Introduced