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

Provide network_receive_minimum in RPC/WS active_difficulty #2903

Conversation

guilhermelawless
Copy link
Contributor

@guilhermelawless guilhermelawless commented Sep 1, 2020

On mainnet I get the following response:

{
    "multiplier": "1.5",
    "network_current": "fffffffaaaaaaaab",
    "network_minimum": "fffffff800000000",
    "network_receive_current": "fffffff07c1f07c2",
    "network_receive_minimum": "fffffe0000000000"
}

The multiplier between network_receive_minimum and network_receive_current is 33, plugging that into our normalization expression (33 (64 - 1)) / 64 yields 1.5 as expected.

The recommended workflow is using `network_minimum` for any block, specializing with `network_receive_minimum` for receive blocks, and updating with `network_current` to get priority.

On mainnet I get the following response:

```json
{
    "multiplier": "1",
    "network_current": "fffffff800000000",
    "network_minimum": "fffffff800000000",
    "network_receive_minimum": "fffffe0000000000"
}
```
@guilhermelawless guilhermelawless added documentation This item indicates the need for or supplies updated or expanded documentation websockets rpc Changes related to Remote Procedure Calls labels Sep 1, 2020
@guilhermelawless guilhermelawless added this to the V21.2 milestone Sep 1, 2020
@guilhermelawless guilhermelawless self-assigned this Sep 1, 2020
argakiig
argakiig previously approved these changes Sep 1, 2020
SergiySW
SergiySW previously approved these changes Sep 1, 2020
@PlasmaPower
Copy link
Contributor

How about a network_receive_current too? That seems a bit more useful to me, unless current is inaccurate to the degree where it's better to use minimum anyways, which would be a separate issue.

@guilhermelawless
Copy link
Contributor Author

@PlasmaPower thanks for the suggestion and for the original suggestion of adding this to the RPC (was already in the works, just waiting for epoch 2 to finish 👍).

The node applies a function to normalize the prioritization with respect to the block type and even the epoch, so that a receive block doesn't have 10x the priority of a send block with less work generated. Essentially this means network_current applies to all blocks with some small margin of error. The normalization function is here: https://github.com/nanocurrency/nano-node/blob/V21.1/nano/lib/work.cpp#L148

@guilhermelawless
Copy link
Contributor Author

@PlasmaPower thanks for clarifying via DM, indeed it is possible to take advantage of the normalization to still provide less work for receive blocks and obtain the same priority. Added network_receive_current

argakiig
argakiig previously approved these changes Sep 1, 2020
@guilhermelawless guilhermelawless merged commit d7798c6 into nanocurrency:develop Sep 2, 2020
guilhermelawless added a commit that referenced this pull request Sep 2, 2020
Example response:

```json
{
    "multiplier": "1.5",
    "network_current": "fffffffaaaaaaaab",
    "network_minimum": "fffffff800000000",
    "network_receive_current": "fffffff07c1f07c2",
    "network_receive_minimum": "fffffe0000000000"
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This item indicates the need for or supplies updated or expanded documentation rpc Changes related to Remote Procedure Calls websockets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants