What changed, and why it matters
This commit is a routine Go module restructuring: it makes the `wire` package its own standalone Go module and updates its import path to version 2 (`github.com/btcsuite/btcd/wire/v2`). It also updates internal imports of the `chainhash` package to use its new v2 path. There are no functional code changes, no bug fixes, and no security-relevant modifications visible in the diff.
No security action required. Treat as normal maintenance/refactoring. Verify downstream consumers update their import paths to `github.com/btcsuite/btcd/wire/v2` if they depend on this module.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff shows only mechanical changes: addition of wire/go.mod and wire/go.sum, README badge/installation path updates, and replacement of github.com/btcsuite/btcd/chaincfg/chainhash imports with github.com/btcsuite/btcd/chainhash/v2 across wire package source and test files. No logic, serialization, validation, or protocol behavior is altered. The replace directive in go.mod points to a local ../chainhash path, which is a normal monorepo development pattern.
Changed components
wire module packaging and import pathsInspect captured patch +64 / −31
diff --git a/wire/README.md b/wire/README.md
index 8660bbf..33ded2d 100644
--- a/wire/README.md
+++ b/wire/README.md
@@ -3,7 +3,7 @@ wire
[](https://github.com/btcsuite/btcd/actions)
[](http://copyfree.org)
-[](https://pkg.go.dev/github.com/btcsuite/btcd/wire)
+[](https://pkg.go.dev/github.com/btcsuite/btcd/wire/v2)
=======
Package wire implements the bitcoin wire protocol. A comprehensive suite of
@@ -19,7 +19,7 @@ protocol level.
## Installation and Updating
```bash
-$ go get -u github.com/btcsuite/btcd/wire
+$ go get -u github.com/btcsuite/btcd/wire/v2
```
## Bitcoin Message Overview
diff --git a/wire/bench_test.go b/wire/bench_test.go
index 266aded..fdcab57 100644
--- a/wire/bench_test.go
+++ b/wire/bench_test.go
@@ -13,7 +13,7 @@ import (
"os"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
diff --git a/wire/blockheader.go b/wire/blockheader.go
index b5bce44..dd0d716 100644
--- a/wire/blockheader.go
+++ b/wire/blockheader.go
@@ -8,7 +8,7 @@ import (
"io"
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MaxBlockHeaderPayload is the maximum number of bytes a block header can be.
diff --git a/wire/common.go b/wire/common.go
index d3a82c4..24c4061 100644
--- a/wire/common.go
+++ b/wire/common.go
@@ -12,7 +12,7 @@ import (
"math"
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
const (
diff --git a/wire/common_test.go b/wire/common_test.go
index 46e3fa6..b9b120e 100644
--- a/wire/common_test.go
+++ b/wire/common_test.go
@@ -12,7 +12,7 @@ import (
"strings"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/go.mod b/wire/go.mod
new file mode 100644
index 0000000..4d011b5
--- /dev/null
+++ b/wire/go.mod
@@ -0,0 +1,19 @@
+module github.com/btcsuite/btcd/wire/v2
+
+go 1.23.2
+
+require (
+ github.com/btcsuite/btcd/chainhash/v2 v2.0.0
+ github.com/davecgh/go-spew v1.1.1
+ github.com/stretchr/testify v1.10.0
+ golang.org/x/crypto v0.40.0
+)
+
+require (
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ golang.org/x/sys v0.35.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+)
+
+// TODO(guggero): Remove once we have a tagged version of the chainhash package.
+replace github.com/btcsuite/btcd/chainhash/v2 => ../chainhash
diff --git a/wire/go.sum b/wire/go.sum
new file mode 100644
index 0000000..76acb2a
--- /dev/null
+++ b/wire/go.sum
@@ -0,0 +1,14 @@
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
+github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
+golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
+golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
+golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/wire/invvect.go b/wire/invvect.go
index c0756a8..181ef48 100644
--- a/wire/invvect.go
+++ b/wire/invvect.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
const (
diff --git a/wire/invvect_test.go b/wire/invvect_test.go
index cf29d0a..25b1468 100644
--- a/wire/invvect_test.go
+++ b/wire/invvect_test.go
@@ -9,7 +9,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/message.go b/wire/message.go
index 1f3933a..73bae42 100644
--- a/wire/message.go
+++ b/wire/message.go
@@ -10,7 +10,7 @@ import (
"io"
"unicode/utf8"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MessageHeaderSize is the number of bytes in a bitcoin message header.
diff --git a/wire/message_test.go b/wire/message_test.go
index c0715c4..278d8c2 100644
--- a/wire/message_test.go
+++ b/wire/message_test.go
@@ -14,7 +14,7 @@ import (
"testing"
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msgblock.go b/wire/msgblock.go
index 59dbbb1..2879357 100644
--- a/wire/msgblock.go
+++ b/wire/msgblock.go
@@ -9,7 +9,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// defaultTransactionAlloc is the default size used for the backing array
diff --git a/wire/msgblock_test.go b/wire/msgblock_test.go
index f0e9386..f7cc308 100644
--- a/wire/msgblock_test.go
+++ b/wire/msgblock_test.go
@@ -11,7 +11,7 @@ import (
"testing"
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msgcfcheckpt.go b/wire/msgcfcheckpt.go
index a06ce1f..92021ee 100644
--- a/wire/msgcfcheckpt.go
+++ b/wire/msgcfcheckpt.go
@@ -9,7 +9,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
const (
diff --git a/wire/msgcfcheckpt_bench_test.go b/wire/msgcfcheckpt_bench_test.go
index 0bc3b7d..9057aa3 100644
--- a/wire/msgcfcheckpt_bench_test.go
+++ b/wire/msgcfcheckpt_bench_test.go
@@ -10,7 +10,7 @@ import (
"math/rand"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// BenchmarkMsgCFCheckptDecode benchmarks decoding of MsgCFCheckpt messages
diff --git a/wire/msgcfheaders.go b/wire/msgcfheaders.go
index e1af2c3..6a28001 100644
--- a/wire/msgcfheaders.go
+++ b/wire/msgcfheaders.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
const (
diff --git a/wire/msgcfilter.go b/wire/msgcfilter.go
index d7cf163..106d52e 100644
--- a/wire/msgcfilter.go
+++ b/wire/msgcfilter.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// FilterType is used to represent a filter type.
diff --git a/wire/msggetblocks.go b/wire/msggetblocks.go
index da8bb87..ba77c69 100644
--- a/wire/msggetblocks.go
+++ b/wire/msggetblocks.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MaxBlockLocatorsPerMsg is the maximum number of block locator hashes allowed
diff --git a/wire/msggetblocks_test.go b/wire/msggetblocks_test.go
index 376f733..acedb8a 100644
--- a/wire/msggetblocks_test.go
+++ b/wire/msggetblocks_test.go
@@ -10,7 +10,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msggetcfcheckpt.go b/wire/msggetcfcheckpt.go
index c57aa5a..7d003fd 100644
--- a/wire/msggetcfcheckpt.go
+++ b/wire/msggetcfcheckpt.go
@@ -7,7 +7,7 @@ package wire
import (
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MsgGetCFCheckpt is a request for filter headers at evenly spaced intervals
diff --git a/wire/msggetcfheaders.go b/wire/msggetcfheaders.go
index e26f439..484ddde 100644
--- a/wire/msggetcfheaders.go
+++ b/wire/msggetcfheaders.go
@@ -7,7 +7,7 @@ package wire
import (
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MsgGetCFHeaders is a message similar to MsgGetHeaders, but for committed
diff --git a/wire/msggetcfilters.go b/wire/msggetcfilters.go
index 1e6e225..d986647 100644
--- a/wire/msggetcfilters.go
+++ b/wire/msggetcfilters.go
@@ -7,7 +7,7 @@ package wire
import (
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MaxGetCFiltersReqRange the maximum number of filters that may be requested in
diff --git a/wire/msggetdata_test.go b/wire/msggetdata_test.go
index a2dd465..308c6b9 100644
--- a/wire/msggetdata_test.go
+++ b/wire/msggetdata_test.go
@@ -10,7 +10,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msggetheaders.go b/wire/msggetheaders.go
index 38e5c6b..0544008 100644
--- a/wire/msggetheaders.go
+++ b/wire/msggetheaders.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// MsgGetHeaders implements the Message interface and represents a bitcoin
diff --git a/wire/msggetheaders_test.go b/wire/msggetheaders_test.go
index 34a24ae..28a75f1 100644
--- a/wire/msggetheaders_test.go
+++ b/wire/msggetheaders_test.go
@@ -10,7 +10,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msginv_test.go b/wire/msginv_test.go
index b7c7c6a..8700eba 100644
--- a/wire/msginv_test.go
+++ b/wire/msginv_test.go
@@ -10,7 +10,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msgmerkleblock.go b/wire/msgmerkleblock.go
index eacbdc5..ac9f3ab 100644
--- a/wire/msgmerkleblock.go
+++ b/wire/msgmerkleblock.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// maxFlagsPerMerkleBlock is the maximum number of flag bytes that could
diff --git a/wire/msgmerkleblock_test.go b/wire/msgmerkleblock_test.go
index 9837f8a..829ff31 100644
--- a/wire/msgmerkleblock_test.go
+++ b/wire/msgmerkleblock_test.go
@@ -12,7 +12,7 @@ import (
"testing"
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msgnotfound_test.go b/wire/msgnotfound_test.go
index 69b9d07..3d724e8 100644
--- a/wire/msgnotfound_test.go
+++ b/wire/msgnotfound_test.go
@@ -10,7 +10,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
)
diff --git a/wire/msgreject.go b/wire/msgreject.go
index 7b7488f..0a35174 100644
--- a/wire/msgreject.go
+++ b/wire/msgreject.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
// RejectCode represents a numeric value by which a remote peer indicates
diff --git a/wire/msgtx.go b/wire/msgtx.go
index 4afe33b..4a0d11d 100644
--- a/wire/msgtx.go
+++ b/wire/msgtx.go
@@ -12,7 +12,7 @@ import (
"strconv"
"strings"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
)
const (
diff --git a/wire/msgtx_test.go b/wire/msgtx_test.go
index ccde070..213f2ab 100644
--- a/wire/msgtx_test.go
+++ b/wire/msgtx_test.go
@@ -12,7 +12,7 @@ import (
"reflect"
"testing"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
+ "github.com/btcsuite/btcd/chainhash/v2"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/require"
)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.