Governance updates

- Add description of govsync to P2P guide
 - Updates to P2P reference
This commit is contained in:
thephez 2017-10-16 16:29:05 -04:00
parent 98af7ca7af
commit c062ed2349
2 changed files with 58 additions and 3 deletions

View file

@ -587,3 +587,46 @@ Take note that for both types of broadcasting, mechanisms are in place to punish
Earlier versions of Bitcoin Core allowed developers and trusted community members to issue [Bitcoin alerts](https://bitcoin.org/en/alerts) to notify users of critical network-wide issues. This messaging system [was retired](https://bitcoin.org/en/alert/2016-11-01-alert-retirement) in Bitcoin Core v0.13.0; however, internal alerts, partition detection warnings and the `-alertnotify` option features remain.
{% endautocrossref %}
### Governance
{% include helpers/subhead-links.md %}
{% autocrossref %}
#### Synchronization
Dash Core synchronizes the governance system via the Masternode network as the
last stage of the Masternode sync process (following they sync of sporks, the
Masternode list, and Masternode payments).
The `govsync` message initiates a sync of the governance system. Masternodes
respond to the `govsync` message with several items:
* First, the Masternode sends one `ssc` message (Sync Status Count) for `govobj`
objects and one for `govobjvote` objects. These messages indicates how many
inventory items will be sent.
* Second, the Masternode sends `inv` messages for the `govobj` and `govobjvote`
objects.
Once the syncing node receives the counts and inventories, it may request any
`govobj` and `govobjvote` objects from the Masternode via a `getdata` message.
*Governance Sync Data Flow*
| **Syncing Node Message** | **Direction** | **Masternode Response** | **Description** |
| `govsync` | → | | Syncing node initiates governance sync
| | ← | `ssc` message (govobj) | Number of governance objects
| | ← | `ssc` message (govobjvote)| Number of governance object votes
| | ← | `inv` message (govobj) | Governance object inventories
| | ← | `inv` message (govobjvote)| Governance object vote inventories
| `getdata` (govobj) | → | | (Optional) Syncing node requests govobj
| | ← | `govobj` message | (If requested) Governance object
| `getdata` (govobjvote) | → | | (Optional) Syncing node requests govobjvote
| | ← | `govobjvote` message | (If requested) Governance object vote
{% endautocrossref %}

View file

@ -2230,15 +2230,24 @@ contract, or setting.
| Bytes | Name | Data type | Required | Description |
| ---------- | ----------- | --------- | -------- | -------- |
| 32 | nHashParent | uint256 | Required | Parent object, 0 is root
| 32 | nHashParent | uint256 | Required | Parent object (a hash of all zeros here indicates this is the root object, not a child object).
| 4 | nRevision | int | Required | Object revision in the system
| 8 | nTime | int64_t | Required | Time which this object was created
| 32 | nCollateralHash | uint256 | Required | Hash of the collateral fee transaction
| 0-16384 | strData | string | Required | Data field - can be used for anything (leading varint indicates size of data)
| 4 | nObjectType | int | Required | Type of governance object as defined by src/governance-object.h
| 4 | nObjectType | int | Required | Type of governance object: <br>`0` - Unknown<br>`1` - Proposal<br>`2` - Trigger<br>`3` - Watchdog
| 41 | vinMasternode | CTxIn | Required | Unspent output for the masternode which is signing this object
| 66* | vchSig | char[] | Required | Signature of the masternode (66 bytes in most cases. Length (1 byte) + Signature (65 bytes))
Governance Object Types (defined by src/governance-object.h)
| Object Type | Description
|------|--------------
| 0 | GOVERNANCE_OBJECT_UNKNOWN
| 1 | GOVERNANCE_OBJECT_PROPOSAL
| 2 | GOVERNANCE_OBJECT_TRIGGER
| 3 | GOVERNANCE_OBJECT_WATCHDOG
The following annotated hexdump shows a `govobj` message. (The
message header has been omitted.)
@ -2327,13 +2336,16 @@ dc45e9c09ee0427223e332b52e8d709e
{% autocrossref %}
The `govsync` message is used to request syncing of governance objects with peers.
The `govsync` message is used to request syncing of governance objects
(`govobj` message and `govobjvote` message) with peers.
| Bytes | Name | Data type | Required | Description |
| ---------- | ----------- | --------- | -------- | -------- |
| 32 | nHash | uint256 | Required |
| # | filter | CBloomFiter | Required |
Note: Both the hash and bloom filter fields can be set to all zeros.
The following annotated hexdump shows a `govsync` message. (The
message header has been omitted.)