Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Fix QR codes not displaying for new wallets #11496

Merged
merged 2 commits into from
Oct 13, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ const onWalletProperties = (state, body) => {

// unconfirmed amount
const unconfirmed = parseFloat(body.get('unconfirmed'))
if (unconfirmed >= 0) {
if (unconfirmed > 0) {
Copy link
Contributor

@NejcZdovc NejcZdovc Oct 13, 2017

Choose a reason for hiding this comment

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

I think this change is not correct, because you could have wallet that have unconfirmed balance, let's say 10$. Then you import wallet from the backup, which have unconfirmed balance 0. New value will not be saved.

Another use case is when your unconfirmed balance is handled, you can't hide that message, because 0 will not be saved.

This return in the if block is more or less from the old code. What I would do is to change it to

const unconfirmed = parseFloat(body.get('unconfirmed'))
if (unconfirmed >= 0) {
    state = ledgerState.setInfoProp(state, 'unconfirmed', unconfirmed)
    if (clientOptions.verboseP) {
      console.log('\ngetBalance refreshes ledger info: ' + ledgerState.getInfoProp(state, 'unconfirmed'))
    }
}

Copy link
Member

Choose a reason for hiding this comment

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

want to just PR an alt fix @NejcZdovc ?

Copy link
Contributor

Choose a reason for hiding this comment

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

will push to this PR

if (ledgerState.getInfoProp(state, 'unconfirmed') === unconfirmed) {
return state
}
Expand Down