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

Merge dev to stable #1573

Merged
merged 11 commits into from
Jul 12, 2022
Merged

Merge dev to stable #1573

merged 11 commits into from
Jul 12, 2022

Conversation

jagerman
Copy link
Member

@jagerman jagerman commented Jul 7, 2022

No description provided.

darcys22 and others added 10 commits June 21, 2022 15:14
With batching, individual blocks can have a negative coinbase emission
because the tx fee gets added to the batch rewards database and not paid
out immediately, which then results in an negative overflow to a value
close to 2^64.  Thus a block with no payout and a tx fee will have an
erroneous huge positive coinbase emission when queried via
`get_coinbase_tx_sum`.  For example block 1094068 queried with:

    {"jsonrpc":"2.0","id":"0","method":"get_coinbase_tx_sum","params":{"height": 1094068, "count": 1}}

returns:

    {
      "jsonrpc": "2.0",
      "id": "0",
      "result": {
        "burn_amount": 0,
        "emission_amount": 18446744073699378616,
        "fee_amount": 10173000,
        "status": "OK"
      }
    }

This commit fixes it by making the values signed (and also serves as an
example of why unsigned integers are usually the wrong choice):

    {
      "jsonrpc": "2.0",
      "id": "0",
      "result": {
        "burn_amount": 0,
        "emission_amount": -10173000,
        "fee_amount": 10173000,
        "status": "OK"
      }
    }
Fixes #1575

We were appending a newline for every locked stake rather than just this
wallet's locked stakes.
The CLI wallets `print_locked_stakes` was buggy, overly verbose, and
missing pertinent information.  This overhauls it.

Details are below; the quick differences:
- show the staking requirement
- make key image output optional with a +key_images flag on the command
- fix various bugs such as just showing the first contribution as the
  "total" contribution
- add the wallet address of extra contributions, rather than just the
  key image with no other info.
- put your own contributions first, and mark them as such
- show totals of other contributors
- sort service nodes to put unlocking nodes first; among unlocking and
  non-unlocking nodes we sort by hex pubkey string.
- sort locked dereg outputs by unlock height
- considerable reformatting of how things are displayed

---

Output now looks like this:

First we have 1-2 lines of general info:

    Service Node: abcdef123456...
    Unlock Height: 1234567         (omitted if not unlocking)

If there are other contributors then we print a total line such as:

    Total Contributions: 15000 OXEN of 15000 OXEN required

For our own contribution, when we have a single contribution, we use one of:

    Your Contribution: 5000 OXEN (Key image: abcdef123...)
    Your Contribution: 5000 OXEN of 15000 OXEN required (Key image: abcdef123...)

(the second one applies if we are the only contributor so far).

If we made multiple contributions then:

    Your Contributions: 5000 OXEN in 2 contributions:
    Your Contributions: 5000 OXEN of 15000 OXEN required in 2 contributions:

(the second one if we are the only contributor so far).

This is followed by the individual contributions:

        ‣ 4000.5 OXEN (Key image: abcdef123...)
        ‣ 999.5 OXEN (Key image: 789cba456...)

If there are other contributors then we also print:

    Other contributions: 10000 OXEN from 2 contributors:
        • 1234.565 OXEN (T6U7YGUcPJffbaF5p8NLC3VidwJyHSdMaGmSxTBV645v33CmLq2ZvMqBdY9AVB2z8uhbHPCZSuZbv68hE6NBXBc51Gg9MGUGr)
          Key image 123456789...
        • 8765.435 OXEN (T6Tpop5RZdwE39iBvoP5xpJVoMpYPUwQpef9zS2tLL8yVgbppBbtGnzZxzkSp53Coi88wbsTHiokr7k8MQU94mGF1zzERqELK)
          ‣ 7530 OXEN (Key image: 23456789a...)
          ‣ 1235.435 OXEN (Key image: 3456789ab...)

If we aren't showing key images then all the key image details get omitted.

---

Locked key images get overhauled too; it wasn't at all clear from the
output *why* these are locked (i.e. these are locked contributions of
failed SNs):

    Locked Stakes due to Service Node Deregistration:
        ‣ 234.567 OXEN (Unlock height 1234567; Key image: abcfed999...)
        ‣ 5000 OXEN (Unlock height 123333; Key image: cbcfef989...)
@jagerman jagerman added this to the v10.1.3 milestone Jul 11, 2022
CLI wallet: improve print_locked_stakes
@jagerman jagerman merged commit 02124b9 into stable Jul 12, 2022
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.

None yet

2 participants