Skip to content

Commit 4e85255

Browse files
committed
docs: Update protocol version to 6
- Increment protocol version in documentation and tests - Ensure consistency across related test cases Signed-off-by: Yusuke Shimizu <stm1051212@gmail.com>
1 parent 7a26772 commit 4e85255

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

docs/peer-protocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
4949
- [The `claim_by_csv` path](#the-claim_by_csv-path)
5050

5151
## General
52-
The `protocol_version` is included to allow for possible changes in the future. The `protocol_version` of this document is `5`.
52+
The `protocol_version` is included to allow for possible changes in the future. The `protocol_version` of this document is `6`.
5353

5454
PeerSwap utilizes custom messages as described in [BOLT#1](https://github.com/Lightning/bolts/blob/master/01-messaging.md). The types are in range `42069`-`42085`. The `payload` is JSON encoded.
5555

swap/messages_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package swap
22

33
import (
44
"encoding/json"
5+
"strconv"
56
"strings"
67
"testing"
78

@@ -12,6 +13,7 @@ import (
1213
func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
1314
t.Parallel()
1415

16+
protocolVersion := strconv.Itoa(PEERSWAP_PROTOCOL_VERSION)
1517
swapID := strings.Repeat("00", 32)
1618
pubkey := "02" + strings.Repeat("00", 32)
1719
intermediaryPubkey := "03" + strings.Repeat("11", 32)
@@ -20,7 +22,7 @@ func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
2022
t.Parallel()
2123

2224
raw := `{
23-
"protocol_version": 5,
25+
"protocol_version": ` + protocolVersion + `,
2426
"swap_id": "` + swapID + `",
2527
"asset": "",
2628
"network": "regtest",
@@ -40,7 +42,7 @@ func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
4042
t.Parallel()
4143

4244
raw := `{
43-
"protocol_version": 5,
45+
"protocol_version": ` + protocolVersion + `,
4446
"swap_id": "` + swapID + `",
4547
"asset": "",
4648
"network": "regtest",
@@ -64,7 +66,7 @@ func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
6466
t.Parallel()
6567

6668
raw := `{
67-
"protocol_version": 5,
69+
"protocol_version": ` + protocolVersion + `,
6870
"swap_id": "` + swapID + `",
6971
"asset": "",
7072
"network": "regtest",
@@ -84,7 +86,7 @@ func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
8486
t.Parallel()
8587

8688
raw := `{
87-
"protocol_version": 5,
89+
"protocol_version": ` + protocolVersion + `,
8890
"swap_id": "` + swapID + `",
8991
"asset": "",
9092
"network": "regtest",
@@ -108,7 +110,7 @@ func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
108110
t.Parallel()
109111

110112
raw := `{
111-
"protocol_version": 5,
113+
"protocol_version": ` + protocolVersion + `,
112114
"swap_id": "` + swapID + `",
113115
"pubkey": "` + pubkey + `",
114116
"premium": 10,
@@ -128,7 +130,7 @@ func TestPeerswapMessages_TwoHopJSONIsOptional(t *testing.T) {
128130
t.Parallel()
129131

130132
raw := `{
131-
"protocol_version": 5,
133+
"protocol_version": ` + protocolVersion + `,
132134
"swap_id": "` + swapID + `",
133135
"pubkey": "` + pubkey + `",
134136
"Payreq": "lnbc1...",
@@ -167,7 +169,7 @@ func TestPeerswapMessages_TwoHopValidation(t *testing.T) {
167169
t.Parallel()
168170

169171
msg := SwapOutRequestMessage{
170-
ProtocolVersion: 5,
172+
ProtocolVersion: PEERSWAP_PROTOCOL_VERSION,
171173
SwapId: swapID,
172174
Asset: "",
173175
Network: "regtest",
@@ -185,7 +187,7 @@ func TestPeerswapMessages_TwoHopValidation(t *testing.T) {
185187
t.Parallel()
186188

187189
msg := SwapOutAgreementMessage{
188-
ProtocolVersion: 5,
190+
ProtocolVersion: PEERSWAP_PROTOCOL_VERSION,
189191
SwapId: swapID,
190192
Pubkey: pubkey,
191193
TwoHop: &TwoHop{

swap/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
const (
17-
PEERSWAP_PROTOCOL_VERSION = 5
17+
PEERSWAP_PROTOCOL_VERSION = 6
1818
)
1919

2020
var (

0 commit comments

Comments
 (0)