Compare commits

..

No commits in common. "v1.0.202-rc1" and "lbry" have entirely different histories.

17 changed files with 201 additions and 250 deletions

View file

@ -12,17 +12,15 @@ jobs:
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.31.0"
- name: Build
run: go build ./...
- name: Test
run: |
sh ./goclean.sh
- name: Send lbcutil coverage
uses: shogo82148/actions-goveralls@v1
with:

View file

@ -1,57 +0,0 @@
name: golangci-lint
env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
GO_VERSION: '^1.17.0'
on:
push:
tags:
- v*
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: checkout source
uses: actions/checkout@v2
- name: compile code
run: go install -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true then the action will use pre-installed Go.
skip-go-installation: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true

View file

@ -1,152 +0,0 @@
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
gci:
local-prefixes: github.com/golangci/golangci-lint
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks:
- argument
- case
- condition
- return
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 140
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
linters:
disable-all: true
enable:
- asciicheck
- bodyclose
# - deadcode
- depguard
# - dogsled
# - dupl
# - errcheck
# - exhaustive
- exportloopref
# - funlen
# - gochecknoglobals
# - gochecknoinits
# - gocognit
# - goconst
# - gocritic
# - gocyclo
# - godot
# - godox
# - goerr113
- gofmt
- goimports
# - gomnd
- goprintffuncname
# - gosec
# - gosimple
# - govet
# - ineffassign
# - interfacer
# - lll
# - maligned
# - misspell
- nakedret
# - nestif
# - noctx
# - nolintlint
# - prealloc
- rowserrcheck
# - revive
# - scopelint
# - staticcheck
# - structcheck
# - stylecheck
# - testpackage
# - typecheck
- unconvert
# - unparam
# - unused
# - varcheck
# - whitespace
# - wsl
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- path: pkg/golinters/errcheck.go
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
- path: pkg/commands/run.go
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
# TODO must be removed after the release of the next version (v1.41.0)
- path: pkg/commands/run.go
linters:
- gomnd
# TODO must be removed after the release of the next version (v1.41.0)
- path: pkg/golinters/nolintlint/nolintlint.go
linters:
- gomnd
# TODO must be removed after the release of the next version (v1.41.0)
- path: pkg/printers/tab.go
linters:
- gomnd
run:
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio

View file

