lnwire: update MessageType definition to include new funding messages

This commit is contained in:
Olaoluwa Osuntokun committed 2017-07-30 17:47:48 -07:00
1 parent 364a9a8059
commit 53f45e8210
1 file changed
+40 -39
+40 -39
View File
@@ -23,28 +23,28 @@ type MessageType uint16
// The currently defined message types within this current version of the // The currently defined message types within this current version of the
// Lightning protocol. // Lightning protocol.
const ( const (
MsgInit MessageType = 16 MsgInit MessageType = 16
MsgError = 17 MsgError = 17
MsgPing = 18 MsgPing = 18
MsgPong = 19 MsgPong = 19
MsgSingleFundingRequest = 32 MsgOpenChannel = 32
MsgSingleFundingResponse = 33 MsgAcceptChannel = 33
MsgSingleFundingComplete = 34 MsgFundingCreated = 34
MsgSingleFundingSignComplete = 35 MsgFundingSigned = 35
MsgFundingLocked = 36 MsgFundingLocked = 36
MsgShutdown = 39 MsgShutdown = 39
MsgClosingSigned = 40 MsgClosingSigned = 40
MsgUpdateAddHTLC = 128 MsgUpdateAddHTLC = 128
MsgUpdateFufillHTLC = 130 MsgUpdateFufillHTLC = 130
MsgUpdateFailHTLC = 131 MsgUpdateFailHTLC = 131
MsgCommitSig = 132 MsgCommitSig = 132
MsgRevokeAndAck = 133 MsgRevokeAndAck = 133
MsgUpdateFailMalformedHTLC = 135 MsgUpdateFailMalformedHTLC = 135
MsgUpdateFee = 137 MsgUpdateFee = 137
MsgChannelAnnouncement = 256 MsgChannelAnnouncement = 256
MsgNodeAnnouncement = 257 MsgNodeAnnouncement = 257
MsgChannelUpdate = 258 MsgChannelUpdate = 258
MsgAnnounceSignatures = 259 MsgAnnounceSignatures = 259
) )
// String return the string representation of message type. // String return the string representation of message type.
@@ -52,14 +52,14 @@ func (t MessageType) String() string {
switch t { switch t {
case MsgInit: case MsgInit:
return "Init" return "Init"
case MsgSingleFundingRequest: case MsgOpenChannel:
return "SingleFundingRequest" return "MsgOpenChannel"
case MsgSingleFundingResponse: case MsgAcceptChannel:
return "SingleFundingResponse" return "MsgAcceptChannel"
case MsgSingleFundingComplete: case MsgFundingCreated:
return "SingleFundingComplete" return "MsgFundingCreated"
case MsgSingleFundingSignComplete: case MsgFundingSigned:
return "SingleFundingSignComplete" return "MsgFundingSigned"
case MsgFundingLocked: case MsgFundingLocked:
return "FundingLocked" return "FundingLocked"
case MsgShutdown: case MsgShutdown:
@@ -117,7 +117,8 @@ type Serializable interface {
// Decode reads the bytes stream and converts it to the object. // Decode reads the bytes stream and converts it to the object.
Decode(io.Reader, uint32) error Decode(io.Reader, uint32) error
// Encode converts object to the bytes stream and write it in th writer. // Encode converts object to the bytes stream and write it into the
// writer.
Encode(io.Writer, uint32) error Encode(io.Writer, uint32) error
} }
@@ -138,14 +139,14 @@ func makeEmptyMessage(msgType MessageType) (Message, error) {
switch msgType { switch msgType {
case MsgInit: case MsgInit:
msg = &Init{} msg = &Init{}
case MsgSingleFundingRequest: case MsgOpenChannel:
msg = &SingleFundingRequest{} msg = &OpenChannel{}
case MsgSingleFundingResponse: case MsgAcceptChannel:
msg = &SingleFundingResponse{} msg = &AcceptChannel{}
case MsgSingleFundingComplete: case MsgFundingCreated:
msg = &SingleFundingComplete{} msg = &FundingCreated{}
case MsgSingleFundingSignComplete: case MsgFundingSigned:
msg = &SingleFundingSignComplete{} msg = &FundingSigned{}
case MsgFundingLocked: case MsgFundingLocked:
msg = &FundingLocked{} msg = &FundingLocked{}
case MsgShutdown: case MsgShutdown: