-
Notifications
You must be signed in to change notification settings - Fork 344
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
postage batch store #922
postage batch store #922
Conversation
7e9a8c8
to
62c2a5c
Compare
134fa9a
to
cbd4d4a
Compare
cbd4d4a
to
97b2a15
Compare
func (s *Store) settle(block uint64) { | ||
period := int64(block - s.state.block) | ||
s.state.block = block | ||
s.state.total.Add(s.state.total, new(big.Int).Mul(s.state.price, big.NewInt(period))) |
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.
this reintroduces a lot of the reorg issues we wanted to get rid of. instead of doing this price update thing here we should refetch this value using the totalOutPayment
getter when there is a PriceUpdate
event on the oracle contract.
if err != nil { | ||
return err | ||
} | ||
b.Depth = depth |
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.
what is the unit of balance
? is this total amount paid into it, or per chunk (like the normalised balance). If the latter, changing the depth also changes the balance.
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.
- mutex should be used
- replace to be ised when changing value (topup/depth change)
- entrypoint for latest state
- entrypoint for Get by batch id
return err | ||
} | ||
err = s.replace(id, b.Value, value) | ||
value, err := s.balance(b, value) |
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.
value can cime durectly from the event]
err = s.replace(id, b.Value, value) | ||
|
||
panic("@zelig - should we have b.Add(value)?") | ||
value, err := s.balance(b, value) |
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.
value can cime durectly from the event]
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.
we need the relace call bothg in topup and increasedepth
deprecated by #1046. - based on AP #928 https://hackmd.io/o8RGsNwZSN6IE0lkBAZCPw