Skip to content

Sync consumer balance every time on startup - #1860

Merged
zolia merged 1 commit into
masterfrom
bugfix/stale-balance-disconnects-session
Mar 10, 2020
Merged

Sync consumer balance every time on startup#1860
zolia merged 1 commit into
masterfrom
bugfix/stale-balance-disconnects-session

Conversation

@Waldz

@Waldz Waldz commented Mar 9, 2020

Copy link
Copy Markdown
Member

Closes: #1851

@Waldz
Waldz force-pushed the bugfix/stale-balance-disconnects-session branch from 4b9db97 to 788d33c Compare March 9, 2020 13:54

const grandTotalKey = "consumer_grand_total"

func (ip *InvoicePayer) getGrandTotalPromised() (uint64, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't remove this func, the force-sync is temporary and we will need to operate on balances we have in state

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So we have ip.deps.ConsumerTotalsStorage.Get() for that and I created recoverGrandTotalPromised() for syncing it if needed

@Waldz
Waldz force-pushed the bugfix/stale-balance-disconnects-session branch from 788d33c to bfa5e30 Compare March 9, 2020 15:30
@Waldz
Waldz requested a review from vkuznecovas March 10, 2020 08:39
Comment thread session/pingpong/invoice_payer.go
@zolia
zolia merged commit 1f758e0 into master Mar 10, 2020
@zolia
zolia deleted the bugfix/stale-balance-disconnects-session branch March 10, 2020 12:18
zolia added a commit that referenced this pull request Mar 10, 2020
…isconnects-session

Sync consumer balance every time on startup
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.

Incorrect stale balance state on consumer

4 participants