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

Wallet client reports the (1st price - 2nd price) rebate as being locked up #62

Closed
turbomaze opened this issue Sep 18, 2018 · 2 comments

Comments

@turbomaze
Copy link
Contributor

turbomaze commented Sep 18, 2018

Description

Handshake uses a Vickrey auction, so the winner should only pay the second highest bid. With Handshake, bidders lose access to their funds for the duration of the auction. Only when the auction closes can losers sendredeem to recover their bid amount. Winners can sendupdate to register their name, which creates a REGISTER output and a NONE output containing their (1st bid - 2nd bid) refund. However, the wallet client erroneously reports both of those outputs as being locked up, effectively making the winner pay their full 1st highest bid.

To Reproduce

  1. Make 2 wallets, A and B each with 100 HNS.
  2. rpc selectwallet A
  3. open NAME
  4. bid 50, 75 lockup
  5. rpc selectwallet B
  6. bid 25, 50 lockup
  7. rpc selectwallet A
  8. reveal 50
    a. (75-50) HNS returned to wallet A
  9. rpc selectwallet B
  10. reveal 25
    a. (50-25) HNS returned to wallet B
  11. redeem NAME
    a. 25 HNS returned to wallet B
    b. B still has ~100 HNS with 0 locked up, as expected
  12. rpc selectwallet A
  13. update NAME '{}'
    a. REGISTER output with 25 tokens (this is the 2nd highest bid price)
    b. NONE output with 25 tokens (this is the 1st - 2nd price)
  14. get --id=A
    a. A has 100 HNS with 50 HNS still locked up
    b. expected: A has 100 HNS with 25 HNS locked up

Details

I ran all of these steps locally on simnet, but have observed this same behavior on testnet. Here is the result of the winner's sendupdate:

"outputs": [
    {
      "value": 25000000,
      "address": "ss1qe6xyedmfg2aujv32xnf4fwlqptvmhyqtfxlq3k",
      "covenant": {
        "type": 6,
        "action": "REGISTER",
        "items": [
          "a0a65c5733a6fe998b2163843cb38e750b79fdb01319d87b61e49d3990fc5740",
          "d2090000",
          "00000000",
          "1d24ff48bcc846484f66b6ac9b85f22f30f82684db4573edd8ee4e74956f82c6"
        ]
      }
    },
    {
      "value": 24995680,
      "address": "ss1qgnvhypauavy9hc2ksk9zev0fjrxyyc7nckmy94",
      "covenant": {
        "type": 0,
        "action": "NONE",
        "items": []
      }
    }
  ]

Here is the balance result of get --id=A:

"balance": {
  "account": -1,
  "tx": 4,
  "coin": 4,
  "unconfirmed": 99987140,
  "confirmed": 99987140,
  "lockedUnconfirmed": 50000000,
  "lockedConfirmed": 50000000
}

Next, I exported A's wallet seed and created a new wallet based on that seed. Then, I rescan the db to bring the new wallet up-to-date. Here is its balance report:

"balance": {
  "account": -1,
  "tx": 4,
  "coin": 4,
  "unconfirmed": 99987140,
  "confirmed": 99987140,
  "lockedUnconfirmed": 0,
  "lockedConfirmed": 50000000
}
@hschoenburg
Copy link

I was able to reproduce on my machine as well. The coins remained locked even after exporting and reimporting the wallet

@boymanjor
Copy link
Contributor

@turbomaze thanks for the detailed bug report! I just opened #64 which should fix the issue. Feel free to test the fix on the wallet branch.

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

No branches or pull requests

3 participants