@ -82,7 +82,7 @@ func NewAmount(f float64) (Amount, error) {
case math.IsInf(f, 1):
fallthrough
case math.IsInf(f, -1):
return 0, errors.New("invalid coin amount")
return 0, errors.New("invalid bitcoin amount")
}
return round(f * SatoshiPerBitcoin), nil
@ -101,7 +101,7 @@ func (a Amount) ToBTC() float64 {
// Format formats a monetary amount counted in bitcoin base units as a
// string for a given unit. The conversion will succeed for any unit,
// however, known units will be formatted with an appended label describing
// however, known units will be formated with an appended label describing
// the units with SI notation, or "Satoshi" for the base unit.
func (a Amount) Format(u AmountUnit) string {
units := " " + u.String()

View file

@ -27,25 +27,25 @@ func TestAmountCreation(t *testing.T) {
},
{
name: "max producible",
amount: 21e9,
amount: 21e6,
valid: true,
expected: MaxSatoshi,
},
{
name: "min producible",
amount: -21e9,
amount: -21e6,
valid: true,
expected: -MaxSatoshi,
},
{
name: "exceeds max producible",
amount: 21e9 + 1e-8,
amount: 21e6 + 1e-8,
valid: true,
expected: MaxSatoshi + 1,
},
{
name: "exceeds min producible",
amount: -21e9 - 1e-8,
amount: -21e6 - 1e-8,
valid: true,
expected: -MaxSatoshi - 1,
},
@ -122,8 +122,8 @@ func TestAmountUnitConversions(t *testing.T) {
name: "MLBC",
amount: MaxSatoshi,
unit: AmountMegaBTC,
converted: 21000,
s: "21000 MLBC",
converted: 21,
s: "21 MLBC",
},
{
name: "kLBC",

View file

@ -11,10 +11,10 @@ import (
"testing"
"time"
"github.com/davecgh/go-spew/spew"
"github.com/lbryio/lbcd/chaincfg/chainhash"
"github.com/lbryio/lbcd/wire"
"github.com/lbryio/lbcutil"
"github.com/davecgh/go-spew/spew"
)
// TestBlock tests the API for Block.

View file

@ -492,6 +492,158 @@ func TestFilterInsertUpdateNone(t *testing.T) {
}
}
func TestFilterInsertP2PubKeyOnly(t *testing.T) {
blockStr := "0100000082bb869cf3a793432a66e826e05a6fc37469f8efb7421dc" +
"880670100000000007f16c5962e8bd963659c793ce370d95f093bc7e367" +
"117b3c30c1f8fdd0d9728776381b4d4c86041b554b85290701000000010" +
"00000000000000000000000000000000000000000000000000000000000" +
"0000ffffffff07044c86041b0136ffffffff0100f2052a0100000043410" +
"4eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c876f2" +
"c01ec0f0dd5b2e86e7168cefe0d81113c3807420ce13ad1357231a22522" +
"47d97a46a91ac000000000100000001bcad20a6a29827d1424f08989255" +
"120bf7f3e9e3cdaaa6bb31b0737fe048724300000000494830450220356" +
"e834b046cadc0f8ebb5a8a017b02de59c86305403dad52cd77b55af062e" +
"a10221009253cd6c119d4729b77c978e1e2aa19f5ea6e0e52b3f16e32fa" +
"608cd5bab753901ffffffff02008d380c010000001976a9142b4b8072ec" +
"bba129b6453c63e129e643207249ca88ac0065cd1d000000001976a9141" +
"b8dd13b994bcfc787b32aeadf58ccb3615cbd5488ac0000000001000000" +
"03fdacf9b3eb077412e7a968d2e4f11b9a9dee312d666187ed77ee7d26a" +
"f16cb0b000000008c493046022100ea1608e70911ca0de5af51ba57ad23" +
"b9a51db8d28f82c53563c56a05c20f5a87022100a8bdc8b4a8acc8634c6" +
"b420410150775eb7f2474f5615f7fccd65af30f310fbf01410465fdf49e" +
"29b06b9a1582287b6279014f834edc317695d125ef623c1cc3aaece245b" +
"d69fcad7508666e9c74a49dc9056d5fc14338ef38118dc4afae5fe2c585" +
"caffffffff309e1913634ecb50f3c4f83e96e70b2df071b497b8973a3e7" +
"5429df397b5af83000000004948304502202bdb79c596a9ffc24e96f438" +
"6199aba386e9bc7b6071516e2b51dda942b3a1ed022100c53a857e76b72" +
"4fc14d45311eac5019650d415c3abb5428f3aae16d8e69bec2301ffffff" +
"ff2089e33491695080c9edc18a428f7d834db5b6d372df13ce2b1b0e0cb" +
"cb1e6c10000000049483045022100d4ce67c5896ee251c810ac1ff9cecc" +
"d328b497c8f553ab6e08431e7d40bad6b5022033119c0c2b7d792d31f11" +
"87779c7bd95aefd93d90a715586d73801d9b47471c601ffffffff010071" +
"4460030000001976a914c7b55141d097ea5df7a0ed330cf794376e53ec8" +
"d88ac0000000001000000045bf0e214aa4069a3e792ecee1e1bf0c1d397" +
"cde8dd08138f4b72a00681743447000000008b48304502200c45de8c4f3" +
"e2c1821f2fc878cba97b1e6f8807d94930713aa1c86a67b9bf1e4022100" +
"8581abfef2e30f957815fc89978423746b2086375ca8ecf359c85c2a5b7" +
"c88ad01410462bb73f76ca0994fcb8b4271e6fb7561f5c0f9ca0cf64852" +
"61c4a0dc894f4ab844c6cdfb97cd0b60ffb5018ffd6238f4d87270efb1d" +
"3ae37079b794a92d7ec95ffffffffd669f7d7958d40fc59d2253d88e0f2" +
"48e29b599c80bbcec344a83dda5f9aa72c000000008a473044022078124" +
"c8beeaa825f9e0b30bff96e564dd859432f2d0cb3b72d3d5d93d38d7e93" +
"0220691d233b6c0f995be5acb03d70a7f7a65b6bc9bdd426260f38a1346" +
"669507a3601410462bb73f76ca0994fcb8b4271e6fb7561f5c0f9ca0cf6" +
"485261c4a0dc894f4ab844c6cdfb97cd0b60ffb5018ffd6238f4d87270e" +
"fb1d3ae37079b794a92d7ec95fffffffff878af0d93f5229a68166cf051" +
"fd372bb7a537232946e0a46f53636b4dafdaa4000000008c49304602210" +
"0c717d1714551663f69c3c5759bdbb3a0fcd3fab023abc0e522fe6440de" +
"35d8290221008d9cbe25bffc44af2b18e81c58eb37293fd7fe1c2e7b46f" +
"c37ee8c96c50ab1e201410462bb73f76ca0994fcb8b4271e6fb7561f5c0" +
"f9ca0cf6485261c4a0dc894f4ab844c6cdfb97cd0b60ffb5018ffd6238f" +
"4d87270efb1d3ae37079b794a92d7ec95ffffffff27f2b668859cd7f2f8" +
"94aa0fd2d9e60963bcd07c88973f425f999b8cbfd7a1e2000000008c493" +
"046022100e00847147cbf517bcc2f502f3ddc6d284358d102ed20d47a8a" +
"a788a62f0db780022100d17b2d6fa84dcaf1c95d88d7e7c30385aecf415" +
"588d749afd3ec81f6022cecd701410462bb73f76ca0994fcb8b4271e6fb" +
"7561f5c0f9ca0cf6485261c4a0dc894f4ab844c6cdfb97cd0b60ffb5018" +
"ffd6238f4d87270efb1d3ae37079b794a92d7ec95ffffffff0100c817a8" +
"040000001976a914b6efd80d99179f4f4ff6f4dd0a007d018c385d2188a" +
"c000000000100000001834537b2f1ce8ef9373a258e10545ce5a50b758d" +
"f616cd4356e0032554ebd3c4000000008b483045022100e68f422dd7c34" +
"fdce11eeb4509ddae38201773dd62f284e8aa9d96f85099d0b002202243" +
"bd399ff96b649a0fad05fa759d6a882f0af8c90cf7632c2840c29070aec" +
"20141045e58067e815c2f464c6a2a15f987758374203895710c2d452442" +
"e28496ff38ba8f5fd901dc20e29e88477167fe4fc299bf818fd0d9e1632" +
"d467b2a3d9503b1aaffffffff0280d7e636030000001976a914f34c3e10" +
"eb387efe872acb614c89e78bfca7815d88ac404b4c00000000001976a91" +
"4a84e272933aaf87e1715d7786c51dfaeb5b65a6f88ac00000000010000" +
"000143ac81c8e6f6ef307dfe17f3d906d999e23e0189fda838c5510d850" +
"927e03ae7000000008c4930460221009c87c344760a64cb8ae6685a3eec" +
"2c1ac1bed5b88c87de51acd0e124f266c16602210082d07c037359c3a25" +
"7b5c63ebd90f5a5edf97b2ac1c434b08ca998839f346dd40141040ba7e5" +
"21fa7946d12edbb1d1e95a15c34bd4398195e86433c92b431cd315f455f" +
"e30032ede69cad9d1e1ed6c3c4ec0dbfced53438c625462afb792dcb098" +
"544bffffffff0240420f00000000001976a9144676d1b820d63ec272f19" +
"00d59d43bc6463d96f888ac40420f00000000001976a914648d04341d00" +
"d7968b3405c034adc38d4d8fb9bd88ac00000000010000000248cc91750" +
"1ea5c55f4a8d2009c0567c40cfe037c2e71af017d0a452ff705e3f10000" +
"00008b483045022100bf5fdc86dc5f08a5d5c8e43a8c9d5b1ed8c65562e" +
"280007b52b133021acd9acc02205e325d613e555f772802bf413d36ba80" +
"7892ed1a690a77811d3033b3de226e0a01410429fa713b124484cb2bd7b" +
"5557b2c0b9df7b2b1fee61825eadc5ae6c37a9920d38bfccdc7dc3cb0c4" +
"7d7b173dbc9db8d37db0a33ae487982c59c6f8606e9d1791ffffffff41e" +
"d70551dd7e841883ab8f0b16bf04176b7d1480e4f0af9f3d4c3595768d0" +
"68000000008b4830450221008513ad65187b903aed1102d1d0c47688127" +
"658c51106753fed0151ce9c16b80902201432b9ebcb87bd04ceb2de6603" +
"5fbbaf4bf8b00d1cfe41f1a1f7338f9ad79d210141049d4cf80125bf50b" +
"e1709f718c07ad15d0fc612b7da1f5570dddc35f2a352f0f27c978b0682" +
"0edca9ef982c35fda2d255afba340068c5035552368bc7200c1488fffff" +
"fff0100093d00000000001976a9148edb68822f1ad580b043c7b3df2e40" +
"0f8699eb4888ac00000000"
blockBytes, err := hex.DecodeString(blockStr)
if err != nil {
t.Errorf("TestFilterInsertP2PubKeyOnly DecodeString failed: %v", err)
return
}
block, err := lbcutil.NewBlockFromBytes(blockBytes)
if err != nil {
t.Errorf("TestFilterInsertP2PubKeyOnly NewBlockFromBytes failed: %v", err)
return
}
f := bloom.NewFilter(10, 0, 0.000001, wire.BloomUpdateP2PubkeyOnly)
// Generation pubkey
inputStr := "04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c" +
"876f2c01ec0f0dd5b2e86e7168cefe0d81113c3807420ce13ad1357231a" +
"2252247d97a46a91"
inputBytes, err := hex.DecodeString(inputStr)
if err != nil {
t.Errorf("TestFilterInsertP2PubKeyOnly DecodeString failed: %v", err)
return
}
f.Add(inputBytes)
// Output address of 4th transaction
inputStr = "b6efd80d99179f4f4ff6f4dd0a007d018c385d21"
inputBytes, err = hex.DecodeString(inputStr)
if err != nil {
t.Errorf("TestFilterInsertP2PubKeyOnly DecodeString failed: %v", err)
return
}
f.Add(inputBytes)
// Ignore return value -- this is just used to update the filter.
_, _ = bloom.NewMerkleBlock(block, f)
// We should match the generation pubkey
inputStr = "147caa76786596590baa4e98f5d9f48b86c7765e489f7a6ff3360fe5c674360b"
hash, err := chainhash.NewHashFromStr(inputStr)
if err != nil {
t.Errorf("TestMerkleBlockP2PubKeyOnly NewHashFromStr failed: %v", err)
return
}
outpoint := wire.NewOutPoint(hash, 0)
if !f.MatchesOutPoint(outpoint) {
t.Errorf("TestMerkleBlockP2PubKeyOnly didn't match the generation "+
"outpoint %s", inputStr)
return
}
// We should not match the 4th transaction, which is not p2pk
inputStr = "02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041"
hash, err = chainhash.NewHashFromStr(inputStr)
if err != nil {
t.Errorf("TestMerkleBlockP2PubKeyOnly NewHashFromStr failed: %v", err)
return
}
outpoint = wire.NewOutPoint(hash, 0)
if f.MatchesOutPoint(outpoint) {
t.Errorf("TestMerkleBlockP2PubKeyOnly matched outpoint %s", inputStr)
return
}
}
func TestFilterReload(t *testing.T) {
f := bloom.NewFilter(10, 0, 0.000001, wire.BloomUpdateAll)

View file

@ -18,9 +18,9 @@ func ExampleAmount() {
a = lbcutil.Amount(1e5)
fmt.Println("100,000 Satoshis:", a)
// Output:
// Zero Satoshi: 0 LBC
// 100,000,000 Satoshis: 1 LBC
// 100,000 Satoshis: 0.001 LBC
// Zero Satoshi: 0 BTC
// 100,000,000 Satoshis: 1 BTC
// 100,000 Satoshis: 0.001 BTC
}
func ExampleNewAmount() {
@ -52,25 +52,25 @@ func ExampleNewAmount() {
}
fmt.Println(amountNaN) //Output 4
// Output: 1 LBC
// 0.01234567 LBC
// 0 LBC
// invalid coin amount
// Output: 1 BTC
// 0.01234567 BTC
// 0 BTC
// invalid bitcoin amount
}
func ExampleAmount_unitConversions() {
amount := lbcutil.Amount(44433322211100)
fmt.Println("Satoshi to kLBC:", amount.Format(lbcutil.AmountKiloBTC))
fmt.Println("Satoshi to LBC:", amount)
fmt.Println("Satoshi to MilliLBC:", amount.Format(lbcutil.AmountMilliBTC))
fmt.Println("Satoshi to MicroLBC:", amount.Format(lbcutil.AmountMicroBTC))
fmt.Println("Satoshi to kBTC:", amount.Format(lbcutil.AmountKiloBTC))
fmt.Println("Satoshi to BTC:", amount)
fmt.Println("Satoshi to MilliBTC:", amount.Format(lbcutil.AmountMilliBTC))
fmt.Println("Satoshi to MicroBTC:", amount.Format(lbcutil.AmountMicroBTC))
fmt.Println("Satoshi to Satoshi:", amount.Format(lbcutil.AmountSatoshi))
// Output:
// Satoshi to kLBC: 444.333222111 kLBC
// Satoshi to LBC: 444333.222111 LBC
// Satoshi to MilliLBC: 444333222.111 mLBC
// Satoshi to MicroLBC: 444333222111 μLBC
// Satoshi to kBTC: 444.333222111 kBTC
// Satoshi to BTC: 444333.222111 BTC
// Satoshi to MilliBTC: 444333222.111 mBTC
// Satoshi to MicroBTC: 444333222111 μBTC
// Satoshi to Satoshi: 44433322211100 Satoshi
}

View file

@ -12,8 +12,8 @@ import (
"sort"
"github.com/aead/siphash"
"github.com/kkdai/bstream"
"github.com/lbryio/lbcd/wire"
"github.com/kkdai/bstream"
)
// Inspired by https://github.com/rasky/gcs

2
go.mod
View file

@ -6,6 +6,6 @@ require (
github.com/aead/siphash v1.0.1
github.com/davecgh/go-spew v1.1.1
github.com/kkdai/bstream v1.0.0
github.com/lbryio/lbcd v0.22.101-beta
github.com/lbryio/lbcd v0.22.100-beta
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
)

6
go.sum
View file

@ -38,10 +38,12 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo=
github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA=
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/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ=
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
@ -239,10 +241,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/lbryio/lbcd v0.22.100-beta h1:6nv+G+MxxWqIbBLEPkSkc2Z3qhqrP8vVDHkc8+UWyv4=
github.com/lbryio/lbcd v0.22.100-beta/go.mod h1:u8SaFX4xdGMMR5xasBGfgApC8pvD4rnK2OujZnrq5gs=
github.com/lbryio/lbcd v0.22.101-beta h1:umLIxhyRwPdi91vtsDfgW85viK0AV8RPtIF9zQYtXw0=
github.com/lbryio/lbcd v0.22.101-beta/go.mod h1:K8A7dGvV4n89Oahoc5IfDb6IMRmxyZYKb7ZE+50+Jwc=
github.com/lbryio/lbcutil v1.0.201/go.mod h1:gDHc/b+Rdz3J7+VB8e5/Bl9roVf8Q5/8FQCyuK9dXD0=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=

View file

@ -32,4 +32,15 @@ for i in $(find . -name go.mod -type f -print); do
go tool cover -func profile.cov
)
# check linters
(cd $MODNAME && \
go mod download && \
golangci-lint run --deadline=10m --disable-all \
--enable=gofmt \
--enable=goimports \
--enable=golint \
--enable=govet \
--enable=gosimple \
--enable=unconvert
)
done

View file

@ -132,8 +132,8 @@ func Example_defaultWalletLayout() {
fmt.Println("Account 0 Internal Address 0:", acct0IntAddr)
// Output:
// Account 0 External Address 10: bVDtK8vxoU6nyRfiNjUsapCjqJGCY2wwRq
// Account 0 Internal Address 0: bVp8LpwEkvJFpJLAT9jKSFn3Z281nH4wcm
// Account 0 External Address 10: 1HVccubUT8iKTapMJ5AnNA4sLRN27xzQ4F
// Account 0 Internal Address 0: 1J5rebbkQaunJTUoNVREDbeB49DqMNFFXk
}
// This example demonstrates the audits use case in BIP0032.

View file

@ -579,7 +579,7 @@ func TestExtendedKeyAPI(t *testing.T) {
childNum: 0,
privKey: "e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35",
pubKey: "0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2",
address: "bHVb1pN9ACQB2QxFoXwVAbM4WSyUVVDfbW",
address: "15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma",
},
{
name: "test vector 1 chain m/0H/1/2H public",
@ -590,7 +590,7 @@ func TestExtendedKeyAPI(t *testing.T) {
childNum: 2147483650,
privKeyErr: ErrNotPrivExtKey,
pubKey: "0357bfe1e341d01c69fe5654309956cbea516822fba8a601743a012a7896ee8dc2",
address: "baUEXpVdvtuGCqyC68p94qC6tn1LSJq1LA",
address: "1NjxqbA9aZWnh17q1UW3rB4EPu79wDXj7x",
},
}
@ -980,7 +980,7 @@ func TestZero(t *testing.T) {
return false
}
wantAddr := "bVBPehMs2zB8d3vLtHJ7epkesDQJJ9D7Ek"
wantAddr := "1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E"
addr, err := key.Address(&chaincfg.MainNetParams)
if err != nil {
t.Errorf("Addres s #%d (%s): unexpected error: %v", i,

1
net.go
View file

@ -2,7 +2,6 @@
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
//go:build !appengine
// +build !appengine
package lbcutil

View file

@ -11,11 +11,11 @@ import (
"encoding/hex"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/lbryio/lbcd/chaincfg/chainhash"
"github.com/lbryio/lbcd/txscript"
"github.com/lbryio/lbcd/wire"
"github.com/lbryio/lbcutil"
"github.com/davecgh/go-spew/spew"
)
// Test vectors from:

View file

@ -10,9 +10,9 @@ import (
"reflect"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/lbryio/lbcd/chaincfg/chainhash"
"github.com/lbryio/lbcutil"
"github.com/davecgh/go-spew/spew"
)
// TestTx tests the API for Tx.