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: 🐛 change payment stream update logic to delete if user is insolvent #273

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

TDemeco
Copy link
Contributor

@TDemeco TDemeco commented Nov 26, 2024

This PR changes the logic of updating payment streams. Now, whenever a call to update a payment stream is done, we check beforehand if the user is currently insolvent and if so, call the delete payment stream function instead.

@TDemeco TDemeco requested review from ffarall and snowmead November 26, 2024 19:50
@TDemeco TDemeco changed the title fix: 🐛 change update_x_payment_stream functions to not error out if user is insolvent fix: 🐛 change payment stream update logic to delete if user is insolvent Dec 11, 2024
@TDemeco TDemeco requested review from snowmead and ffarall December 11, 2024 02:08
Copy link
Contributor

@ffarall ffarall left a comment

Choose a reason for hiding this comment

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

Good job!!

assert_ok!(<crate::Pallet<Test> as MutateBucketsInterface>::decrease_bucket_size(&bucket_id, 50));

// Check that the payment stream was deleted
assert!(!<<Test as crate::Config>::PaymentStreams as PaymentStreamsInterface>::has_active_payment_stream(&msp_id, &bucket_owner));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a decrease_bucket_size call for a second time. To highlight that this still works after the payment stream is deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants