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: recover stampissuer on batch creation #2080

Merged
merged 6 commits into from
Jun 15, 2021
Merged

Conversation

aloknerurkar
Copy link
Contributor

@aloknerurkar aloknerurkar commented Jun 14, 2021

Currently, we create a new stampissuer when the user buys new stamps using the /stamps API.

This makes a call to the blockchain to buy a new postage batch. The operation can take some time and if for some reason the node goes down at this point, we might end up in a state where we have bought the postage batch, but a new stampissuer was not created making this batch not useful.

The change ensures that on batch creation event handled by the listener when we get the update from the blockchain, we will check if a stampissuer is present. And if it's not, we will create it.


This change is Reviewable

Base automatically changed from stampissuer.0 to master June 14, 2021 08:09
@aloknerurkar aloknerurkar added the ready for review The PR is ready to be reviewed label Jun 14, 2021
@aloknerurkar aloknerurkar self-assigned this Jun 14, 2021
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

Great stuff! thank you!

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

Reviewed 28 of 28 files at r1.
Reviewable status: 6 of 28 files reviewed, 2 unresolved discussions (waiting on @acud, @aloknerurkar, @esadakar, and @zelig)


pkg/postage/service.go, line 92 at r1 (raw file):

	case errors.Is(err, ErrNotFound):
		ps.Add(NewStampIssuer(
			"recovered",

what is this supposed to be?


pkg/postage/service_test.go, line 117 at r1 (raw file):

			t.Fatalf("expected no error, got %v", err)
		}
		if st.Label() != "recovered" {

label should not be used here

Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 28 files at r1, 22 of 22 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @esadakar and @zelig)


pkg/postage/service.go, line 92 at r1 (raw file):

Previously, zelig (Viktor Trón) wrote…

what is this supposed to be?

an indication that the batch was recovered by the listener


pkg/postage/service_test.go, line 117 at r1 (raw file):

Previously, zelig (Viktor Trón) wrote…

label should not be used here

@zelig I think that using the label here is just fine. Not sure what's the problem of using this field to indicate that the batch was recovered by the listener

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 22 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @esadakar and @zelig)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants