What changed, and why it matters
This commit is a routine Go module restructuring: it makes the chaincfg package its own versioned module (chaincfg/v2) and updates its internal imports to use versioned chainhash/v2 and wire/v2 modules. There are no code logic changes, no bug fixes, and no security-sensitive behavior changes visible in the diff.
No security action required. Treat as normal dependency/module maintenance. Consumers importing chaincfg should update to chaincfg/v2 when adopting the new module version.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff shows only import-path changes (chaincfg -> chaincfg/v2, chainhash -> chainhash/v2, wire -> wire/v2), README/doc updates, and the addition of a new go.mod/go.sum for the chaincfg/v2 module. No executable code semantics are modified. The replace directives in go.mod point to local paths for sibling modules that are not yet tagged, which is standard Go workspace/module development practice.
Changed components
chaincfg package module definitionchaincfg import pathschaincfg/go.modchaincfg/go.sumInspect captured patch +48 / −11
diff --git a/chaincfg/README.md b/chaincfg/README.md
index d1a534b..41b9a71 100644
--- a/chaincfg/README.md
+++ b/chaincfg/README.md
@@ -3,7 +3,7 @@ chaincfg
[](https://github.com/btcsuite/btcd/actions)
[](http://copyfree.org)
-[](https://pkg.go.dev/github.com/btcsuite/btcd/chaincfg)
+[](https://pkg.go.dev/github.com/btcsuite/btcd/chaincfg/v2)
Package chaincfg defines chain configuration parameters for the three standard
Bitcoin networks and provides the ability for callers to define their own custom
@@ -25,7 +25,7 @@ import (
"log"
"github.com/btcsuite/btcd/btcutil"
- "github.com/btcsuite/btcd/chaincfg"
+ "github.com/btcsuite/btcd/chaincfg/v2"
)
var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network")
@@ -56,7 +56,7 @@ func main() {
## Installation and Updating
```bash
-$ go get -u github.com/btcsuite/btcd/chaincfg
+$ go get -u github.com/btcsuite/btcd/chaincfg/v2
```
## GPG Verification Key
diff --git a/chaincfg/deployment_time_frame.go b/chaincfg/deployment_time_frame.go
index f26d429..c334797 100644
--- a/chaincfg/deployment_time_frame.go
+++ b/chaincfg/deployment_time_frame.go
@@ -4,7 +4,7 @@ import (
"fmt"
"time"
- "github.com/btcsuite/btcd/wire"
+ "github.com/btcsuite/btcd/wire/v2"
)
var (
diff --git a/chaincfg/doc.go b/chaincfg/doc.go
index 65efb54..93193dc 100644
--- a/chaincfg/doc.go
+++ b/chaincfg/doc.go
@@ -26,7 +26,7 @@
// "log"
//
// "github.com/btcsuite/btcd/btcutil"
-// "github.com/btcsuite/btcd/chaincfg"
+// "github.com/btcsuite/btcd/chaincfg/v2"
// )
//
// var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network")
diff --git a/chaincfg/genesis.go b/chaincfg/genesis.go
index f734feb..8b8f5ed 100644
--- a/chaincfg/genesis.go
+++ b/chaincfg/genesis.go
@@ -7,8 +7,8 @@ package chaincfg
import (
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
- "github.com/btcsuite/btcd/wire"
+ "github.com/btcsuite/btcd/chainhash/v2"
+ "github.com/btcsuite/btcd/wire/v2"
)
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
diff --git a/chaincfg/go.mod b/chaincfg/go.mod
new file mode 100644
index 0000000..7f6219c
--- /dev/null
+++ b/chaincfg/go.mod
@@ -0,0 +1,23 @@
+module github.com/btcsuite/btcd/chaincfg/v2
+
+go 1.23.2
+
+require (
+ github.com/btcsuite/btcd/chainhash/v2 v2.0.0
+ github.com/btcsuite/btcd/wire/v2 v2.0.0
+ github.com/davecgh/go-spew v1.1.1
+ github.com/stretchr/testify v1.10.0
+)
+
+require (
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ golang.org/x/crypto v0.40.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
+
+// TODO(guggero): Remove once we have a tagged version of the wire package.
+replace github.com/btcsuite/btcd/wire/v2 => ../wire
diff --git a/chaincfg/go.sum b/chaincfg/go.sum
new file mode 100644
index 0000000..76acb2a
--- /dev/null
+++ b/chaincfg/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/chaincfg/params.go b/chaincfg/params.go
index 5eda032..14056d7 100644
--- a/chaincfg/params.go
+++ b/chaincfg/params.go
@@ -13,8 +13,8 @@ import (
"strings"
"time"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
- "github.com/btcsuite/btcd/wire"
+ "github.com/btcsuite/btcd/chainhash/v2"
+ "github.com/btcsuite/btcd/wire/v2"
)
// These variables are the chain proof-of-work limit parameters for each default
diff --git a/chaincfg/params_test.go b/chaincfg/params_test.go
index 4d3f4d2..c71f9ce 100644
--- a/chaincfg/params_test.go
+++ b/chaincfg/params_test.go
@@ -10,7 +10,7 @@ import (
"math/big"
"testing"
- "github.com/btcsuite/btcd/wire"
+ "github.com/btcsuite/btcd/wire/v2"
"github.com/stretchr/testify/require"
)
diff --git a/chaincfg/register_test.go b/chaincfg/register_test.go
index db25441..eb2c889 100644
--- a/chaincfg/register_test.go
+++ b/chaincfg/register_test.go
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
- . "github.com/btcsuite/btcd/chaincfg"
+ . "github.com/btcsuite/btcd/chaincfg/v2"
)
// Define some of the required parameters for a user-registered
Why this scored 20/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.