From fac4c14dbbef18d47655658ddcbc52f01d263e71 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 31 Oct 2023 21:49:19 -0500 Subject: [PATCH] wire: Mark legacy message types as deprecated. This marks the various messages types and commands associated with version 1 cfilters as deprecated since they are no longer valid and will eventually be removed whenever a new major version of the wire module is released.. --- wire/message.go | 32 ++++++++++++++++++++++++++------ wire/msgcfheaders.go | 8 +++++++- wire/msgcfilter.go | 8 +++++++- wire/msgcftypes.go | 8 +++++++- wire/msggetcfheaders.go | 8 +++++++- wire/msggetcfilter.go | 8 +++++++- wire/msggetcftypes.go | 8 +++++++- 7 files changed, 68 insertions(+), 12 deletions(-) diff --git a/wire/message.go b/wire/message.go index fe771a258a..f0aa4ae96d 100644 --- a/wire/message.go +++ b/wire/message.go @@ -48,18 +48,38 @@ const ( CmdReject = "reject" CmdSendHeaders = "sendheaders" CmdFeeFilter = "feefilter" - CmdGetCFilter = "getcfilter" - CmdGetCFHeaders = "getcfheaders" - CmdGetCFTypes = "getcftypes" - CmdCFilter = "cfilter" - CmdCFHeaders = "cfheaders" - CmdCFTypes = "cftypes" CmdGetCFilterV2 = "getcfilterv2" CmdCFilterV2 = "cfilterv2" CmdGetInitState = "getinitstate" CmdInitState = "initstate" ) +const ( + // Deprecated: This command is no longer valid as of protocol version + // CFilterV2Version. + CmdGetCFilter = "getcfilter" + + // Deprecated: This command is no longer valid as of protocol version + // CFilterV2Version. + CmdGetCFHeaders = "getcfheaders" + + // Deprecated: This command is no longer valid as of protocol version + // CFilterV2Version. + CmdGetCFTypes = "getcftypes" + + // Deprecated: This command is no longer valid as of protocol version + // CFilterV2Version. + CmdCFilter = "cfilter" + + // Deprecated: This command is no longer valid as of protocol version + // CFilterV2Version. + CmdCFHeaders = "cfheaders" + + // Deprecated: This command is no longer valid as of protocol version + // CFilterV2Version. + CmdCFTypes = "cftypes" +) + // Message is an interface that describes a Decred message. A type that // implements Message has complete control over the representation of its data // and may therefore contain additional or fewer fields than those which diff --git a/wire/msgcfheaders.go b/wire/msgcfheaders.go index cbf40f176a..acd53c6f7f 100644 --- a/wire/msgcfheaders.go +++ b/wire/msgcfheaders.go @@ -1,6 +1,6 @@ // Copyright (c) 2017 The btcsuite developers // Copyright (c) 2017 The Lightning Network Developers -// Copyright (c) 2018-2020 The Decred developers +// Copyright (c) 2018-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -28,6 +28,9 @@ const ( // response to a getcfheaders message (MsgGetCFHeaders). The maximum number of // committed filter headers per message is currently 2000. See MsgGetCFHeaders // for details on requesting the headers. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. type MsgCFHeaders struct { StopHash chainhash.Hash FilterType FilterType @@ -174,6 +177,9 @@ func (msg *MsgCFHeaders) MaxPayloadLength(pver uint32) uint32 { // NewMsgCFHeaders returns a new cfheaders message that conforms to the Message // interface. See MsgCFHeaders for details. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. func NewMsgCFHeaders() *MsgCFHeaders { return &MsgCFHeaders{ HeaderHashes: make([]*chainhash.Hash, 0, MaxCFHeadersPerMsg), diff --git a/wire/msgcfilter.go b/wire/msgcfilter.go index d54e2a4b72..a120ab6d78 100644 --- a/wire/msgcfilter.go +++ b/wire/msgcfilter.go @@ -1,6 +1,6 @@ // Copyright (c) 2017 The btcsuite developers // Copyright (c) 2017 The Lightning Network Developers -// Copyright (c) 2018-2020 The Decred developers +// Copyright (c) 2018-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -22,6 +22,9 @@ const ( // MsgCFilter implements the Message interface and represents a cfilter message. // It is used to deliver a committed filter in response to a getcfilter // (MsgGetCFilter) message. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. type MsgCFilter struct { BlockHash chainhash.Hash FilterType FilterType @@ -115,6 +118,9 @@ func (msg *MsgCFilter) MaxPayloadLength(pver uint32) uint32 { // NewMsgCFilter returns a new cfilter message that conforms to the Message // interface. See MsgCFilter for details. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. func NewMsgCFilter(blockHash *chainhash.Hash, filterType FilterType, data []byte) *MsgCFilter { return &MsgCFilter{ diff --git a/wire/msgcftypes.go b/wire/msgcftypes.go index 54d4ada8d7..3bf218f110 100644 --- a/wire/msgcftypes.go +++ b/wire/msgcftypes.go @@ -1,6 +1,6 @@ // Copyright (c) 2017 The btcsuite developers // Copyright (c) 2017 The Lightning Network Developers -// Copyright (c) 2018-2020 The Decred developers +// Copyright (c) 2018-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -27,6 +27,9 @@ const ( ) // MsgCFTypes is the cftypes message. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. type MsgCFTypes struct { SupportedFilters []FilterType } @@ -129,6 +132,9 @@ func (msg *MsgCFTypes) MaxPayloadLength(pver uint32) uint32 { // NewMsgCFTypes returns a new cftypes message that conforms to the Message // interface. See MsgCFTypes for details. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. func NewMsgCFTypes(filterTypes []FilterType) *MsgCFTypes { return &MsgCFTypes{ SupportedFilters: filterTypes, diff --git a/wire/msggetcfheaders.go b/wire/msggetcfheaders.go index 8f2a112672..a2b4f583ff 100644 --- a/wire/msggetcfheaders.go +++ b/wire/msggetcfheaders.go @@ -1,6 +1,6 @@ // Copyright (c) 2017 The btcsuite developers // Copyright (c) 2017 The Lightning Network Developers -// Copyright (c) 2018-2020 The Decred developers +// Copyright (c) 2018-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -16,6 +16,9 @@ import ( // MsgGetCFHeaders is a message similar to MsgGetHeaders, but for committed // filter headers. It allows to set the FilterType field to get headers in the // chain of basic (0x00) or extended (0x01) headers. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. type MsgGetCFHeaders struct { BlockLocatorHashes []*chainhash.Hash HashStop chainhash.Hash @@ -133,6 +136,9 @@ func (msg *MsgGetCFHeaders) MaxPayloadLength(pver uint32) uint32 { // NewMsgGetCFHeaders returns a new getcfheader message that conforms to the // Message interface using the passed parameters and defaults for the remaining // fields. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. func NewMsgGetCFHeaders() *MsgGetCFHeaders { return &MsgGetCFHeaders{ BlockLocatorHashes: make([]*chainhash.Hash, 0, diff --git a/wire/msggetcfilter.go b/wire/msggetcfilter.go index 5411f7a758..1973980ca5 100644 --- a/wire/msggetcfilter.go +++ b/wire/msggetcfilter.go @@ -1,6 +1,6 @@ // Copyright (c) 2017 The btcsuite developers // Copyright (c) 2017 The Lightning Network Developers -// Copyright (c) 2018-2020 The Decred developers +// Copyright (c) 2018-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -15,6 +15,9 @@ import ( // MsgGetCFilter implements the Message interface and represents a getcfilter // message. It is used to request a committed filter for a block. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. type MsgGetCFilter struct { BlockHash chainhash.Hash FilterType FilterType @@ -70,6 +73,9 @@ func (msg *MsgGetCFilter) MaxPayloadLength(pver uint32) uint32 { // NewMsgGetCFilter returns a new getcfilter message that conforms to the // Message interface using the passed parameters and defaults for the remaining // fields. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. func NewMsgGetCFilter(blockHash *chainhash.Hash, filterType FilterType) *MsgGetCFilter { return &MsgGetCFilter{ BlockHash: *blockHash, diff --git a/wire/msggetcftypes.go b/wire/msggetcftypes.go index 2516b05cf5..dea84bb665 100644 --- a/wire/msggetcftypes.go +++ b/wire/msggetcftypes.go @@ -1,6 +1,6 @@ // Copyright (c) 2017 The btcsuite developers // Copyright (c) 2017 The Lightning Network Developers -// Copyright (c) 2018-2020 The Decred developers +// Copyright (c) 2018-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -12,6 +12,9 @@ import ( ) // MsgGetCFTypes is the getcftypes message. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. type MsgGetCFTypes struct{} // BtcDecode decodes the receiver from w using the wire protocol encoding. @@ -55,6 +58,9 @@ func (msg *MsgGetCFTypes) MaxPayloadLength(pver uint32) uint32 { // NewMsgGetCFTypes returns a new getcftypes message that conforms to the // Message interface. +// +// Deprecated: This message is no longer valid as of protocol version +// CFilterV2Version. func NewMsgGetCFTypes() *MsgGetCFTypes { return &MsgGetCFTypes{} }