diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5b97dbba79..0000000000 --- a/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Temp files -*~ - -# Log files -*.log - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1284c11b88..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go -go: - - release - - tip -sudo: false -before_install: - - gotools=golang.org/x/tools - - if [ "$TRAVIS_GO_VERSION" = "release" ]; then gotools=code.google.com/p/go.tools; fi -install: - - go get -d -t -v ./... - - go get -v $gotools/cmd/cover - - go get -v $gotools/cmd/vet - - go get -v github.com/bradfitz/goimports - - go get -v github.com/golang/lint/golint -script: - - export PATH=$PATH:$HOME/gopath/bin - - ./goclean.sh diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 992dd50d5c..0000000000 --- a/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2013-2014 Conformal Systems LLC. - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/README.md b/blockchain/README.md similarity index 77% rename from README.md rename to blockchain/README.md index 93164da5a5..e151756a1e 100644 --- a/README.md +++ b/blockchain/README.md @@ -1,42 +1,40 @@ -btcchain -======== +blockchain +========== -[![Build Status](http://img.shields.io/travis/btcsuite/btcchain.svg)] -(https://travis-ci.org/btcsuite/btcchain) [![ISC License] +[![Build Status](http://img.shields.io/travis/btcsuite/btcd.svg)] +(https://travis-ci.org/btcsuite/btcd) [![ISC License] (http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) -Package btcchain implements bitcoin block handling and chain selection rules. +Package blockchain implements bitcoin block handling and chain selection rules. The test coverage is currently only around 60%, but will be increasing over time. See `test_coverage.txt` for the gocov coverage report. Alternatively, if you are running a POSIX OS, you can run the `cov_report.sh` script for a -real-time report. Package btcchain is licensed under the liberal ISC license. +real-time report. Package blockchain is licensed under the liberal ISC license. There is an associated blog post about the release of this package [here](https://blog.conformal.com/btcchain-the-bitcoin-chain-package-from-bctd/). -This package is one of the core packages from btcd, an alternative full-node -implementation of bitcoin which is under active development by Conformal. -Although it was primarily written for btcd, this package has intentionally been -designed so it can be used as a standalone package for any projects needing to -handle processing of blocks into the bitcoin block chain. +This package has intentionally been designed so it can be used as a standalone +package for any projects needing to handle processing of blocks into the bitcoin +block chain. ## Documentation [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)] -(http://godoc.org/github.com/btcsuite/btcchain) +(http://godoc.org/github.com/btcsuite/btcd/blockchain) Full `go doc` style documentation for the project can be viewed online without installing this package by using the GoDoc site here: -http://godoc.org/github.com/btcsuite/btcchain +http://godoc.org/github.com/btcsuite/btcd/blockchain You can also view the documentation locally once the package is installed with the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to -http://localhost:6060/pkg/github.com/btcsuite/btcchain +http://localhost:6060/pkg/github.com/btcsuite/btcd/blockchain ## Installation ```bash -$ go get github.com/btcsuite/btcchain +$ go get github.com/btcsuite/btcd/blockchain ``` ## Bitcoin Chain Processing Overview @@ -77,27 +75,23 @@ is by no means exhaustive: ## Examples * [ProcessBlock Example] - (http://godoc.org/github.com/btcsuite/btcchain#example-BlockChain-ProcessBlock) + (http://godoc.org/github.com/btcsuite/btcd/blockchain#example-BlockChain-ProcessBlock) Demonstrates how to create a new chain instance and use ProcessBlock to attempt to attempt add a block to the chain. This example intentionally attempts to insert a duplicate genesis block to illustrate how an invalid block is handled. * [CompactToBig Example] - (http://godoc.org/github.com/btcsuite/btcchain#example-CompactToBig) + (http://godoc.org/github.com/btcsuite/btcd/blockchain#example-CompactToBig) Demonstrates how to convert the compact "bits" in a block header which represent the target difficulty to a big integer and display it using the typical hex notation. * [BigToCompact Example] - (http://godoc.org/github.com/btcsuite/btcchain#example-BigToCompact) + (http://godoc.org/github.com/btcsuite/btcd/blockchain#example-BigToCompact) Demonstrates how to convert how to convert a target difficulty into the compact "bits" in a block header which represent that target difficulty. -## TODO - -- Increase test coverage - ## GPG Verification Key All official release tags are signed by Conformal so users can ensure the code @@ -121,5 +115,5 @@ signature perform the following: ## License -Package btcchain is licensed under the [copyfree](http://copyfree.org) ISC +Package blockchain is licensed under the [copyfree](http://copyfree.org) ISC License. diff --git a/accept.go b/blockchain/accept.go similarity index 99% rename from accept.go rename to blockchain/accept.go index c4104c55e2..64cb6d260a 100644 --- a/accept.go +++ b/blockchain/accept.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/blocklocator.go b/blockchain/blocklocator.go similarity index 99% rename from blocklocator.go rename to blockchain/blocklocator.go index 544cf72fa7..a88ccea176 100644 --- a/blocklocator.go +++ b/blockchain/blocklocator.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "github.com/btcsuite/btcwire" diff --git a/chain.go b/blockchain/chain.go similarity index 99% rename from chain.go rename to blockchain/chain.go index c356ee3ece..89f9fe586d 100644 --- a/chain.go +++ b/blockchain/chain.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "container/list" diff --git a/chain_test.go b/blockchain/chain_test.go similarity index 93% rename from chain_test.go rename to blockchain/chain_test.go index 213979fb61..e434982198 100644 --- a/chain_test.go +++ b/blockchain/chain_test.go @@ -2,12 +2,12 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "testing" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcnet" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcwire" @@ -46,12 +46,12 @@ func TestHaveBlock(t *testing.T) { // Since we're not dealing with the real block chain, disable // checkpoints and set the coinbase maturity to 1. chain.DisableCheckpoints(true) - btcchain.TstSetCoinbaseMaturity(1) + blockchain.TstSetCoinbaseMaturity(1) - timeSource := btcchain.NewMedianTime() + timeSource := blockchain.NewMedianTime() for i := 1; i < len(blocks); i++ { isOrphan, err := chain.ProcessBlock(blocks[i], timeSource, - btcchain.BFNone) + blockchain.BFNone) if err != nil { t.Errorf("ProcessBlock fail on block %v: %v\n", i, err) return @@ -65,7 +65,7 @@ func TestHaveBlock(t *testing.T) { // Insert an orphan block. isOrphan, err := chain.ProcessBlock(btcutil.NewBlock(&Block100000), - timeSource, btcchain.BFNone) + timeSource, blockchain.BFNone) if err != nil { t.Errorf("Unable to process block: %v", err) return diff --git a/checkpoints.go b/blockchain/checkpoints.go similarity index 99% rename from checkpoints.go rename to blockchain/checkpoints.go index 394b3fa638..03d7bfd731 100644 --- a/checkpoints.go +++ b/blockchain/checkpoints.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/common_test.go b/blockchain/common_test.go similarity index 94% rename from common_test.go rename to blockchain/common_test.go index 7b6c692fee..651aaff639 100644 --- a/common_test.go +++ b/blockchain/common_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "compress/bzip2" @@ -13,7 +13,7 @@ import ( "path/filepath" "strings" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/database" _ "github.com/btcsuite/btcd/database/ldb" _ "github.com/btcsuite/btcd/database/memdb" @@ -54,7 +54,7 @@ func isSupportedDbType(dbType string) bool { // chainSetup is used to create a new db and chain instance with the genesis // block already inserted. In addition to the new chain instnce, it returns // a teardown function the caller should invoke when done testing to clean up. -func chainSetup(dbName string) (*btcchain.BlockChain, func(), error) { +func chainSetup(dbName string) (*blockchain.BlockChain, func(), error) { if !isSupportedDbType(testDbType) { return nil, nil, fmt.Errorf("unsupported db type %v", testDbType) } @@ -116,12 +116,12 @@ func chainSetup(dbName string) (*btcchain.BlockChain, func(), error) { return nil, nil, err } - chain := btcchain.New(db, &btcnet.MainNetParams, nil) + chain := blockchain.New(db, &btcnet.MainNetParams, nil) return chain, teardown, nil } // loadTxStore returns a transaction store loaded from a file. -func loadTxStore(filename string) (btcchain.TxStore, error) { +func loadTxStore(filename string) (blockchain.TxStore, error) { // The txstore file format is: // // @@ -150,10 +150,10 @@ func loadTxStore(filename string) (btcchain.TxStore, error) { return nil, err } - txStore := make(btcchain.TxStore) + txStore := make(blockchain.TxStore) var uintBuf uint32 for height := uint32(0); height < numItems; height++ { - txD := btcchain.TxData{} + txD := blockchain.TxData{} // Serialized transaction length. err = binary.Read(r, binary.LittleEndian, &uintBuf) diff --git a/difficulty.go b/blockchain/difficulty.go similarity index 99% rename from difficulty.go rename to blockchain/difficulty.go index 11bb36bad5..0d94eea703 100644 --- a/difficulty.go +++ b/blockchain/difficulty.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/difficulty_test.go b/blockchain/difficulty_test.go similarity index 86% rename from difficulty_test.go rename to blockchain/difficulty_test.go index e3a844543d..083d1d3116 100644 --- a/difficulty_test.go +++ b/blockchain/difficulty_test.go @@ -2,13 +2,13 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "math/big" "testing" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" ) func TestBigToCompact(t *testing.T) { @@ -22,7 +22,7 @@ func TestBigToCompact(t *testing.T) { for x, test := range tests { n := big.NewInt(test.in) - r := btcchain.BigToCompact(n) + r := blockchain.BigToCompact(n) if r != test.out { t.Errorf("TestBigToCompact test #%d failed: got %d want %d\n", x, r, test.out) @@ -40,7 +40,7 @@ func TestCompactToBig(t *testing.T) { } for x, test := range tests { - n := btcchain.CompactToBig(test.in) + n := blockchain.CompactToBig(test.in) want := big.NewInt(test.out) if n.Cmp(want) != 0 { t.Errorf("TestCompactToBig test #%d failed: got %d want %d\n", @@ -61,7 +61,7 @@ func TestCalcWork(t *testing.T) { for x, test := range tests { bits := uint32(test.in) - r := btcchain.CalcWork(bits) + r := blockchain.CalcWork(bits) if r.Int64() != test.out { t.Errorf("TestCalcWork test #%d failed: got %v want %d\n", x, r.Int64(), test.out) diff --git a/doc.go b/blockchain/doc.go similarity index 94% rename from doc.go rename to blockchain/doc.go index 75a29f8f8b..69953ad5d9 100644 --- a/doc.go +++ b/blockchain/doc.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. /* -Package btcchain implements bitcoin block handling and chain selection rules. +Package blockchain implements bitcoin block handling and chain selection rules. The bitcoin block handling and chain selection rules are an integral, and quite likely the most important, part of bitcoin. Unfortunately, at the time of @@ -64,11 +64,11 @@ is by no means exhaustive: Errors Errors returned by this package are either the raw errors provided by underlying -calls or of type btcchain.RuleError. This allows the caller to differentiate +calls or of type blockchain.RuleError. This allows the caller to differentiate between unexpected errors, such as database errors, versus errors due to rule violations through type assertions. In addition, callers can programmatically determine the specific rule violation by examining the ErrorCode field of the -type asserted btcchain.RuleError. +type asserted blockchain.RuleError. Bitcoin Improvement Proposals @@ -78,4 +78,4 @@ This package includes spec changes outlined by the following BIPs: BIP0030 (https://en.bitcoin.it/wiki/BIP_0030) BIP0034 (https://en.bitcoin.it/wiki/BIP_0034) */ -package btcchain +package blockchain diff --git a/error.go b/blockchain/error.go similarity index 99% rename from error.go rename to blockchain/error.go index 31853c59d5..f96956aaf7 100644 --- a/error.go +++ b/blockchain/error.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/blockchain/error_test.go b/blockchain/error_test.go new file mode 100644 index 0000000000..aeb3d76ae9 --- /dev/null +++ b/blockchain/error_test.go @@ -0,0 +1,97 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package blockchain_test + +import ( + "testing" + + "github.com/btcsuite/btcd/blockchain" +) + +// TestErrorCodeStringer tests the stringized output for the ErrorCode type. +func TestErrorCodeStringer(t *testing.T) { + tests := []struct { + in blockchain.ErrorCode + want string + }{ + {blockchain.ErrDuplicateBlock, "ErrDuplicateBlock"}, + {blockchain.ErrBlockTooBig, "ErrBlockTooBig"}, + {blockchain.ErrBlockVersionTooOld, "ErrBlockVersionTooOld"}, + {blockchain.ErrInvalidTime, "ErrInvalidTime"}, + {blockchain.ErrTimeTooOld, "ErrTimeTooOld"}, + {blockchain.ErrTimeTooNew, "ErrTimeTooNew"}, + {blockchain.ErrDifficultyTooLow, "ErrDifficultyTooLow"}, + {blockchain.ErrUnexpectedDifficulty, "ErrUnexpectedDifficulty"}, + {blockchain.ErrHighHash, "ErrHighHash"}, + {blockchain.ErrBadMerkleRoot, "ErrBadMerkleRoot"}, + {blockchain.ErrBadCheckpoint, "ErrBadCheckpoint"}, + {blockchain.ErrForkTooOld, "ErrForkTooOld"}, + {blockchain.ErrCheckpointTimeTooOld, "ErrCheckpointTimeTooOld"}, + {blockchain.ErrNoTransactions, "ErrNoTransactions"}, + {blockchain.ErrTooManyTransactions, "ErrTooManyTransactions"}, + {blockchain.ErrNoTxInputs, "ErrNoTxInputs"}, + {blockchain.ErrNoTxOutputs, "ErrNoTxOutputs"}, + {blockchain.ErrTxTooBig, "ErrTxTooBig"}, + {blockchain.ErrBadTxOutValue, "ErrBadTxOutValue"}, + {blockchain.ErrDuplicateTxInputs, "ErrDuplicateTxInputs"}, + {blockchain.ErrBadTxInput, "ErrBadTxInput"}, + {blockchain.ErrBadCheckpoint, "ErrBadCheckpoint"}, + {blockchain.ErrMissingTx, "ErrMissingTx"}, + {blockchain.ErrUnfinalizedTx, "ErrUnfinalizedTx"}, + {blockchain.ErrDuplicateTx, "ErrDuplicateTx"}, + {blockchain.ErrOverwriteTx, "ErrOverwriteTx"}, + {blockchain.ErrImmatureSpend, "ErrImmatureSpend"}, + {blockchain.ErrDoubleSpend, "ErrDoubleSpend"}, + {blockchain.ErrSpendTooHigh, "ErrSpendTooHigh"}, + {blockchain.ErrBadFees, "ErrBadFees"}, + {blockchain.ErrTooManySigOps, "ErrTooManySigOps"}, + {blockchain.ErrFirstTxNotCoinbase, "ErrFirstTxNotCoinbase"}, + {blockchain.ErrMultipleCoinbases, "ErrMultipleCoinbases"}, + {blockchain.ErrBadCoinbaseScriptLen, "ErrBadCoinbaseScriptLen"}, + {blockchain.ErrBadCoinbaseValue, "ErrBadCoinbaseValue"}, + {blockchain.ErrMissingCoinbaseHeight, "ErrMissingCoinbaseHeight"}, + {blockchain.ErrBadCoinbaseHeight, "ErrBadCoinbaseHeight"}, + {blockchain.ErrScriptMalformed, "ErrScriptMalformed"}, + {blockchain.ErrScriptValidation, "ErrScriptValidation"}, + {0xffff, "Unknown ErrorCode (65535)"}, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.in.String() + if result != test.want { + t.Errorf("String #%d\n got: %s want: %s", i, result, + test.want) + continue + } + } +} + +// TestRuleError tests the error output for the RuleError type. +func TestRuleError(t *testing.T) { + tests := []struct { + in blockchain.RuleError + want string + }{ + { + blockchain.RuleError{Description: "duplicate block"}, + "duplicate block", + }, + { + blockchain.RuleError{Description: "human-readable error"}, + "human-readable error", + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.in.Error() + if result != test.want { + t.Errorf("Error #%d\n got: %s want: %s", i, result, + test.want) + continue + } + } +} diff --git a/example_test.go b/blockchain/example_test.go similarity index 92% rename from example_test.go rename to blockchain/example_test.go index 4bbb124877..229b55f1c8 100644 --- a/example_test.go +++ b/blockchain/example_test.go @@ -2,13 +2,13 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "fmt" "math/big" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/database" _ "github.com/btcsuite/btcd/database/memdb" "github.com/btcsuite/btcnet" @@ -44,18 +44,18 @@ func ExampleBlockChain_ProcessBlock() { // Create a new BlockChain instance using the underlying database for // the main bitcoin network and ignore notifications. - chain := btcchain.New(db, &btcnet.MainNetParams, nil) + chain := blockchain.New(db, &btcnet.MainNetParams, nil) // Create a new median time source that is required by the upcoming // call to ProcessBlock. Ordinarily this would also add time values // obtained from other peers on the network so the local time is // adjusted to be in agreement with other peers. - timeSource := btcchain.NewMedianTime() + timeSource := blockchain.NewMedianTime() // Process a block. For this example, we are going to intentionally // cause an error by trying to process the genesis block which already // exists. - isOrphan, err := chain.ProcessBlock(genesisBlock, timeSource, btcchain.BFNone) + isOrphan, err := chain.ProcessBlock(genesisBlock, timeSource, blockchain.BFNone) if err != nil { fmt.Printf("Failed to process block: %v\n", err) return @@ -72,7 +72,7 @@ func ExampleBlockChain_ProcessBlock() { func ExampleCompactToBig() { // Convert the bits from block 300000 in the main block chain. bits := uint32(419465580) - targetDifficulty := btcchain.CompactToBig(bits) + targetDifficulty := blockchain.CompactToBig(bits) // Display it in hex. fmt.Printf("%064x\n", targetDifficulty.Bytes()) @@ -92,7 +92,7 @@ func ExampleBigToCompact() { fmt.Println("invalid target difficulty") return } - bits := btcchain.BigToCompact(targetDifficulty) + bits := blockchain.BigToCompact(targetDifficulty) fmt.Println(bits) diff --git a/internal_test.go b/blockchain/internal_test.go similarity index 76% rename from internal_test.go rename to blockchain/internal_test.go index 6914fff5b1..563c7de1e0 100644 --- a/internal_test.go +++ b/blockchain/internal_test.go @@ -3,13 +3,14 @@ // license that can be found in the LICENSE file. /* -This test file is part of the btcchain package rather than than the -btcchain_test package so it can bridge access to the internals to properly test -cases which are either not possible or can't reliably be tested via the public -interface. The functions are only exported while the tests are being run. +This test file is part of the blockchain package rather than than the +blockchain_test package so it can bridge access to the internals to properly +test cases which are either not possible or can't reliably be tested via the +public interface. The functions are only exported while the tests are being +run. */ -package btcchain +package blockchain import ( "sort" diff --git a/log.go b/blockchain/log.go similarity index 98% rename from log.go rename to blockchain/log.go index 7a79f9e09d..bd3b621568 100644 --- a/log.go +++ b/blockchain/log.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "errors" diff --git a/mediantime.go b/blockchain/mediantime.go similarity index 99% rename from mediantime.go rename to blockchain/mediantime.go index 8aa1c28c70..f44d8257a0 100644 --- a/mediantime.go +++ b/blockchain/mediantime.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "math" diff --git a/mediantime_test.go b/blockchain/mediantime_test.go similarity index 95% rename from mediantime_test.go rename to blockchain/mediantime_test.go index 69f543a0a6..7040017d90 100644 --- a/mediantime_test.go +++ b/blockchain/mediantime_test.go @@ -2,14 +2,14 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "strconv" "testing" "time" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" ) // TestMedianTime tests the medianTime implementation. @@ -55,11 +55,11 @@ func TestMedianTime(t *testing.T) { } // Modify the max number of allowed median time entries for these tests. - btcchain.TstSetMaxMedianTimeEntries(10) - defer btcchain.TstSetMaxMedianTimeEntries(200) + blockchain.TstSetMaxMedianTimeEntries(10) + defer blockchain.TstSetMaxMedianTimeEntries(200) for i, test := range tests { - filter := btcchain.NewMedianTime() + filter := blockchain.NewMedianTime() for j, offset := range test.in { id := strconv.Itoa(j) now := time.Unix(time.Now().Unix(), 0) diff --git a/merkle.go b/blockchain/merkle.go similarity index 99% rename from merkle.go rename to blockchain/merkle.go index 83e5acdb99..900557ca37 100644 --- a/merkle.go +++ b/blockchain/merkle.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "math" diff --git a/merkle_test.go b/blockchain/merkle_test.go similarity index 82% rename from merkle_test.go rename to blockchain/merkle_test.go index f766270f06..4f64dbb36e 100644 --- a/merkle_test.go +++ b/blockchain/merkle_test.go @@ -2,19 +2,19 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "testing" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcutil" ) // TestMerkle tests the BuildMerkleTreeStore API. func TestMerkle(t *testing.T) { block := btcutil.NewBlock(&Block100000) - merkles := btcchain.BuildMerkleTreeStore(block.Transactions()) + merkles := blockchain.BuildMerkleTreeStore(block.Transactions()) calculatedMerkleRoot := merkles[len(merkles)-1] wantMerkle := &Block100000.Header.MerkleRoot if !wantMerkle.IsEqual(calculatedMerkleRoot) { diff --git a/notifications.go b/blockchain/notifications.go similarity index 99% rename from notifications.go rename to blockchain/notifications.go index 73b63b3673..4521d4edde 100644 --- a/notifications.go +++ b/blockchain/notifications.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/process.go b/blockchain/process.go similarity index 99% rename from process.go rename to blockchain/process.go index fce1ee3350..2c6dd53857 100644 --- a/process.go +++ b/blockchain/process.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/reorganization_test.go b/blockchain/reorganization_test.go similarity index 93% rename from reorganization_test.go rename to blockchain/reorganization_test.go index e52be822b5..32e0013515 100644 --- a/reorganization_test.go +++ b/blockchain/reorganization_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "compress/bzip2" @@ -13,7 +13,7 @@ import ( "strings" "testing" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcwire" ) @@ -56,12 +56,12 @@ func TestReorganization(t *testing.T) { // Since we're not dealing with the real block chain, disable // checkpoints and set the coinbase maturity to 1. chain.DisableCheckpoints(true) - btcchain.TstSetCoinbaseMaturity(1) + blockchain.TstSetCoinbaseMaturity(1) - timeSource := btcchain.NewMedianTime() + timeSource := blockchain.NewMedianTime() expectedOrphans := map[int]struct{}{5: struct{}{}, 6: struct{}{}} for i := 1; i < len(blocks); i++ { - isOrphan, err := chain.ProcessBlock(blocks[i], timeSource, btcchain.BFNone) + isOrphan, err := chain.ProcessBlock(blocks[i], timeSource, blockchain.BFNone) if err != nil { t.Errorf("ProcessBlock fail on block %v: %v\n", i, err) return diff --git a/scriptval.go b/blockchain/scriptval.go similarity index 99% rename from scriptval.go rename to blockchain/scriptval.go index 22d0ea20f5..1cdf4b8c02 100644 --- a/scriptval.go +++ b/blockchain/scriptval.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/scriptval_test.go b/blockchain/scriptval_test.go similarity index 87% rename from scriptval_test.go rename to blockchain/scriptval_test.go index 5dacd826df..5b893eb122 100644 --- a/scriptval_test.go +++ b/blockchain/scriptval_test.go @@ -2,14 +2,14 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "fmt" "runtime" "testing" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" ) // TestCheckBlockScripts ensures that validating the all of the scripts in a @@ -35,7 +35,7 @@ func TestCheckBlockScripts(t *testing.T) { return } - if err := btcchain.TstCheckBlockScripts(blocks[0], txStore); err != nil { + if err := blockchain.TstCheckBlockScripts(blocks[0], txStore); err != nil { t.Errorf("Transaction script validation failed: %v\n", err) return diff --git a/testdata/277647.dat.bz2 b/blockchain/testdata/277647.dat.bz2 similarity index 100% rename from testdata/277647.dat.bz2 rename to blockchain/testdata/277647.dat.bz2 diff --git a/testdata/277647.txstore.bz2 b/blockchain/testdata/277647.txstore.bz2 similarity index 100% rename from testdata/277647.txstore.bz2 rename to blockchain/testdata/277647.txstore.bz2 diff --git a/testdata/blk_0_to_4.dat.bz2 b/blockchain/testdata/blk_0_to_4.dat.bz2 similarity index 100% rename from testdata/blk_0_to_4.dat.bz2 rename to blockchain/testdata/blk_0_to_4.dat.bz2 diff --git a/testdata/blk_3A.dat.bz2 b/blockchain/testdata/blk_3A.dat.bz2 similarity index 100% rename from testdata/blk_3A.dat.bz2 rename to blockchain/testdata/blk_3A.dat.bz2 diff --git a/testdata/blk_4A.dat.bz2 b/blockchain/testdata/blk_4A.dat.bz2 similarity index 100% rename from testdata/blk_4A.dat.bz2 rename to blockchain/testdata/blk_4A.dat.bz2 diff --git a/testdata/blk_5A.dat.bz2 b/blockchain/testdata/blk_5A.dat.bz2 similarity index 100% rename from testdata/blk_5A.dat.bz2 rename to blockchain/testdata/blk_5A.dat.bz2 diff --git a/testdata/reorgtest.hex b/blockchain/testdata/reorgtest.hex similarity index 100% rename from testdata/reorgtest.hex rename to blockchain/testdata/reorgtest.hex diff --git a/timesorter.go b/blockchain/timesorter.go similarity index 97% rename from timesorter.go rename to blockchain/timesorter.go index 744726d73d..361ccbd6a3 100644 --- a/timesorter.go +++ b/blockchain/timesorter.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "time" diff --git a/timesorter_test.go b/blockchain/timesorter_test.go similarity index 93% rename from timesorter_test.go rename to blockchain/timesorter_test.go index 297fdb7c3e..85f5757e33 100644 --- a/timesorter_test.go +++ b/blockchain/timesorter_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "reflect" @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" ) // TestTimeSorter tests the timeSorter implementation. @@ -42,7 +42,7 @@ func TestTimeSorter(t *testing.T) { for i, test := range tests { result := make([]time.Time, len(test.in)) copy(result, test.in) - sort.Sort(btcchain.TstTimeSorter(result)) + sort.Sort(blockchain.TstTimeSorter(result)) if !reflect.DeepEqual(result, test.want) { t.Errorf("timeSorter #%d got %v want %v", i, result, test.want) diff --git a/txlookup.go b/blockchain/txlookup.go similarity index 99% rename from txlookup.go rename to blockchain/txlookup.go index 6925ef752e..b2ba39e020 100644 --- a/txlookup.go +++ b/blockchain/txlookup.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "fmt" diff --git a/validate.go b/blockchain/validate.go similarity index 99% rename from validate.go rename to blockchain/validate.go index 488d4b8b73..b53b8314e8 100644 --- a/validate.go +++ b/blockchain/validate.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain +package blockchain import ( "encoding/binary" diff --git a/validate_test.go b/blockchain/validate_test.go similarity index 95% rename from validate_test.go rename to blockchain/validate_test.go index c8fde7af6c..b54112bb88 100644 --- a/validate_test.go +++ b/blockchain/validate_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcchain_test +package blockchain_test import ( "math" @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/btcsuite/btcchain" + "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcnet" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcwire" @@ -46,8 +46,8 @@ func TestCheckConnectBlock(t *testing.T) { func TestCheckBlockSanity(t *testing.T) { powLimit := btcnet.MainNetParams.PowLimit block := btcutil.NewBlock(&Block100000) - timeSource := btcchain.NewMedianTime() - err := btcchain.CheckBlockSanity(block, powLimit, timeSource) + timeSource := blockchain.NewMedianTime() + err := blockchain.CheckBlockSanity(block, powLimit, timeSource) if err != nil { t.Errorf("CheckBlockSanity: %v", err) } @@ -56,7 +56,7 @@ func TestCheckBlockSanity(t *testing.T) { // second fails. timestamp := block.MsgBlock().Header.Timestamp block.MsgBlock().Header.Timestamp = timestamp.Add(time.Nanosecond) - err = btcchain.CheckBlockSanity(block, powLimit, timeSource) + err = blockchain.CheckBlockSanity(block, powLimit, timeSource) if err == nil { t.Errorf("CheckBlockSanity: error is nil when it shouldn't be") } @@ -73,11 +73,11 @@ func TestCheckSerializedHeight(t *testing.T) { coinbaseTx.AddTxIn(btcwire.NewTxIn(coinbaseOutpoint, nil)) // Expected rule errors. - missingHeightError := btcchain.RuleError{ - ErrorCode: btcchain.ErrMissingCoinbaseHeight, + missingHeightError := blockchain.RuleError{ + ErrorCode: blockchain.ErrMissingCoinbaseHeight, } - badHeightError := btcchain.RuleError{ - ErrorCode: btcchain.ErrBadCoinbaseHeight, + badHeightError := blockchain.RuleError{ + ErrorCode: blockchain.ErrBadCoinbaseHeight, } tests := []struct { @@ -109,15 +109,15 @@ func TestCheckSerializedHeight(t *testing.T) { msgTx.TxIn[0].SignatureScript = test.sigScript tx := btcutil.NewTx(msgTx) - err := btcchain.TstCheckSerializedHeight(tx, test.wantHeight) + err := blockchain.TstCheckSerializedHeight(tx, test.wantHeight) if reflect.TypeOf(err) != reflect.TypeOf(test.err) { t.Errorf("checkSerializedHeight #%d wrong error type "+ "got: %v <%T>, want: %T", i, err, err, test.err) continue } - if rerr, ok := err.(btcchain.RuleError); ok { - trerr := test.err.(btcchain.RuleError) + if rerr, ok := err.(blockchain.RuleError); ok { + trerr := test.err.(blockchain.RuleError) if rerr.ErrorCode != trerr.ErrorCode { t.Errorf("checkSerializedHeight #%d wrong "+ "error code got: %v, want: %v", i, diff --git a/cov_report.sh b/cov_report.sh deleted file mode 100644 index 307f05b76c..0000000000 --- a/cov_report.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This script uses gocov to generate a test coverage report. -# The gocov tool my be obtained with the following command: -# go get github.com/axw/gocov/gocov -# -# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. - -# Check for gocov. -type gocov >/dev/null 2>&1 -if [ $? -ne 0 ]; then - echo >&2 "This script requires the gocov tool." - echo >&2 "You may obtain it with the following command:" - echo >&2 "go get github.com/axw/gocov/gocov" - exit 1 -fi -gocov test | gocov report diff --git a/error_test.go b/error_test.go deleted file mode 100644 index 1962629bbe..0000000000 --- a/error_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 Conformal Systems LLC. -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -package btcchain_test - -import ( - "testing" - - "github.com/btcsuite/btcchain" -) - -// TestErrorCodeStringer tests the stringized output for the ErrorCode type. -func TestErrorCodeStringer(t *testing.T) { - tests := []struct { - in btcchain.ErrorCode - want string - }{ - {btcchain.ErrDuplicateBlock, "ErrDuplicateBlock"}, - {btcchain.ErrBlockTooBig, "ErrBlockTooBig"}, - {btcchain.ErrBlockVersionTooOld, "ErrBlockVersionTooOld"}, - {btcchain.ErrInvalidTime, "ErrInvalidTime"}, - {btcchain.ErrTimeTooOld, "ErrTimeTooOld"}, - {btcchain.ErrTimeTooNew, "ErrTimeTooNew"}, - {btcchain.ErrDifficultyTooLow, "ErrDifficultyTooLow"}, - {btcchain.ErrUnexpectedDifficulty, "ErrUnexpectedDifficulty"}, - {btcchain.ErrHighHash, "ErrHighHash"}, - {btcchain.ErrBadMerkleRoot, "ErrBadMerkleRoot"}, - {btcchain.ErrBadCheckpoint, "ErrBadCheckpoint"}, - {btcchain.ErrForkTooOld, "ErrForkTooOld"}, - {btcchain.ErrCheckpointTimeTooOld, "ErrCheckpointTimeTooOld"}, - {btcchain.ErrNoTransactions, "ErrNoTransactions"}, - {btcchain.ErrTooManyTransactions, "ErrTooManyTransactions"}, - {btcchain.ErrNoTxInputs, "ErrNoTxInputs"}, - {btcchain.ErrNoTxOutputs, "ErrNoTxOutputs"}, - {btcchain.ErrTxTooBig, "ErrTxTooBig"}, - {btcchain.ErrBadTxOutValue, "ErrBadTxOutValue"}, - {btcchain.ErrDuplicateTxInputs, "ErrDuplicateTxInputs"}, - {btcchain.ErrBadTxInput, "ErrBadTxInput"}, - {btcchain.ErrBadCheckpoint, "ErrBadCheckpoint"}, - {btcchain.ErrMissingTx, "ErrMissingTx"}, - {btcchain.ErrUnfinalizedTx, "ErrUnfinalizedTx"}, - {btcchain.ErrDuplicateTx, "ErrDuplicateTx"}, - {btcchain.ErrOverwriteTx, "ErrOverwriteTx"}, - {btcchain.ErrImmatureSpend, "ErrImmatureSpend"}, - {btcchain.ErrDoubleSpend, "ErrDoubleSpend"}, - {btcchain.ErrSpendTooHigh, "ErrSpendTooHigh"}, - {btcchain.ErrBadFees, "ErrBadFees"}, - {btcchain.ErrTooManySigOps, "ErrTooManySigOps"}, - {btcchain.ErrFirstTxNotCoinbase, "ErrFirstTxNotCoinbase"}, - {btcchain.ErrMultipleCoinbases, "ErrMultipleCoinbases"}, - {btcchain.ErrBadCoinbaseScriptLen, "ErrBadCoinbaseScriptLen"}, - {btcchain.ErrBadCoinbaseValue, "ErrBadCoinbaseValue"}, - {btcchain.ErrMissingCoinbaseHeight, "ErrMissingCoinbaseHeight"}, - {btcchain.ErrBadCoinbaseHeight, "ErrBadCoinbaseHeight"}, - {btcchain.ErrScriptMalformed, "ErrScriptMalformed"}, - {btcchain.ErrScriptValidation, "ErrScriptValidation"}, - {0xffff, "Unknown ErrorCode (65535)"}, - } - - t.Logf("Running %d tests", len(tests)) - for i, test := range tests { - result := test.in.String() - if result != test.want { - t.Errorf("String #%d\n got: %s want: %s", i, result, - test.want) - continue - } - } -} - -// TestRuleError tests the error output for the RuleError type. -func TestRuleError(t *testing.T) { - tests := []struct { - in btcchain.RuleError - want string - }{ - { - btcchain.RuleError{Description: "duplicate block"}, - "duplicate block", - }, - { - btcchain.RuleError{Description: "human-readable error"}, - "human-readable error", - }, - } - - t.Logf("Running %d tests", len(tests)) - for i, test := range tests { - result := test.in.Error() - if result != test.want { - t.Errorf("Error #%d\n got: %s want: %s", i, result, - test.want) - continue - } - } -} diff --git a/goclean.sh b/goclean.sh deleted file mode 100755 index 91833320ad..0000000000 --- a/goclean.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# The script does automatic checking on a Go package and its sub-packages, including: -# 1. gofmt (http://golang.org/cmd/gofmt/) -# 2. goimports (https://github.com/bradfitz/goimports) -# 3. golint (https://github.com/golang/lint) -# 4. go vet (http://golang.org/cmd/vet) -# 5. test coverage (http://blog.golang.org/cover) - -set -e - -# Automatic checks -test -z "$(gofmt -l -w . | tee /dev/stderr)" -test -z "$(goimports -l -w . | tee /dev/stderr)" -test -z "$(golint . | tee /dev/stderr)" -go vet ./... -env GORACE="halt_on_error=1" go test -v -race ./... - -# Run test coverage on each subdirectories and merge the coverage profile. - -echo "mode: count" > profile.cov - -# Standard go tooling behavior is to ignore dirs with leading underscores. -for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); -do -if ls $dir/*.go &> /dev/null; then - go test -covermode=count -coverprofile=$dir/profile.tmp $dir - if [ -f $dir/profile.tmp ]; then - cat $dir/profile.tmp | tail -n +2 >> profile.cov - rm $dir/profile.tmp - fi -fi -done - -go tool cover -func profile.cov - -# To submit the test coverage result to coveralls.io, -# use goveralls (https://github.com/mattn/goveralls) -# goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/test_coverage.txt b/test_coverage.txt deleted file mode 100644 index b07d42c548..0000000000 --- a/test_coverage.txt +++ /dev/null @@ -1,97 +0,0 @@ - -github.com/conformal/btcchain/validate.go checkSerializedHeight 100.00% (17/17) -github.com/conformal/btcchain/chain.go BlockChain.removeOrphanBlock 100.00% (16/16) -github.com/conformal/btcchain/txlookup.go disconnectTransactions 100.00% (13/13) -github.com/conformal/btcchain/difficulty.go CompactToBig 100.00% (12/12) -github.com/conformal/btcchain/validate.go CountSigOps 100.00% (9/9) -github.com/conformal/btcchain/chain.go New 100.00% (8/8) -github.com/conformal/btcchain/validate.go BlockChain.CheckConnectBlock 100.00% (7/7) -github.com/conformal/btcchain/difficulty.go ShaHashToBig 100.00% (5/5) -github.com/conformal/btcchain/merkle.go HashMerkleBranches 100.00% (5/5) -github.com/conformal/btcchain/chain.go BlockChain.IsKnownOrphan 100.00% (5/5) -github.com/conformal/btcchain/difficulty.go CalcWork 100.00% (5/5) -github.com/conformal/btcchain/merkle.go nextPowerOfTwo 100.00% (4/4) -github.com/conformal/btcchain/process.go BlockChain.blockExists 100.00% (3/3) -github.com/conformal/btcchain/chain.go newBlockNode 100.00% (3/3) -github.com/conformal/btcchain/error.go ErrorCode.String 100.00% (3/3) -github.com/conformal/btcchain/checkpoints.go newShaHashFromStr 100.00% (2/2) -github.com/conformal/btcchain/log.go init 100.00% (1/1) -github.com/conformal/btcchain/scriptval.go newTxValidator 100.00% (1/1) -github.com/conformal/btcchain/scriptval.go txValidator.sendResult 100.00% (1/1) -github.com/conformal/btcchain/timesorter.go timeSorter.Less 100.00% (1/1) -github.com/conformal/btcchain/log.go DisableLog 100.00% (1/1) -github.com/conformal/btcchain/chain.go BlockChain.HaveBlock 100.00% (1/1) -github.com/conformal/btcchain/error.go ruleError 100.00% (1/1) -github.com/conformal/btcchain/checkpoints.go BlockChain.DisableCheckpoints 100.00% (1/1) -github.com/conformal/btcchain/validate.go CheckBlockSanity 100.00% (1/1) -github.com/conformal/btcchain/error.go RuleError.Error 100.00% (1/1) -github.com/conformal/btcchain/timesorter.go timeSorter.Len 100.00% (1/1) -github.com/conformal/btcchain/timesorter.go timeSorter.Swap 100.00% (1/1) -github.com/conformal/btcchain/txlookup.go fetchTxStoreMain 95.65% (22/23) -github.com/conformal/btcchain/merkle.go BuildMerkleTreeStore 93.33% (14/15) -github.com/conformal/btcchain/chain.go BlockChain.getReorganizeNodes 92.86% (13/14) -github.com/conformal/btcchain/scriptval.go txValidator.Validate 88.46% (23/26) -github.com/conformal/btcchain/txlookup.go BlockChain.fetchTxStore 86.96% (20/23) -github.com/conformal/btcchain/chain.go BlockChain.connectBestChain 85.71% (30/35) -github.com/conformal/btcchain/validate.go BlockChain.checkBIP0030 85.71% (12/14) -github.com/conformal/btcchain/validate.go IsCoinBase 85.71% (6/7) -github.com/conformal/btcchain/chain.go BlockChain.reorganizeChain 85.29% (29/34) -github.com/conformal/btcchain/process.go BlockChain.processOrphans 84.21% (16/19) -github.com/conformal/btcchain/scriptval.go checkBlockScripts 83.33% (15/18) -github.com/conformal/btcchain/chain.go BlockChain.connectBlock 83.33% (10/12) -github.com/conformal/btcchain/chain.go BlockChain.calcPastMedianTime 82.35% (14/17) -github.com/conformal/btcchain/chain.go BlockChain.isMajorityVersion 80.00% (8/10) -github.com/conformal/btcchain/chain.go BlockChain.addOrphanBlock 77.78% (14/18) -github.com/conformal/btcchain/chain.go BlockChain.getPrevNodeFromBlock 77.78% (7/9) -github.com/conformal/btcchain/chain.go BlockChain.GenerateInitialIndex 77.27% (17/22) -github.com/conformal/btcchain/chain.go BlockChain.disconnectBlock 76.92% (10/13) -github.com/conformal/btcchain/txlookup.go BlockChain.fetchInputTransactions 75.00% (18/24) -github.com/conformal/btcchain/difficulty.go BigToCompact 75.00% (12/16) -github.com/conformal/btcchain/validate.go isTransactionSpent 75.00% (3/4) -github.com/conformal/btcchain/validate.go BlockChain.checkConnectBlock 71.15% (37/52) -github.com/conformal/btcchain/validate.go checkBlockSanity 67.44% (29/43) -github.com/conformal/btcchain/validate.go CalcBlockSubsidy 66.67% (2/3) -github.com/conformal/btcchain/validate.go isNullOutpoint 66.67% (2/3) -github.com/conformal/btcchain/validate.go CheckTransactionInputs 63.64% (28/44) -github.com/conformal/btcchain/txlookup.go connectTransactions 61.54% (8/13) -github.com/conformal/btcchain/validate.go CheckTransactionSanity 61.11% (22/36) -github.com/conformal/btcchain/validate.go isBIP0030Node 60.00% (3/5) -github.com/conformal/btcchain/validate.go checkProofOfWork 56.25% (9/16) -github.com/conformal/btcchain/accept.go BlockChain.maybeAcceptBlock 55.07% (38/69) -github.com/conformal/btcchain/process.go BlockChain.ProcessBlock 52.27% (23/44) -github.com/conformal/btcchain/chain.go BlockChain.loadBlockNode 52.00% (13/25) -github.com/conformal/btcchain/scriptval.go txValidator.validateHandler 50.00% (16/32) -github.com/conformal/btcchain/chain.go BlockChain.getPrevNodeFromNode 50.00% (4/8) -github.com/conformal/btcchain/checkpoints.go BlockChain.LatestCheckpoint 50.00% (2/4) -github.com/conformal/btcchain/notifications.go BlockChain.sendNotification 50.00% (2/4) -github.com/conformal/btcchain/chain.go BlockChain.pruneBlockNodes 41.18% (7/17) -github.com/conformal/btcchain/validate.go IsFinalizedTransaction 28.57% (4/14) -github.com/conformal/btcchain/checkpoints.go BlockChain.verifyCheckpoint 22.22% (2/9) -github.com/conformal/btcchain/difficulty.go BlockChain.calcNextRequiredDifficulty 11.11% (4/36) -github.com/conformal/btcchain/checkpoints.go BlockChain.findPreviousCheckpoint 4.88% (2/41) -github.com/conformal/btcchain/blocklocator.go BlockChain.BlockLocatorFromHash 0.00% (0/39) -github.com/conformal/btcchain/checkpoints.go BlockChain.IsCheckpointCandidate 0.00% (0/32) -github.com/conformal/btcchain/validate.go CountP2SHSigOps 0.00% (0/26) -github.com/conformal/btcchain/chain.go BlockChain.removeBlockNode 0.00% (0/12) -github.com/conformal/btcchain/difficulty.go BlockChain.calcEasiestDifficulty 0.00% (0/12) -github.com/conformal/btcchain/chain.go BlockChain.GetOrphanRoot 0.00% (0/11) -github.com/conformal/btcchain/scriptval.go ValidateTransactionScripts 0.00% (0/11) -github.com/conformal/btcchain/difficulty.go BlockChain.findPrevTestNetDifficulty 0.00% (0/11) -github.com/conformal/btcchain/log.go SetLogWriter 0.00% (0/10) -github.com/conformal/btcchain/chain.go BlockChain.IsCurrent 0.00% (0/9) -github.com/conformal/btcchain/chain.go removeChildNode 0.00% (0/8) -github.com/conformal/btcchain/txlookup.go BlockChain.FetchTransactionStore 0.00% (0/6) -github.com/conformal/btcchain/blocklocator.go BlockChain.LatestBlockLocator 0.00% (0/6) -github.com/conformal/btcchain/checkpoints.go isNonstandardTransaction 0.00% (0/5) -github.com/conformal/btcchain/checkpoints.go BlockChain.Checkpoints 0.00% (0/3) -github.com/conformal/btcchain/notifications.go NotificationType.String 0.00% (0/3) -github.com/conformal/btcchain/chain.go addChildrenWork 0.00% (0/3) -github.com/conformal/btcchain/log.go logClosure.String 0.00% (0/1) -github.com/conformal/btcchain/chain.go BlockChain.CalcPastMedianTime 0.00% (0/1) -github.com/conformal/btcchain/chain.go BlockChain.DisableVerify 0.00% (0/1) -github.com/conformal/btcchain/validate.go CheckProofOfWork 0.00% (0/1) -github.com/conformal/btcchain/log.go newLogClosure 0.00% (0/1) -github.com/conformal/btcchain/difficulty.go BlockChain.CalcNextRequiredDifficulty 0.00% (0/1) -github.com/conformal/btcchain/log.go UseLogger 0.00% (0/1) -github.com/conformal/btcchain ------------------------------------- 56.65% (699/1234) -