Skip to content
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 bunch of bugs #363

Merged
merged 5 commits into from
May 1, 2024
Merged

Fix bunch of bugs #363

merged 5 commits into from
May 1, 2024

Conversation

panleone
Copy link
Member

@panleone panleone commented May 1, 2024

Abstract

Fix many bugs that I have accidentally added in the latest PRs

First commit: cherry-pick Duddino's commit from #354 that fixes the bug ".isLocked is not a function"

Second commit: due to bad merge getLatestBlocks was returning early on non-shield wallets

Third commit: make sure that the blockheight is updated when toggling network

Fourth and fifth commits: The mempool function ownTransaction was broken... So I fixed it, moved the implementation to the wallet class and removed the useless functions getOwnedVin and getOwnedVout


Testing

Test that you can create txs and the wallet syncs new transactions when new block arrives

@panleone panleone added the Bug This is either a bugfix (PR) or a bug (issue). label May 1, 2024
@panleone panleone requested review from JSKitty and Duddino May 1, 2024 08:02
@panleone panleone self-assigned this May 1, 2024
Copy link

netlify bot commented May 1, 2024

Deploy Preview for cheery-moxie-4f1121 ready!

Name Link
🔨 Latest commit 93024c2
🔍 Latest deploy log https://app.netlify.com/sites/cheery-moxie-4f1121/deploys/66327594fe3d1500084174b5
😎 Deploy Preview https://deploy-preview-363--cheery-moxie-4f1121.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

JSKitty
JSKitty previously approved these changes May 1, 2024
Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 080ff07 - wallet is actually usable again

Comment on lines -170 to +144
return this.getOwnedVout(tx).reduce((acc, u) => acc + u?.value ?? 0, 0);
const txid = tx.txid;

return tx.vout
.filter(
(_, i) =>
this.getOutpointStatus(
new COutpoint({
txid,
n: i,
})
) & OutpointState.OURS
)
.reduce((acc, u) => acc + u?.value ?? 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds quite a bit of extra code whenever we need to aggregate any kind of balance / script type / etc, are you sure we should remove the getOwnedX utility functions?

I would not reject the PR for it, but I prefer the old method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they will have any applications outside getDebit and getCredit, that's why I removed them.
I'd say we re-add them if they become useful again?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A-OK with me, was just my personal comment, no blocker.

Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 93024c2

Tested a few random TXs and "rolling" Synchronisation quickly, still looks good.

@panleone panleone merged commit de8708c into PIVX-Labs:master May 1, 2024
5 of 7 checks passed
@panleone panleone deleted the quick_bug branch October 1, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is either a bugfix (PR) or a bug (issue).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants