bob-wallet icon indicating copy to clipboard operation
bob-wallet copied to clipboard

Recevied funds labeled "sent funds"

Open pinheadmz opened this issue 3 years ago • 3 comments

This is the only TX for this wallet, a receipt of 1 HNS, but it is being displayed as the send:

Screen Shot 2022-03-11 at 9 31 12 AM

This is how Bob is displaying this TX: https://hnsnetwork.com/txs/ff9d471853ecaee83deed16d651e502a3cd546b66ea2fb406515652c59902e69

This TX was RECEIVED by my hip-2 wallet at address hs1q2nz2pg4kr6s59jfa8vv4u0htrsthgmc76p2q9x

However, I did SEND this transaction from one of my other wallets in Bob.

Using hsw-cli tx --id=... I requested the same TX from both wallets and the responses are correct, Im not sure why Bob seems to be mixing this up (notice which ins/outs have PATH objects)

Is Bob caching some tx information from the first wallet or something?

from sending wallet

  "inputs": [
    {
      "value": 5198185,
      "address": "hs1q03wr3h9h5uw39aklff7x00f0ykxmfxk3p8uv0q",
      "path": {
        "name": "default",
        "account": 0,
        "change": true,
        "derivation": "m/0'/1/28"
      }
    }
  ],
  "outputs": [
    {
      "value": 1000000,
      "address": "hs1q2nz2pg4kr6s59jfa8vv4u0htrsthgmc76p2q9x",
      "covenant": {
        "type": 0,
        "action": "NONE",
        "items": []
      },
      "path": null
    },
    {
      "value": 4191185,
      "address": "hs1qqht6tgrlp8l9shwhdr4nz6ffvzhsw7zvz2a6e3",
      "covenant": {
        "type": 0,
        "action": "NONE",
        "items": []
      },
      "path": {
        "name": "default",
        "account": 0,
        "change": true,
        "derivation": "m/0'/1/29"
      }
    }
  ],

from receiving wallet

  "inputs": [
    {
      "value": 0,
      "address": "hs1q03wr3h9h5uw39aklff7x00f0ykxmfxk3p8uv0q",
      "path": null
    }
  ],
  "outputs": [
    {
      "value": 1000000,
      "address": "hs1q2nz2pg4kr6s59jfa8vv4u0htrsthgmc76p2q9x",
      "covenant": {
        "type": 0,
        "action": "NONE",
        "items": []
      },
      "path": {
        "name": "default",
        "account": 0,
        "change": true,
        "derivation": "m/0'/1/8"
      }
    },
    {
      "value": 4191185,
      "address": "hs1qqht6tgrlp8l9shwhdr4nz6ffvzhsw7zvz2a6e3",
      "covenant": {
        "type": 0,
        "action": "NONE",
        "items": []
      },
      "path": null
    }
  ],

pinheadmz avatar Mar 11 '22 14:03 pinheadmz

Okay so this is happening because Bob ignores change outputs:

https://github.com/kyokan/bob-wallet/blob/6f3f93bf202740f27cda1b46684d78e94ae68a96/app/ducks/walletActions.js#L354-L359

So since the 1 HNS was sent to a change address, the 2nd output is parsed. That doesn't have path, it's considered a send to an external address.

rithvikvibhu avatar Mar 11 '22 14:03 rithvikvibhu

holy crap you're right, uh oh i may need to patch the hip2-server code

pinheadmz avatar Mar 14 '22 14:03 pinheadmz

Ok Im going down the rabbit hole of this bug - still Bob could be smarter i suppose. Maybe we need to total up ins and outs we control for each tx and figure out what the spendable balance diff is for each tx. someone might send you HNS to one of your change addresses for any number of reasons

pinheadmz avatar Mar 14 '22 16:03 pinheadmz