mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-10 09:19:28 +01:00
commit
9a88e1dd33
20 changed files with 92 additions and 83 deletions
27
.github/workflows/go.yml
vendored
Normal file
27
.github/workflows/go.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: Build and Test
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Go CI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: [1.13, 1.14]
|
||||||
|
steps:
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
- name: Check out source
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install Linters
|
||||||
|
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0"
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
run: go build ./...
|
||||||
|
- name: Test
|
||||||
|
env:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
run: |
|
||||||
|
sh ./goclean.sh
|
18
.travis.yml
18
.travis.yml
|
@ -1,18 +0,0 @@
|
||||||
language: go
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $GOCACHE
|
|
||||||
- $GOPATH/pkg/mod
|
|
||||||
- $GOPATH/github.com/golang
|
|
||||||
- $GOPATH/gopkg.in/alecthomas
|
|
||||||
go:
|
|
||||||
- "1.13.x"
|
|
||||||
sudo: false
|
|
||||||
install:
|
|
||||||
- export PATH=$PATH:$PWD/linux-amd64/
|
|
||||||
- GO111MODULE=on go install . ./cmd/...
|
|
||||||
- GO111MODULE=off go get -u gopkg.in/alecthomas/gometalinter.v2
|
|
||||||
- GO111MODULE=off gometalinter.v2 --install
|
|
||||||
script:
|
|
||||||
- export PATH=$PATH:$HOME/gopath/bin
|
|
||||||
- ./goclean.sh
|
|
|
@ -1,9 +1,9 @@
|
||||||
btcd
|
btcd
|
||||||
====
|
====
|
||||||
|
|
||||||
[](https://travis-ci.org/btcsuite/btcd)
|
[](https://github.com/btcsuite/btcd/actions)
|
||||||
[](http://copyfree.org)
|
[](http://copyfree.org)
|
||||||
[](http://godoc.org/github.com/btcsuite/btcd)
|
[](https://godoc.org/github.com/btcsuite/btcd)
|
||||||
|
|
||||||
btcd is an alternative full node bitcoin implementation written in Go (golang).
|
btcd is an alternative full node bitcoin implementation written in Go (golang).
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ func TestCalcWork(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for x, test := range tests {
|
for x, test := range tests {
|
||||||
bits := uint32(test.in)
|
bits := test.in
|
||||||
|
|
||||||
r := CalcWork(bits)
|
r := CalcWork(bits)
|
||||||
if r.Int64() != test.out {
|
if r.Int64() != test.out {
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (b *addrIndexBucket) printLevels(addrKey [addrKeySize]byte) string {
|
||||||
if !bytes.Equal(k[:levelOffset], addrKey[:]) {
|
if !bytes.Equal(k[:levelOffset], addrKey[:]) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
level := uint8(k[levelOffset])
|
level := k[levelOffset]
|
||||||
if level > highestLevel {
|
if level > highestLevel {
|
||||||
highestLevel = level
|
highestLevel = level
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ func (b *addrIndexBucket) sanityCheck(addrKey [addrKeySize]byte, expectedTotal i
|
||||||
if !bytes.Equal(k[:levelOffset], addrKey[:]) {
|
if !bytes.Equal(k[:levelOffset], addrKey[:]) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
level := uint8(k[levelOffset])
|
level := k[levelOffset]
|
||||||
if level > highestLevel {
|
if level > highestLevel {
|
||||||
highestLevel = level
|
highestLevel = level
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,11 +232,11 @@ func TestPubKeys(t *testing.T) {
|
||||||
var pkStr []byte
|
var pkStr []byte
|
||||||
switch test.format {
|
switch test.format {
|
||||||
case pubkeyUncompressed:
|
case pubkeyUncompressed:
|
||||||
pkStr = (*PublicKey)(pk).SerializeUncompressed()
|
pkStr = pk.SerializeUncompressed()
|
||||||
case pubkeyCompressed:
|
case pubkeyCompressed:
|
||||||
pkStr = (*PublicKey)(pk).SerializeCompressed()
|
pkStr = pk.SerializeCompressed()
|
||||||
case pubkeyHybrid:
|
case pubkeyHybrid:
|
||||||
pkStr = (*PublicKey)(pk).SerializeHybrid()
|
pkStr = pk.SerializeHybrid()
|
||||||
}
|
}
|
||||||
if !bytes.Equal(test.key, pkStr) {
|
if !bytes.Equal(test.key, pkStr) {
|
||||||
t.Errorf("%s pubkey: serialized keys do not match.",
|
t.Errorf("%s pubkey: serialized keys do not match.",
|
||||||
|
|
|
@ -464,8 +464,7 @@ func TestSignatureSerialize(t *testing.T) {
|
||||||
|
|
||||||
func testSignCompact(t *testing.T, tag string, curve *KoblitzCurve,
|
func testSignCompact(t *testing.T, tag string, curve *KoblitzCurve,
|
||||||
data []byte, isCompressed bool) {
|
data []byte, isCompressed bool) {
|
||||||
tmp, _ := NewPrivateKey(curve)
|
priv, _ := NewPrivateKey(curve)
|
||||||
priv := (*PrivateKey)(tmp)
|
|
||||||
|
|
||||||
hashed := []byte("testing")
|
hashed := []byte("testing")
|
||||||
sig, err := SignCompact(curve, priv, hashed, isCompressed)
|
sig, err := SignCompact(curve, priv, hashed, isCompressed)
|
||||||
|
|
|
@ -271,7 +271,7 @@ type GetBlockTemplateResult struct {
|
||||||
|
|
||||||
type MempoolFees struct {
|
type MempoolFees struct {
|
||||||
Base float64 `json:"base"`
|
Base float64 `json:"base"`
|
||||||
Modified float64 `json:"base"`
|
Modified float64 `json:"modified"`
|
||||||
Ancestor float64 `json:"ancestor"`
|
Ancestor float64 `json:"ancestor"`
|
||||||
Descendant float64 `json:"descendant"`
|
Descendant float64 `json:"descendant"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,6 @@ func RegisteredCmdMethods() []string {
|
||||||
methods = append(methods, k)
|
methods = append(methods, k)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(methods))
|
sort.Strings(methods)
|
||||||
return methods
|
return methods
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ func TestRegisteredCmdMethods(t *testing.T) {
|
||||||
// Ensure the returned methods are sorted.
|
// Ensure the returned methods are sorted.
|
||||||
sortedMethods := make([]string, len(methods))
|
sortedMethods := make([]string, len(methods))
|
||||||
copy(sortedMethods, methods)
|
copy(sortedMethods, methods)
|
||||||
sort.Sort(sort.StringSlice(sortedMethods))
|
sort.Strings(sortedMethods)
|
||||||
if !reflect.DeepEqual(sortedMethods, methods) {
|
if !reflect.DeepEqual(sortedMethods, methods) {
|
||||||
t.Fatal("RegisteredCmdMethods: methods are not sorted")
|
t.Fatal("RegisteredCmdMethods: methods are not sorted")
|
||||||
}
|
}
|
||||||
|
|
|
@ -643,9 +643,9 @@ func TestFailureScenarios(t *testing.T) {
|
||||||
// context.
|
// context.
|
||||||
maxSize := int64(-1)
|
maxSize := int64(-1)
|
||||||
if maxFileSize, ok := tc.maxFileSizes[fileNum]; ok {
|
if maxFileSize, ok := tc.maxFileSizes[fileNum]; ok {
|
||||||
maxSize = int64(maxFileSize)
|
maxSize = maxFileSize
|
||||||
}
|
}
|
||||||
file := &mockFile{maxSize: int64(maxSize)}
|
file := &mockFile{maxSize: maxSize}
|
||||||
tc.files[fileNum] = &lockableFile{file: file}
|
tc.files[fileNum] = &lockableFile{file: file}
|
||||||
return file, nil
|
return file, nil
|
||||||
}
|
}
|
||||||
|
|
15
go.mod
15
go.mod
|
@ -1,21 +1,16 @@
|
||||||
module github.com/btcsuite/btcd
|
module github.com/btcsuite/btcd
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/aead/siphash v1.0.1 // indirect
|
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
|
github.com/btcsuite/btcutil v1.0.2
|
||||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd
|
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd
|
||||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd
|
github.com/btcsuite/goleveldb v1.0.0
|
||||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723 // indirect
|
|
||||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
|
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
|
||||||
github.com/btcsuite/winsvc v1.0.0
|
github.com/btcsuite/winsvc v1.0.0
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89
|
github.com/jessevdk/go-flags v1.4.0
|
||||||
github.com/jrick/logrotate v1.0.0
|
github.com/jrick/logrotate v1.0.0
|
||||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 // indirect
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
|
||||||
github.com/onsi/ginkgo v1.7.0 // indirect
|
|
||||||
github.com/onsi/gomega v1.4.3 // indirect
|
|
||||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
23
go.sum
23
go.sum
|
@ -1,21 +1,29 @@
|
||||||
github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg=
|
github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg=
|
||||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||||
|
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng=
|
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
|
github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts=
|
||||||
|
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
|
||||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw=
|
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw=
|
||||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
||||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd h1:qdGvebPBDuYDPGi1WCPjy1tGyMpmDK8IEapSsszn7HE=
|
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd h1:qdGvebPBDuYDPGi1WCPjy1tGyMpmDK8IEapSsszn7HE=
|
||||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
||||||
|
github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4=
|
||||||
|
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
|
||||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723 h1:ZA/jbKoGcVAnER6pCHPEkGdZOV7U1oLUedErBHCUMs0=
|
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723 h1:ZA/jbKoGcVAnER6pCHPEkGdZOV7U1oLUedErBHCUMs0=
|
||||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||||
|
github.com/btcsuite/snappy-go v1.0.0 h1:ZxaA6lo2EpxGddsA8JwWOcxlzRybb444sgmeJQMJGQE=
|
||||||
|
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc=
|
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc=
|
||||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
||||||
github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk=
|
github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk=
|
||||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY=
|
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
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/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
@ -24,6 +32,8 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89 h1:12K8AlpT0/6QUXSfV0yi4Q0jkbq8NDtIKFtF61AoqV0=
|
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89 h1:12K8AlpT0/6QUXSfV0yi4Q0jkbq8NDtIKFtF61AoqV0=
|
||||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
|
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
||||||
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI=
|
github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI=
|
||||||
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
||||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE=
|
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE=
|
||||||
|
@ -31,16 +41,27 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
||||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||||
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
||||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44 h1:9lP3x0pW80sDI6t1UMSLA4to18W7R7imwAI/sWS9S8Q=
|
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44 h1:9lP3x0pW80sDI6t1UMSLA4to18W7R7imwAI/sWS9S8Q=
|
||||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw=
|
||||||
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
|
19
goclean.sh
19
goclean.sh
|
@ -1,31 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# The script does automatic checking on a Go package and its sub-packages, including:
|
# The script does automatic checking on a Go package and its sub-packages, including:
|
||||||
# 1. gofmt (http://golang.org/cmd/gofmt/)
|
# 1. gofmt (http://golang.org/cmd/gofmt/)
|
||||||
# 2. golint (https://github.com/golang/lint)
|
|
||||||
# 3. go vet (http://golang.org/cmd/vet)
|
# 3. go vet (http://golang.org/cmd/vet)
|
||||||
# 4. gosimple (https://github.com/dominikh/go-simple)
|
# 4. gosimple (https://github.com/dominikh/go-simple)
|
||||||
# 5. unconvert (https://github.com/mdempsky/unconvert)
|
# 5. unconvert (https://github.com/mdempsky/unconvert)
|
||||||
#
|
#
|
||||||
# gometalinter (github.com/alecthomas/gometalinter) is used to run each static
|
|
||||||
# checker.
|
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Make sure gometalinter is installed and $GOPATH/bin is in your path.
|
go test -tags="rpctest" ./...
|
||||||
# $ go get -v github.com/alecthomas/gometalinter"
|
|
||||||
# $ gometalinter --install"
|
|
||||||
if [ ! -x "$(type -p gometalinter.v2)" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
linter_targets=$(go list ./...)
|
|
||||||
|
|
||||||
# Automatic checks
|
# Automatic checks
|
||||||
test -z "$(gometalinter.v2 -j 4 --disable-all \
|
golangci-lint run --deadline=10m --disable-all \
|
||||||
--enable=gofmt \
|
--enable=gofmt \
|
||||||
--enable=golint \
|
|
||||||
--enable=vet \
|
--enable=vet \
|
||||||
--enable=gosimple \
|
--enable=gosimple \
|
||||||
--enable=unconvert \
|
--enable=unconvert
|
||||||
--deadline=10m $linter_targets 2>&1 | grep -v 'ALL_CAPS\|OP_' 2>&1 | tee /dev/stderr)"
|
|
||||||
GO111MODULE=on go test -tags="rpctest" $linter_targets
|
|
||||||
|
|
|
@ -1418,8 +1418,8 @@ func TestAncestorsDescendants(t *testing.T) {
|
||||||
// We'll be querying for the ancestors of E. We should expect to see all
|
// We'll be querying for the ancestors of E. We should expect to see all
|
||||||
// of the transactions that it depends on.
|
// of the transactions that it depends on.
|
||||||
expectedAncestors := map[chainhash.Hash]struct{}{
|
expectedAncestors := map[chainhash.Hash]struct{}{
|
||||||
*a.Hash(): struct{}{}, *b.Hash(): struct{}{},
|
*a.Hash(): {}, *b.Hash(): {},
|
||||||
*c.Hash(): struct{}{}, *d.Hash(): struct{}{},
|
*c.Hash(): {}, *d.Hash(): {},
|
||||||
}
|
}
|
||||||
ancestors := ctx.harness.txPool.txAncestors(e, nil)
|
ancestors := ctx.harness.txPool.txAncestors(e, nil)
|
||||||
if len(ancestors) != len(expectedAncestors) {
|
if len(ancestors) != len(expectedAncestors) {
|
||||||
|
@ -1436,8 +1436,8 @@ func TestAncestorsDescendants(t *testing.T) {
|
||||||
// Then, we'll query for the descendants of A. We should expect to see
|
// Then, we'll query for the descendants of A. We should expect to see
|
||||||
// all of the transactions that depend on it.
|
// all of the transactions that depend on it.
|
||||||
expectedDescendants := map[chainhash.Hash]struct{}{
|
expectedDescendants := map[chainhash.Hash]struct{}{
|
||||||
*b.Hash(): struct{}{}, *c.Hash(): struct{}{},
|
*b.Hash(): {}, *c.Hash(): {},
|
||||||
*d.Hash(): struct{}{}, *e.Hash(): struct{}{},
|
*d.Hash(): {}, *e.Hash(): {},
|
||||||
}
|
}
|
||||||
descendants := ctx.harness.txPool.txDescendants(a, nil)
|
descendants := ctx.harness.txPool.txDescendants(a, nil)
|
||||||
if len(descendants) != len(expectedDescendants) {
|
if len(descendants) != len(expectedDescendants) {
|
||||||
|
|
|
@ -818,7 +818,7 @@ func (c *helpCacher) rpcUsage(includeWebsockets bool) (string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(usageTexts))
|
sort.Strings(usageTexts)
|
||||||
c.usage = strings.Join(usageTexts, "\n")
|
c.usage = strings.Join(usageTexts, "\n")
|
||||||
return c.usage, nil
|
return c.usage, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2270,9 +2270,7 @@ out:
|
||||||
// When an InvVect has been added to a block, we can
|
// When an InvVect has been added to a block, we can
|
||||||
// now remove it, if it was present.
|
// now remove it, if it was present.
|
||||||
case broadcastInventoryDel:
|
case broadcastInventoryDel:
|
||||||
if _, ok := pendingInvs[*msg]; ok {
|
delete(pendingInvs, *msg)
|
||||||
delete(pendingInvs, *msg)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
|
|
|
@ -124,7 +124,7 @@ func TestOpcodeDisasm(t *testing.T) {
|
||||||
|
|
||||||
// OP_UNKNOWN#.
|
// OP_UNKNOWN#.
|
||||||
case opcodeVal >= 0xba && opcodeVal <= 0xf9 || opcodeVal == 0xfc:
|
case opcodeVal >= 0xba && opcodeVal <= 0xf9 || opcodeVal == 0xfc:
|
||||||
expectedStr = "OP_UNKNOWN" + strconv.Itoa(int(opcodeVal))
|
expectedStr = "OP_UNKNOWN" + strconv.Itoa(opcodeVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
pop := parsedOpcode{opcode: &opcodeArray[opcodeVal], data: data}
|
pop := parsedOpcode{opcode: &opcodeArray[opcodeVal], data: data}
|
||||||
|
@ -190,7 +190,7 @@ func TestOpcodeDisasm(t *testing.T) {
|
||||||
|
|
||||||
// OP_UNKNOWN#.
|
// OP_UNKNOWN#.
|
||||||
case opcodeVal >= 0xba && opcodeVal <= 0xf9 || opcodeVal == 0xfc:
|
case opcodeVal >= 0xba && opcodeVal <= 0xf9 || opcodeVal == 0xfc:
|
||||||
expectedStr = "OP_UNKNOWN" + strconv.Itoa(int(opcodeVal))
|
expectedStr = "OP_UNKNOWN" + strconv.Itoa(opcodeVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
pop := parsedOpcode{opcode: &opcodeArray[opcodeVal], data: data}
|
pop := parsedOpcode{opcode: &opcodeArray[opcodeVal], data: data}
|
||||||
|
|
|
@ -337,9 +337,9 @@ func TestComputePkScript(t *testing.T) {
|
||||||
name: "P2WSH witness",
|
name: "P2WSH witness",
|
||||||
sigScript: nil,
|
sigScript: nil,
|
||||||
witness: [][]byte{
|
witness: [][]byte{
|
||||||
[]byte{},
|
{},
|
||||||
// Witness script.
|
// Witness script.
|
||||||
[]byte{
|
{
|
||||||
0x21, 0x03, 0x82, 0x62, 0xa6, 0xc6,
|
0x21, 0x03, 0x82, 0x62, 0xa6, 0xc6,
|
||||||
0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd,
|
0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd,
|
||||||
0x6c, 0x60, 0x72, 0xef, 0xea, 0x86,
|
0x6c, 0x60, 0x72, 0xef, 0xea, 0x86,
|
||||||
|
@ -367,9 +367,9 @@ func TestComputePkScript(t *testing.T) {
|
||||||
witness: [][]byte{
|
witness: [][]byte{
|
||||||
// Signature is not needed to re-derive the
|
// Signature is not needed to re-derive the
|
||||||
// pkScript.
|
// pkScript.
|
||||||
[]byte{},
|
{},
|
||||||
// Compressed pubkey.
|
// Compressed pubkey.
|
||||||
[]byte{
|
{
|
||||||
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
||||||
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
||||||
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
||||||
|
@ -398,9 +398,9 @@ func TestComputePkScript(t *testing.T) {
|
||||||
witness: [][]byte{
|
witness: [][]byte{
|
||||||
// Signature is not needed to re-derive the
|
// Signature is not needed to re-derive the
|
||||||
// pkScript.
|
// pkScript.
|
||||||
[]byte{},
|
{},
|
||||||
// Malformed compressed pubkey.
|
// Malformed compressed pubkey.
|
||||||
[]byte{
|
{
|
||||||
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
||||||
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
||||||
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
||||||
|
|
|
@ -118,15 +118,15 @@ func TestElementWire(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ServiceFlag(SFNodeNetwork),
|
SFNodeNetwork,
|
||||||
[]byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
[]byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
InvType(InvTypeTx),
|
InvTypeTx,
|
||||||
[]byte{0x01, 0x00, 0x00, 0x00},
|
[]byte{0x01, 0x00, 0x00, 0x00},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
BitcoinNet(MainNet),
|
MainNet,
|
||||||
[]byte{0xf9, 0xbe, 0xb4, 0xd9},
|
[]byte{0xf9, 0xbe, 0xb4, 0xd9},
|
||||||
},
|
},
|
||||||
// Type not supported by the "fast" path and requires reflection.
|
// Type not supported by the "fast" path and requires reflection.
|
||||||
|
@ -211,9 +211,9 @@ func TestElementWireErrors(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
0, io.ErrShortWrite, io.EOF,
|
0, io.ErrShortWrite, io.EOF,
|
||||||
},
|
},
|
||||||
{ServiceFlag(SFNodeNetwork), 0, io.ErrShortWrite, io.EOF},
|
{SFNodeNetwork, 0, io.ErrShortWrite, io.EOF},
|
||||||
{InvType(InvTypeTx), 0, io.ErrShortWrite, io.EOF},
|
{InvTypeTx, 0, io.ErrShortWrite, io.EOF},
|
||||||
{BitcoinNet(MainNet), 0, io.ErrShortWrite, io.EOF},
|
{MainNet, 0, io.ErrShortWrite, io.EOF},
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Logf("Running %d tests", len(tests))
|
t.Logf("Running %d tests", len(tests))
|
||||||
|
|
Loading…
Add table
Reference in a new issue