Skip to content

Commit

Permalink
Synced ltcd with latest btcd branch + fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RostyslavAntonyshyn committed Dec 17, 2018
1 parent 7d2daa5 commit 5f2d96f
Show file tree
Hide file tree
Showing 259 changed files with 2,727 additions and 2,518 deletions.
198 changes: 99 additions & 99 deletions CHANGES

Large diffs are not rendered by default.

48 changes: 23 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
btcd
ltcd
====

[![Build Status](https://travis-ci.org/btcsuite/btcd.png?branch=master)](https://travis-ci.org/btcsuite/btcd)
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd)
[![Build Status](https://travis-ci.org/ltcsuite/ltcd.png?branch=master)](https://travis-ci.org/ltcsuite/ltcd)

btcd is an alternative full node bitcoin implementation written in Go (golang).
ltcd is an alternative full node bitcoin implementation written in Go (golang).

This project is currently under active development and is in a Beta state. It
is extremely stable and has been in production use since October 2013.

It properly downloads, validates, and serves the block chain using the exact
rules (including consensus bugs) for block acceptance as Bitcoin Core. We have
taken great care to avoid btcd causing a fork to the block chain. It includes a
taken great care to avoid ltcd causing a fork to the block chain. It includes a
full block validation testing framework which contains all of the 'official'
block acceptance tests (and some additional ones) that is run on every pull
request to help ensure it properly follows consensus. Also, it passes all of
Expand All @@ -24,11 +22,11 @@ ensures all individual transactions admitted to the pool follow the rules
required by the block chain and also includes more strict checks which filter
transactions based on miner requirements ("standard" transactions).

One key difference between btcd and Bitcoin Core is that btcd does *NOT* include
One key difference between ltcd and Bitcoin Core is that ltcd does *NOT* include
wallet functionality and this was a very intentional design decision. See the
blog entry [here](https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon)
blog entry [here](https://blog.conformal.com/ltcd-not-your-moms-bitcoin-daemon)
for more details. This means you can't actually make or receive payments
directly with btcd. That functionality is provided by the
directly with ltcd. That functionality is provided by the
[btcwallet](https://github.com/btcsuite/btcwallet) and
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
which are both under active development.
Expand All @@ -41,7 +39,7 @@ which are both under active development.

#### Windows - MSI Available

https://github.com/btcsuite/btcd/releases
https://github.com/ltcsuite/ltcd/releases

#### Linux/BSD/MacOSX/POSIX - Build from Source

Expand All @@ -60,14 +58,14 @@ recommended that `GOPATH` is set to a directory in your home directory such as
`~/goprojects` to avoid write permission issues. It is also recommended to add
`$GOPATH/bin` to your `PATH` at this point.

- Run the following commands to obtain btcd, all dependencies, and install it:
- Run the following commands to obtain ltcd, all dependencies, and install it:

```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ cd $GOPATH/src/github.com/ltcsuite/ltcd
$ GO111MODULE=on go install -v . ./cmd/...
```

- btcd (and utilities) will now be installed in ```$GOPATH/bin```. If you did
- ltcd (and utilities) will now be installed in ```$GOPATH/bin```. If you did
not already add the bin directory to your system path during Go installation,
we recommend you do so now.

Expand All @@ -79,53 +77,53 @@ Install a newer MSI

#### Linux/BSD/MacOSX/POSIX - Build from Source

- Run the following commands to update btcd, all dependencies, and install it:
- Run the following commands to update ltcd, all dependencies, and install it:

```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ cd $GOPATH/src/github.com/ltcsuite/ltcd
$ git pull
$ GO111MODULE=on go install -v . ./cmd/...
```

## Getting Started

btcd has several configuration options available to tweak how it runs, but all
ltcd has several configuration options available to tweak how it runs, but all
of the basic operations described in the intro section work with zero
configuration.

#### Windows (Installed from MSI)

Launch btcd from your Start menu.
Launch ltcd from your Start menu.

#### Linux/BSD/POSIX/Source

```bash
$ ./btcd
$ ./ltcd
```

## IRC

- irc.freenode.net
- channel #btcd
- [webchat](https://webchat.freenode.net/?channels=btcd)
- channel #ltcd
- [webchat](https://webchat.freenode.net/?channels=ltcd)

## Issue Tracker

The [integrated github issue tracker](https://github.com/btcsuite/btcd/issues)
The [integrated github issue tracker](https://github.com/ltcsuite/ltcd/issues)
is used for this project.

## Documentation

The documentation is a work-in-progress. It is located in the [docs](https://github.com/btcsuite/btcd/tree/master/docs) folder.
The documentation is a work-in-progress. It is located in the [docs](https://github.com/ltcsuite/ltcd/tree/master/docs) folder.

## GPG Verification Key

All official release tags are signed by Conformal so users can ensure the code
has not been tampered with and is coming from the btcsuite developers. To
has not been tampered with and is coming from the ltcsuite developers. To
verify the signature perform the following:

- Download the Conformal public key:
https://raw.githubusercontent.com/btcsuite/btcd/master/release/GIT-GPG-KEY-conformal.txt
https://raw.githubusercontent.com/ltcsuite/ltcd/master/release/GIT-GPG-KEY-conformal.txt

- Import the public key into your GPG keyring:
```bash
Expand All @@ -140,4 +138,4 @@ verify the signature perform the following:

## License

btcd is licensed under the [copyfree](http://copyfree.org) ISC License.
ltcd is licensed under the [copyfree](http://copyfree.org) ISC License.
4 changes: 2 additions & 2 deletions addrmgr/addrmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"sync/atomic"
"time"

"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/ltcsuite/ltcd/chaincfg/chainhash"
"github.com/ltcsuite/ltcd/wire"
)

// AddrManager provides a concurrency safe address manager for caching potential
Expand Down
94 changes: 47 additions & 47 deletions addrmgr/addrmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"testing"
"time"

"github.com/btcsuite/btcd/addrmgr"
"github.com/btcsuite/btcd/wire"
"github.com/ltcsuite/ltcd/addrmgr"
"github.com/ltcsuite/ltcd/wire"
)

// naTest is used to describe a test to be performed against the NetAddressKey
Expand All @@ -34,61 +34,61 @@ var someIP = "173.194.115.66"
func addNaTests() {
// IPv4
// Localhost
addNaTest("127.0.0.1", 8333, "127.0.0.1:8333")
addNaTest("127.0.0.1", 8334, "127.0.0.1:8334")
addNaTest("127.0.0.1", 9333, "127.0.0.1:9333")
addNaTest("127.0.0.1", 9334, "127.0.0.1:9334")

// Class A
addNaTest("1.0.0.1", 8333, "1.0.0.1:8333")
addNaTest("2.2.2.2", 8334, "2.2.2.2:8334")
addNaTest("27.253.252.251", 8335, "27.253.252.251:8335")
addNaTest("123.3.2.1", 8336, "123.3.2.1:8336")
addNaTest("1.0.0.1", 9333, "1.0.0.1:9333")
addNaTest("2.2.2.2", 9334, "2.2.2.2:9334")
addNaTest("27.253.252.251", 9335, "27.253.252.251:9335")
addNaTest("123.3.2.1", 9336, "123.3.2.1:9336")

// Private Class A
addNaTest("10.0.0.1", 8333, "10.0.0.1:8333")
addNaTest("10.1.1.1", 8334, "10.1.1.1:8334")
addNaTest("10.2.2.2", 8335, "10.2.2.2:8335")
addNaTest("10.10.10.10", 8336, "10.10.10.10:8336")
addNaTest("10.0.0.1", 9333, "10.0.0.1:9333")
addNaTest("10.1.1.1", 9334, "10.1.1.1:9334")
addNaTest("10.2.2.2", 9335, "10.2.2.2:9335")
addNaTest("10.10.10.10", 9336, "10.10.10.10:9336")

// Class B
addNaTest("128.0.0.1", 8333, "128.0.0.1:8333")
addNaTest("129.1.1.1", 8334, "129.1.1.1:8334")
addNaTest("180.2.2.2", 8335, "180.2.2.2:8335")
addNaTest("191.10.10.10", 8336, "191.10.10.10:8336")
addNaTest("128.0.0.1", 9333, "128.0.0.1:9333")
addNaTest("129.1.1.1", 9334, "129.1.1.1:9334")
addNaTest("180.2.2.2", 9335, "180.2.2.2:9335")
addNaTest("191.10.10.10", 9336, "191.10.10.10:9336")

// Private Class B
addNaTest("172.16.0.1", 8333, "172.16.0.1:8333")
addNaTest("172.16.1.1", 8334, "172.16.1.1:8334")
addNaTest("172.16.2.2", 8335, "172.16.2.2:8335")
addNaTest("172.16.172.172", 8336, "172.16.172.172:8336")
addNaTest("172.16.0.1", 9333, "172.16.0.1:9333")
addNaTest("172.16.1.1", 9334, "172.16.1.1:9334")
addNaTest("172.16.2.2", 9335, "172.16.2.2:9335")
addNaTest("172.16.172.172", 9336, "172.16.172.172:9336")

// Class C
addNaTest("193.0.0.1", 8333, "193.0.0.1:8333")
addNaTest("200.1.1.1", 8334, "200.1.1.1:8334")
addNaTest("205.2.2.2", 8335, "205.2.2.2:8335")
addNaTest("223.10.10.10", 8336, "223.10.10.10:8336")
addNaTest("193.0.0.1", 9333, "193.0.0.1:9333")
addNaTest("200.1.1.1", 9334, "200.1.1.1:9334")
addNaTest("205.2.2.2", 9335, "205.2.2.2:9335")
addNaTest("223.10.10.10", 9336, "223.10.10.10:9336")

// Private Class C
addNaTest("192.168.0.1", 8333, "192.168.0.1:8333")
addNaTest("192.168.1.1", 8334, "192.168.1.1:8334")
addNaTest("192.168.2.2", 8335, "192.168.2.2:8335")
addNaTest("192.168.192.192", 8336, "192.168.192.192:8336")
addNaTest("192.168.0.1", 9333, "192.168.0.1:9333")
addNaTest("192.168.1.1", 9334, "192.168.1.1:9334")
addNaTest("192.168.2.2", 9335, "192.168.2.2:9335")
addNaTest("192.168.192.192", 9336, "192.168.192.192:9336")

// IPv6
// Localhost
addNaTest("::1", 8333, "[::1]:8333")
addNaTest("fe80::1", 8334, "[fe80::1]:8334")
addNaTest("::1", 9333, "[::1]:9333")
addNaTest("fe80::1", 9334, "[fe80::1]:9334")

// Link-local
addNaTest("fe80::1:1", 8333, "[fe80::1:1]:8333")
addNaTest("fe91::2:2", 8334, "[fe91::2:2]:8334")
addNaTest("fea2::3:3", 8335, "[fea2::3:3]:8335")
addNaTest("feb3::4:4", 8336, "[feb3::4:4]:8336")
addNaTest("fe80::1:1", 9333, "[fe80::1:1]:9333")
addNaTest("fe91::2:2", 9334, "[fe91::2:2]:9334")
addNaTest("fea2::3:3", 9335, "[fea2::3:3]:9335")
addNaTest("feb3::4:4", 9336, "[feb3::4:4]:9336")

// Site-local
addNaTest("fec0::1:1", 8333, "[fec0::1:1]:8333")
addNaTest("fed1::2:2", 8334, "[fed1::2:2]:8334")
addNaTest("fee2::3:3", 8335, "[fee2::3:3]:8335")
addNaTest("fef3::4:4", 8336, "[fef3::4:4]:8336")
addNaTest("fec0::1:1", 9333, "[fec0::1:1]:9333")
addNaTest("fed1::2:2", 9334, "[fed1::2:2]:9334")
addNaTest("fee2::3:3", 9335, "[fee2::3:3]:9335")
addNaTest("fef3::4:4", 9336, "[fef3::4:4]:9336")
}

func addNaTest(ip string, port uint16, want string) {
Expand Down Expand Up @@ -119,15 +119,15 @@ func TestAddAddressByIP(t *testing.T) {
err error
}{
{
someIP + ":8333",
someIP + ":9333",
nil,
},
{
someIP,
addrErr,
},
{
someIP[:12] + ":8333",
someIP[:12] + ":9333",
fmtErr,
},
{
Expand Down Expand Up @@ -212,7 +212,7 @@ func TestAttempt(t *testing.T) {
n := addrmgr.New("testattempt", lookupFunc)

// Add a new address and get it
err := n.AddAddressByIP(someIP + ":8333")
err := n.AddAddressByIP(someIP + ":9333")
if err != nil {
t.Fatalf("Adding address failed: %v", err)
}
Expand All @@ -234,7 +234,7 @@ func TestConnected(t *testing.T) {
n := addrmgr.New("testconnected", lookupFunc)

// Add a new address and get it
err := n.AddAddressByIP(someIP + ":8333")
err := n.AddAddressByIP(someIP + ":9333")
if err != nil {
t.Fatalf("Adding address failed: %v", err)
}
Expand All @@ -261,14 +261,14 @@ func TestNeedMoreAddresses(t *testing.T) {

var err error
for i := 0; i < addrsToAdd; i++ {
s := fmt.Sprintf("%d.%d.173.147:8333", i/128+60, i%128+60)
s := fmt.Sprintf("%d.%d.173.147:9333", i/128+60, i%128+60)
addrs[i], err = n.DeserializeNetAddress(s)
if err != nil {
t.Errorf("Failed to turn %s into an address: %v", s, err)
}
}

srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 9333, 0)

n.AddAddresses(addrs, srcAddr)
numAddrs := n.NumAddresses()
Expand All @@ -289,14 +289,14 @@ func TestGood(t *testing.T) {

var err error
for i := 0; i < addrsToAdd; i++ {
s := fmt.Sprintf("%d.173.147.%d:8333", i/64+60, i%64+60)
s := fmt.Sprintf("%d.173.147.%d:9333", i/64+60, i%64+60)
addrs[i], err = n.DeserializeNetAddress(s)
if err != nil {
t.Errorf("Failed to turn %s into an address: %v", s, err)
}
}

srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 9333, 0)

n.AddAddresses(addrs, srcAddr)
for _, addr := range addrs {
Expand All @@ -323,7 +323,7 @@ func TestGetAddress(t *testing.T) {
}

// Add a new address and get it
err := n.AddAddressByIP(someIP + ":8333")
err := n.AddAddressByIP(someIP + ":9333")
if err != nil {
t.Fatalf("Adding address failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion addrmgr/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package addrmgr
import (
"time"

"github.com/btcsuite/btcd/wire"
"github.com/ltcsuite/ltcd/wire"
)

func TstKnownAddressIsBad(ka *KnownAddress) bool {
Expand Down
2 changes: 1 addition & 1 deletion addrmgr/knownaddress.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package addrmgr
import (
"time"

"github.com/btcsuite/btcd/wire"
"github.com/ltcsuite/ltcd/wire"
)

// KnownAddress tracks information about a known network address that is used
Expand Down
4 changes: 2 additions & 2 deletions addrmgr/knownaddress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

"github.com/btcsuite/btcd/addrmgr"
"github.com/btcsuite/btcd/wire"
"github.com/ltcsuite/ltcd/addrmgr"
"github.com/ltcsuite/ltcd/wire"
)

func TestChance(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion addrmgr/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"net"

"github.com/btcsuite/btcd/wire"
"github.com/ltcsuite/ltcd/wire"
)

var (
Expand Down
Loading

0 comments on commit 5f2d96f

Please sign in to comment.