diff --git a/_includes/devdoc/guide_p2p_network.md b/_includes/devdoc/guide_p2p_network.md index e907aaa7..a1c6bfa1 100644 --- a/_includes/devdoc/guide_p2p_network.md +++ b/_includes/devdoc/guide_p2p_network.md @@ -589,6 +589,40 @@ Earlier versions of Bitcoin Core allowed developers and trusted community member {% endautocrossref %} +### Masternode Sync + +{% include helpers/subhead-links.md %} + +{% autocrossref %} + +Dash Core performs masternode synchronization as required, but it can be started +manually by issuing the `mnsync reset` RPC command. + +*Masternode Sync Data Flow* + +| **Syncing Node Message** | **Direction** | **Masternode Response** | **Description** | +| **1. Sporks** | | | | +| `getsporks` message | → | | Syncing node requests sporks +| | ← | `spork` message(s) | +| **2. Masternode List** | | | Sync Masternode list from other connected clients | +| `dseg` message | → | | Syncing node requests masternode list +| | ← | `ssc` message | Number of entries in masternode list (MASTERNODE_SYNC_LIST)

Only sent if requesting entire list +| | ← | `inv` message(s) (mnb) | MSG_MASTERNODE_ANNOUNCE +| | ← | `inv` message(s) (mnp) | MSG_MASTERNODE_PING +| `getdata` message(s) (mnb) | → | | (Optional) +| `getdata` message(s) (mnp) | → | | (Optional) +| | ← | `mnb` message(s) | (If requested) Masternode announce message +| | ← | `mnp` message(s) | (If requested) Masternode ping message +| **3. Masternode payments** | | | Ask node for all payment votes it has (new nodes will only return votes for future payments) | +| `mnget` message | → | | Syncing node requests masternode payment sync +| | ← | `ssc` message | Number of entries in masternode payment list +| | ← | `inv` message(s) (mnw) | MSG_MASTERNODE_PAYMENT_VOTE +| `getdata` message(s) (mnw) | → | | (Optional) +| | ← | `mnw` message(s) | (If requested) Masternode payment vote message +| **4. Governance** | | | See [Governance sync](#governance) | + +{% endautocrossref %} + ### Governance diff --git a/_includes/devdoc/ref_p2p_networking.md b/_includes/devdoc/ref_p2p_networking.md index 078115c6..089d22fc 100644 --- a/_includes/devdoc/ref_p2p_networking.md +++ b/_includes/devdoc/ref_p2p_networking.md @@ -1855,8 +1855,9 @@ entry. To request the list of all masternodes, use an empty txIn (TXID of all zeros and an index of 0xFFFFFFFF). To request information about a specific masternode, use the unspent output associated with that masternode. -The response to a `dseg` message is an `mnb` message and an `mnp` message from -the masternode(s) requested. +The response to a `dseg` message is an `mnb` message inventory and an +`mnp` message inventory for each requested masternode. Masternodes ignore this +request if they are not fully synced. | Bytes | Name | Data type | Required | Description | | ---------- | ----------- | --------- | -------- | -------- | @@ -1997,11 +1998,18 @@ Masternode Ping Message {% autocrossref %} -The `mnget` message requests masternode payment sync. +The `mnget` message requests masternode payment sync. The response to an +`mnget` message is an `mnb` message inventory and an `mnp` message inventory for +each requested masternode. Masternodes ignore this request if they are not fully synced. | Bytes | Name | Data type | Required | Description | | ---------- | ----------- | --------- | -------- | -------- | -| 4 | nMnCount | int | Required | +| 4 | nMnCount | int | Required | Number of masternode payment votes to request + +{% highlight text %} +Note: Dash Core limits how frequently a masternode payment sync can be +requested. Frequent requests will result in the node being banned. +{% endhighlight %} The following annotated hexdump shows a `mnget` message. (The message header has been omitted.) @@ -2156,7 +2164,10 @@ dd6cc6c11211793b239c2e311f1496e2 {% autocrossref %} -The `ssc` message is used to track the sync status of masternode objects. +The `ssc` message is used to track the sync status of masternode objects. This +message is sent in response to sync requests for masternode payments +(`mnw` message), masternode list (`mnget` message), +governance objects (`govsync` message), and governance object votes (`govsync` message). | Bytes | Name | Data type | Required | Description | | ---------- | ----------- | --------- | -------- | -------- | @@ -2371,6 +2382,19 @@ dc45e9c09ee0427223e332b52e8d709e The `govsync` message is used to request syncing of governance objects (`govobj` message and `govobjvote` message) with peers. +This message responds in two ways depending on the request: + +1. When a masternode receives a `govsync` message with a hash of all zeros, it +responds with a `govobj` inventory message (MSG_GOVERNANCE_OBJECT - 0x17) for +all valid governance objects. Governance object votes are excluded in this type +of response. + +2. When a masternode receives a `govsync` message with a specific hash, it +responds with both a `govobj` inventory message (MSG_GOVERNANCE_OBJECT - 0x17) +and a `govobjvote` inventory message (MSG_GOVERNANCE_OBJECT_VOTE - 0x18) for +the single goverance object requested. + + | Bytes | Name | Data type | Required | Description | | ---------- | ----------- | --------- | -------- | -------- | | 32 | nHash | uint256 | Required | diff --git a/_includes/references.md b/_includes/references.md index 06b7e71b..6b53f160 100644 --- a/_includes/references.md +++ b/_includes/references.md @@ -242,8 +242,8 @@ http://opensource.org/licenses/MIT. [getheaders message]: /en/developer-reference#getheaders "A P2P protocol message used to request a range of block headers" [getsporks message]: /en/developer-reference#getsporks "A P2P network message used to request the status of sporks" [govobj message]: /en/developer-reference#govobj "A P2P network message used to send governance objects" -[govobjvote message]: /en/developer-reference#govobj "A P2P network message used to send governance object votes" -[govsync message]: /en/developer-reference#govobj "A P2P network message used to synchronize governance objects" +[govobjvote message]: /en/developer-reference#govobjvote "A P2P network message used to send governance object votes" +[govsync message]: /en/developer-reference#govsync "A P2P network message used to synchronize governance objects" [headers message]: /en/developer-reference#headers "A P2P protocol message containing one or more block headers" [inv message]: /en/developer-reference#inv "A P2P protocol message used to send inventories of transactions and blocks known to the transmitting peer" [ix message]: /en/developer-reference#ix "A P2P protocol message which sends a single serialized transaction via InstantSend"