forked from omnilaboratory/obd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_htlc_close.go
169 lines (152 loc) · 9.45 KB
/
message_htlc_close.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package bean
// 消息 -100049: user wanna close htlc tx when tx is on getH state
type HtlcCloseRequestCurrTx struct {
ChannelId string `json:"channel_id"`
LastRsmcTempAddressPrivateKey string `json:"last_rsmc_temp_address_private_key"`
LastHtlcTempAddressPrivateKey string `json:"last_htlc_temp_address_private_key"`
LastHtlcTempAddressForHtnxPrivateKey string `json:"last_htlc_temp_address_for_htnx_private_key"`
CurrTempAddressIndex int `json:"curr_temp_address_index"`
CurrTempAddressPubKey string `json:"curr_temp_address_pub_key"`
typeLengthValue
}
// 返回值 -100049的返回值 (obd to alice) obd推给Alice (需要Alice签名的数据)
type NeedAliceSignRsmcDataForC4a struct {
ChannelId string `json:"channel_id"` //the global channel id.
C4aRsmcRawData NeedClientSignTxData `json:"c4a_rsmc_raw_data"`
C4aCounterpartyRawData NeedClientSignTxData `json:"c4a_counterparty_raw_data"`
}
//消息 -100110(alice to obd) alice发给obd (Alice签名C4a的结果)
type AliceSignedRsmcDataForC4a struct {
ChannelId string `json:"channel_id"`
RsmcPartialSignedHex string `json:"rsmc_partial_signed_hex"`
CounterpartyPartialSignedHex string `json:"counterparty_partial_signed_hex"`
typeLengthValue
}
// 消息 p2p 49 p2p (obd of alice to obd of bob) 发送给bob的obd的数据 alice请求rsmc转账
type AliceRequestCloseHtlcCurrTxOfP2p struct {
ChannelId string `json:"channel_id"` //the global channel id.
CommitmentTxHash string `json:"commitment_tx_hash"`
CurrTempAddressPubKey string `json:"curr_temp_address_pub_key"`
LastRsmcTempAddressPrivateKey string `json:"last_rsmc_temp_address_private_key"`
LastHtlcTempAddressPrivateKey string `json:"last_htlc_temp_address_private_key"`
LastHtlcTempAddressForHtnxPrivateKey string `json:"last_htlc_temp_address_for_htnx_private_key"`
RsmcPartialSignedData NeedClientSignTxData `json:"rsmc_partial_signed_data"`
CounterpartyPartialSignedData NeedClientSignTxData `json:"counterparty_partial_signed_data"`
SenderNodeAddress string `json:"sender_node_address"`
SenderPeerId string `json:"sender_peer_id"`
typeLengthValue
}
//消息 110049
type AliceRequestCloseHtlcCurrTxOfP2pToBobClient struct {
ChannelId string `json:"channel_id"` //the global channel id.
C4aRsmcPartialSignedData NeedClientSignTxData `json:"c4a_rsmc_partial_signed_data"`
C4aCounterpartyPartialSignedData NeedClientSignTxData `json:"c4a_counterparty_partial_signed_data"`
MsgHash string `json:"msg_hash"`
SenderNodeAddress string `json:"sender_node_address"`
SenderPeerId string `json:"sender_peer_id"`
}
//消息 100050 bob对关闭htlc交易请求的签收
type HtlcBobSignCloseCurrTx struct {
MsgHash string `json:"msg_hash"`
C4aRsmcCompleteSignedHex string `json:"c4a_rsmc_complete_signed_hex"`
C4aCounterpartyCompleteSignedHex string `json:"c4a_counterparty_complete_signed_hex"`
LastRsmcTempAddressPrivateKey string `json:"last_rsmc_temp_address_private_key"`
LastHtlcTempAddressPrivateKey string `json:"last_htlc_temp_address_private_key"`
LastHtlcTempAddressForHtnxPrivateKey string `json:"last_htlc_temp_address_for_htnx_private_key"`
CurrTempAddressIndex int `json:"curr_temp_address_index"`
CurrTempAddressPubKey string `json:"curr_temp_address_pub_key"`
typeLengthValue
}
//响应 100050的结果
type NeedBobSignRawDataForC4b struct {
ChannelId string `json:"channel_id"`
C4bRsmcRawData NeedClientSignTxData `json:"c4b_rsmc_raw_data"`
C4bCounterpartyRawData NeedClientSignTxData `json:"c4b_counterparty_raw_data"`
C4aRdRawData NeedClientSignTxData `json:"c4a_rd_raw_data"`
C4aBrRawData NeedClientSignRawBRTxData `json:"c4a_br_raw_data"`
SenderNodeAddress string `json:"sender_node_address"`
SenderPeerId string `json:"sender_peer_id"`
}
// 消息 1000111对100050的签名结果
type BobSignedRsmcDataForC4b struct {
ChannelId string `json:"channel_id"`
C4aRdPartialSignedHex string `json:"c4a_rd_signed_hex"`
C4aBrPartialSignedHex string `json:"c4a_br_signed_hex"`
C4aBrId int64 `json:"c4a_br_id"`
C4bRsmcPartialSignedHex string `json:"c4b_rsmc_signed_hex"`
C4bCounterpartyPartialSignedHex string `json:"c4b_counterparty_signed_hex"`
typeLengthValue
}
// 响应 100111 (bob to obd) bob对C2b的签名结果
type BobSignedRsmcDataForC4bResult struct {
ChannelId string `json:"channel_id"`
CommitmentTxHash string `json:"commitment_tx_hash"`
}
// p2p消息 50号协议传递的消息
type CloseeSignCloseHtlcTxOfP2p struct {
ChannelId string `json:"channel_id"`
CloseeLastRsmcTempAddressPrivateKey string `json:"closee_last_rsmc_temp_address_private_key"`
CloseeLastHtlcTempAddressPrivateKey string `json:"closee_last_htlc_temp_address_private_key"`
CloseeLastHtlcTempAddressForHtnxPrivateKey string `json:"closee_last_htlc_temp_address_for_htnx_private_key"`
CloseeCurrRsmcTempAddressPubKey string `json:"closee_curr_rsmc_temp_address_pub_key"`
CloserCommitmentTxHash string `json:"closer_commitment_tx_hash"`
C4aRsmcCompleteSignedHex string `json:"c4a_rsmc_complete_signed_hex"`
C4aCounterpartyCompleteSignedHex string `json:"c4a_counterparty_complete_signed_hex"`
C4aRdPartialSignedData NeedClientSignTxData `json:"c4a_rd_partial_signed_data"`
C4bRsmcPartialSignedData NeedClientSignTxData `json:"c4b_rsmc_partial_signed_data"`
C4bCounterpartyPartialSignedData NeedClientSignTxData `json:"c4b_counterparty_partial_signed_data"`
SendeeNodeAddress string `json:"sendee_node_address"`
SendeePeerId string `json:"sendee_peer_id"`
}
// 110050的推送信息
type NeedAliceSignRsmcTxForC4b struct {
ChannelId string `json:"channel_id"` //the global channel id.
C4aRdPartialSignedData NeedClientSignTxData `json:"c4a_rd_partial_signed_data"`
C4bRsmcPartialSignedData NeedClientSignTxData `json:"c4b_rsmc_partial_signed_data"`
C4bCounterpartyPartialSignedData NeedClientSignTxData `json:"c4b_counterparty_partial_signed_data"`
SendeeNodeAddress string `json:"sendee_node_address"`
SendeePeerId string `json:"sendee_peer_id"`
}
// 消息 100112(alice to obd) Alice完成对C2b的相关信息签名
type AliceSignedRsmcTxForC4b struct {
ChannelId string `json:"channel_id"`
C4aRdCompleteSignedHex string `json:"c4a_rd_complete_signed_hex"`
C4bRsmcCompleteSignedHex string `json:"c4b_rsmc_complete_signed_hex"`
C4bCounterpartyCompleteSignedHex string `json:"c4b_counterparty_complete_signed_hex"`
typeLengthValue
}
// 返回值 100112的返回值(obd to Alice) obd推送给alice,为c4b的Rd和BR签名
type NeedAliceSignRdTxForC4b struct {
ChannelId string `json:"channel_id"` //the global channel id.
C4bRdRawData NeedClientSignTxData `json:"c4b_rd_raw_data"`
C4bBrRawData NeedClientSignRawBRTxData `json:"c4b_br_raw_data"`
SendeeNodeAddress string `json:"sendee_node_address"`
SendeePeerId string `json:"sendee_peer_id"`
}
// 消息 100113(alice to obd) Alice完成对C4b的Rd和BR的相关信息签名
type AliceSignedRdTxForC4b struct {
ChannelId string `json:"channel_id"`
C4bRdPartialSignedHex string `json:"c4b_rd_partial_signed_hex"`
C4bBrPartialSignedHex string `json:"c4b_br_partial_signed_hex"`
C4bBrId int64 `json:"c4b_br_id"`
typeLengthValue
}
// p2p 消息 51(obd of alice to obd of bob) Alice完成c2b的Rd和Br的签名,把签名结果发给bob所在的obd
type AliceSignedC4bTxDataP2p struct {
ChannelId string `json:"channel_id"`
C4aCommitmentTxHash string `json:"c4a_commitment_tx_hash"`
C4bRsmcCompleteSignedHex string `json:"c4b_rsmc_complete_signed_hex"`
C4bCounterpartyCompleteSignedHex string `json:"c4b_counterparty_complete_signed_hex"`
C4bRdPartialSignedData NeedClientSignTxData `json:"c4b_rd_partial_signed_data"`
}
// 返回值 110353(obd to bob) 353给bob的返回值 把需要签名的rd交易推给bob
type NeedBobSignRdTxForC4b struct {
ChannelId string `json:"channel_id"`
C4bRdPartialSignedData NeedClientSignTxData `json:"c4b_rd_partial_signed_data"`
}
// 消息 100364(to obd) bob签名rd完成后的结果
type BobSignedRdTxForC4b struct {
ChannelId string `json:"channel_id"`
C4bRdCompleteSignedHex string `json:"c4b_rd_complete_signed_hex"`
typeLengthValue
}