Skip to content

Commit 258049c

Browse files
authored
Merge pull request #1825 from guggero/btcec-v2-no-circular-dep
mod: remove `btcutil` circular dependency with main module
2 parents 44d51eb + b29ce97 commit 258049c

324 files changed

Lines changed: 1823 additions & 1469 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ jobs:
5656
format: 'golang'
5757
parallel: true
5858

59-
- name: Send btcec
59+
- name: Send address coverage
60+
uses: coverallsapp/github-action@v2
61+
with:
62+
file: address/coverage.txt
63+
flag-name: address
64+
format: 'golang'
65+
parallel: true
66+
67+
- name: Send btcec coverage
6068
uses: coverallsapp/github-action@v2
6169
continue-on-error: true
6270
with:
@@ -65,6 +73,22 @@ jobs:
6573
format: 'golang'
6674
parallel: true
6775

76+
- name: Send chaincfg coverage
77+
uses: coverallsapp/github-action@v2
78+
with:
79+
file: chaincfg/coverage.txt
80+
flag-name: chaincfg
81+
format: 'golang'
82+
parallel: true
83+
84+
- name: Send chainhash coverage
85+
uses: coverallsapp/github-action@v2
86+
with:
87+
file: chainhash/coverage.txt
88+
flag-name: chainhash
89+
format: 'golang'
90+
parallel: true
91+
6892
- name: Send btcutil coverage
6993
uses: coverallsapp/github-action@v2
7094
continue-on-error: true
@@ -74,15 +98,33 @@ jobs:
7498
format: 'golang'
7599
parallel: true
76100

77-
- name: Send btcutil coverage for psbt package
101+
- name: Send psbt coverage
102+
uses: coverallsapp/github-action@v2
103+
continue-on-error: true
104+
with:
105+
file: psbt/coverage.txt
106+
flag-name: psbt
107+
format: 'golang'
108+
parallel: true
109+
110+
- name: Send txscript coverage
78111
uses: coverallsapp/github-action@v2
79112
continue-on-error: true
80113
with:
81-
file: btcutil/psbt/coverage.txt
82-
flag-name: btcutilpsbt
114+
file: txscript/coverage.txt
115+
flag-name: txscript
83116
format: 'golang'
84117
parallel: true
85-
118+
119+
- name: Send wire coverage
120+
uses: coverallsapp/github-action@v2
121+
continue-on-error: true
122+
with:
123+
file: wire/coverage.txt
124+
flag-name: wire
125+
format: 'golang'
126+
parallel: true
127+
86128
- name: Notify coveralls all reports sent
87129
uses: coverallsapp/github-action@v2
88130
continue-on-error: true

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ _testmain.go
3737
profile.tmp
3838
profile.cov
3939
coverage.txt
40-
btcec/coverage.txt
41-
btcutil/coverage.txt
42-
btcutil/psbt/coverage.txt
40+
coverage.txt.bak
4341

4442
# vim
4543
*.swp

Makefile

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@ check: unit
9696
unit:
9797
@$(call print, "Running unit tests.")
9898
$(GOTEST_DEV) ./... -test.timeout=20m
99+
cd address && $(GOTEST_DEV) ./... -test.timeout=20m
99100
cd btcec && $(GOTEST_DEV) ./... -test.timeout=20m
100101
cd btcutil && $(GOTEST_DEV) ./... -test.timeout=20m
101-
cd btcutil/psbt && $(GOTEST_DEV) ./... -test.timeout=20m
102+
cd chaincfg && $(GOTEST_DEV) ./... -test.timeout=20m
103+
cd chainhash && $(GOTEST_DEV) ./... -test.timeout=20m
104+
cd txscript && $(GOTEST_DEV) ./... -test.timeout=20m
105+
cd psbt && $(GOTEST_DEV) ./... -test.timeout=20m
106+
cd wire && $(GOTEST_DEV) ./... -test.timeout=20m
102107

103108
#? unit-cover: Run unit coverage tests
104109
unit-cover:
@@ -107,17 +112,27 @@ unit-cover:
107112

108113
# We need to remove the /v2 pathing from the module to have it work
109114
# nicely with the CI tool we use to render live code coverage.
115+
cd address && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
110116
cd btcec && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
111-
cd btcutil && $(GOTEST) $(COVER_FLAGS) ./...
112-
cd btcutil/psbt && $(GOTEST) $(COVER_FLAGS) ./...
117+
cd btcutil && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
118+
cd chaincfg && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
119+
cd chainhash && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
120+
cd txscript && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
121+
cd psbt && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
122+
cd wire && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt
113123

114124
#? unit-race: Run unit race tests
115125
unit-race:
116126
@$(call print, "Running unit race tests.")
117127
env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
128+
cd address && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
118129
cd btcec && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
119130
cd btcutil && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
120-
cd btcutil/psbt && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
131+
cd chaincfg && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
132+
cd chainhash && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
133+
cd txscript && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
134+
cd psbt && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
135+
cd wire && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./...
121136

122137
# =========
123138
# UTILITIES
@@ -138,7 +153,8 @@ lint: $(LINT_BIN)
138153
#? clean: Clean source
139154
clean:
140155
@$(call print, "Cleaning source.$(NC)")
141-
rm -f coverage.txt btcec/coverage.txt btcutil/coverage.txt btcutil/psbt/coverage.txt
156+
find . -name coverage.txt | xargs $(RM)
157+
find . -name coverage.txt.bak | xargs $(RM)
142158

143159
#? tidy-module: Run 'go mod tidy' for all modules
144160
tidy-module:
@@ -162,4 +178,4 @@ help: Makefile
162178
@echo " Choose a command run in btcd:"
163179
@sed -n 's/^#?//p' $< | column -t -s ':' | sort | sed -e 's/^/ /'
164180

165-
.PHONY: help
181+
.PHONY: help
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by an ISC
33
// license that can be found in the LICENSE file.
44

5-
package btcutil
5+
package address
66

77
import (
88
"bytes"
@@ -11,10 +11,10 @@ import (
1111
"fmt"
1212
"strings"
1313

14+
"github.com/btcsuite/btcd/address/v2/base58"
15+
"github.com/btcsuite/btcd/address/v2/bech32"
1416
"github.com/btcsuite/btcd/btcec/v2"
15-
"github.com/btcsuite/btcd/btcutil/base58"
16-
"github.com/btcsuite/btcd/btcutil/bech32"
17-
"github.com/btcsuite/btcd/chaincfg"
17+
"github.com/btcsuite/btcd/chaincfg/v2"
1818
"golang.org/x/crypto/ripemd160"
1919
)
2020

0 commit comments

Comments
 (0)