[NOD-517] Update doc.go files (#559)

* [NOD-517] Remove copyright notices from all doc.go.

* [NOD-517] Updated the root doc.go.

* [NOD-517] Remove all cov_report.sh and test_coverage.txt.

* [NOD-517] Make all doc.go use the same style of comment.

* [NOD-517] Update dagconfig doc.go.

* [NOD-517] Update blockdag doc.go.

* [NOD-517] Update doc.go in connmgr.

* [NOD-517] Update doc.go in fullblocktests.

* [NOD-517] Update doc.go in database.

* [NOD-517] Update doc.go in ecc.

* [NOD-517] Update doc.go in rpctest.

* [NOD-517] Removed superfluous license in logs.

* [NOD-517] Update doc.go in mempool.

* [NOD-517] Updated doc.go in peer.

* [NOD-517] Update doc.go in rpcclient.

* [NOD-517] Update doc.go in txscript.

* [NOD-517] Update doc.go in util.

* [NOD-517] Update doc.go in base58.

* [NOD-517] Update doc.go in bech32.

* [NOD-517] Update doc.go in txsort.

* [NOD-517] Update doc.go in wire.

* [NOD-517] Fix indentation.

* [NOD-517] Add a copyright notice to the main doc.go.

* [NOD-517] Add Conformal to the license notices.

* [NOD-517] Remove superfluous language from a doc.

* [NOD-517] Fix bad example.
This commit is contained in:
stasatdaglabs 2020-01-02 16:57:43 +02:00 committed by Svarog
parent 6099ce56bd
commit d984151549
35 changed files with 140 additions and 543 deletions

View File

@ -3,6 +3,7 @@ ISC License
Copyright (c) 2018-2019 The kaspanet developers Copyright (c) 2018-2019 The kaspanet developers
Copyright (c) 2013-2018 The btcsuite developers Copyright (c) 2013-2018 The btcsuite developers
Copyright (c) 2015-2016 The Decred developers Copyright (c) 2015-2016 The Decred developers
Copyright (c) 2013-2014 Conformal Systems LLC.
Permission to use, copy, modify, and distribute this software for any Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above purpose with or without fee is hereby granted, provided that the above

View File

@ -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

View File

@ -1,7 +1,3 @@
// Copyright (c) 2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package addrmgr implements concurrency safe Kaspa address manager. Package addrmgr implements concurrency safe Kaspa address manager.

View File

@ -1,62 +0,0 @@
github.com/conformal/btcd/addrmgr/network.go GroupKey 100.00% (23/23)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.reset 100.00% (6/6)
github.com/conformal/btcd/addrmgr/network.go IsRFC5737 100.00% (4/4)
github.com/conformal/btcd/addrmgr/network.go IsRFC1918 100.00% (4/4)
github.com/conformal/btcd/addrmgr/addrmanager.go New 100.00% (3/3)
github.com/conformal/btcd/addrmgr/addrmanager.go NetAddressKey 100.00% (2/2)
github.com/conformal/btcd/addrmgr/network.go IsRFC4862 100.00% (1/1)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.numAddresses 100.00% (1/1)
github.com/conformal/btcd/addrmgr/log.go init 100.00% (1/1)
github.com/conformal/btcd/addrmgr/log.go DisableLog 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go ipNet 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsIPv4 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsLocal 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsOnionCatTor 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC2544 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC3849 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC3927 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC3964 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC4193 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC4380 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC4843 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC6052 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC6145 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRFC6598 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsValid 100.00% (1/1)
github.com/conformal/btcd/addrmgr/network.go IsRoutable 100.00% (1/1)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.GetBestLocalAddress 94.74% (18/19)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.AddLocalAddress 90.91% (10/11)
github.com/conformal/btcd/addrmgr/addrmanager.go getReachabilityFrom 51.52% (17/33)
github.com/conformal/btcd/addrmgr/addrmanager.go ipString 50.00% (2/4)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.GetAddress 9.30% (4/43)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.deserializePeers 0.00% (0/50)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.Good 0.00% (0/44)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.savePeers 0.00% (0/39)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.updateAddress 0.00% (0/30)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.expireNew 0.00% (0/22)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.AddressCache 0.00% (0/16)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.HostToNetAddress 0.00% (0/15)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.getNewBucket 0.00% (0/15)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.AddAddressByIP 0.00% (0/14)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.getTriedBucket 0.00% (0/14)
github.com/conformal/btcd/addrmgr/knownaddress.go knownAddress.chance 0.00% (0/13)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.loadPeers 0.00% (0/11)
github.com/conformal/btcd/addrmgr/knownaddress.go knownAddress.isBad 0.00% (0/11)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.Connected 0.00% (0/10)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.addressHandler 0.00% (0/9)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.pickTried 0.00% (0/8)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.DeserializeNetAddress 0.00% (0/7)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.Stop 0.00% (0/7)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.Attempt 0.00% (0/7)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.Start 0.00% (0/6)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.AddAddresses 0.00% (0/4)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.NeedMoreAddresses 0.00% (0/3)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.NumAddresses 0.00% (0/3)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.AddAddress 0.00% (0/3)
github.com/conformal/btcd/addrmgr/knownaddress.go knownAddress.LastAttempt 0.00% (0/1)
github.com/conformal/btcd/addrmgr/knownaddress.go knownAddress.NetAddress 0.00% (0/1)
github.com/conformal/btcd/addrmgr/addrmanager.go AddrManager.find 0.00% (0/1)
github.com/conformal/btcd/addrmgr/log.go UseLogger 0.00% (0/1)
github.com/conformal/btcd/addrmgr --------------------------------- 21.04% (113/537)

View File

@ -1,28 +1,21 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package blockdag implements kaspa block handling and DAG selection rules. Package blockdag implements kaspa block handling and DAG selection rules.
The kaspa block handling and DAG selection rules are an integral, and quite The kaspa block handling and DAG selection rules are an integral, and quite
likely the most important, part of kaspa. At its core, kaspa is a likely the most important, part of kaspa. At its core, kaspa is a distributed
distributed consensus of which blocks are valid and which ones will comprise the consensus of which blocks are valid and which ones will comprise the DAG
DAG (public ledger) that ultimately determines accepted (public ledger) that ultimately determines accepted transactions, so it is
transactions, so it is extremely important that fully validating nodes agree on extremely important that fully validating nodes agree on all rules.
all rules.
At a high level, this package provides support for inserting new blocks into At a high level, this package provides support for inserting new blocks into
the block DAG according to the aforementioned rules. It includes the block DAG according to the aforementioned rules. It includes functionality
functionality such as rejecting duplicate blocks, ensuring blocks and such as rejecting duplicate blocks, ensuring blocks and transactions follow all
transactions follow all rules, orphan handling, and DAG order along rules, orphan handling, and DAG order along with reorganization.
with reorganization.
Since this package does not deal with other kaspa specifics such as network Since this package does not deal with other kaspa specifics such as network
communication or wallets, it provides a notification system which gives the communication, it provides a notification system which gives the caller a high
caller a high level of flexibility in how they want to react to certain events level of flexibility in how they want to react to certain events such as orphan
such as orphan blocks which need their parents requested and newly connected blocks which need their parents requested and newly connected DAG blocks.
DAG blocks which might result in wallet updates.
Kaspa DAG Processing Overview Kaspa DAG Processing Overview

View File

@ -1,7 +1,3 @@
// Copyright (c) 2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package connmgr implements a generic Kaspa network connection manager. Package connmgr implements a generic Kaspa network connection manager.
@ -10,5 +6,18 @@ Connection Manager Overview
Connection Manager handles all the general connection concerns such as Connection Manager handles all the general connection concerns such as
maintaining a set number of outbound connections, sourcing peers, banning, maintaining a set number of outbound connections, sourcing peers, banning,
limiting max connections, tor lookup, etc. limiting max connections, tor lookup, etc.
The package provides a generic connection manager which is able to accept
connection requests from a source or a set of given addresses, dial them and
notify the caller on connections. The main intended use is to initialize a pool
of active connections and maintain them to remain connected to the P2P network.
In addition the connection manager provides the following utilities:
- Notifications on connections or disconnections
- Handle failures and retry new addresses from the source
- Connect only to specified addresses
- Permanent connections with increasing backoff retry timers
- Disconnect or Remove an established connection
*/ */
package connmgr package connmgr

View File

@ -4,7 +4,7 @@ dagconfig
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) [![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/kaspanet/kaspad/dagconfig) [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/kaspanet/kaspad/dagconfig)
Package dagconfig defines DAG configuration parameters for the four standard Package dagconfig defines DAG configuration parameters for the standard
Kaspad networks and provides the ability for callers to define their own custom Kaspad networks and provides the ability for callers to define their own custom
Kaspad networks. Kaspad networks.
@ -25,7 +25,7 @@ import (
var testnet = flag.Bool("testnet", false, "operate on the testnet Kaspa network") var testnet = flag.Bool("testnet", false, "operate on the testnet Kaspa network")
// By default (without --testnet), use mainnet. // By default (without --testnet), use mainnet.
var chainParams = &dagconfig.MainNetParams var dagParams = &dagconfig.MainNetParams
func main() { func main() {
flag.Parse() flag.Parse()

View File

@ -1,61 +1,63 @@
// Package dagconfig defines DAG configuration parameters. /*
// Package dagconfig defines DAG configuration parameters.
// In addition to the main Kaspa network, which is intended for the transfer
// of monetary value, there also exists two currently active standard networks: In addition to the main Kaspa network, which is intended for the transfer
// regression test and testnet. These networks are incompatible of monetary value, there also exists the following standard networks:
// with each other (each sharing a different genesis block) and software should * testnet
// handle errors where input intended for one network is used on an application * simnet
// instance running on a different network. * devnet
// * regression test
// For library packages, dagconfig provides the ability to lookup DAG These networks are incompatible with each other (each sharing a different
// parameters and encoding magics when passed a *Params. Older APIs not updated genesis block) and software should handle errors where input intended for
// to the new convention of passing a *Params may lookup the parameters for a one network is used on an application instance running on a different
// wire.KaspaNet using ParamsForNet, but be aware that this usage is network.
// deprecated and will be removed from dagconfig in the future.
// For library packages, dagconfig provides the ability to lookup DAG
// For main packages, a (typically global) var may be assigned the address of parameters and encoding magics when passed a *Params.
// one of the standard Param vars for use as the application's "active" network.
// When a network parameter is needed, it may then be looked up through this For main packages, a (typically global) var may be assigned the address of
// variable (either directly, or hidden in a library call). one of the standard Param vars for use as the application's "active" network.
// When a network parameter is needed, it may then be looked up through this
// package main variable (either directly, or hidden in a library call).
//
// import ( package main
// "flag"
// "fmt" import (
// "log" "flag"
// "fmt"
// "github.com/kaspanet/kaspad/util" "log"
// "github.com/kaspanet/kaspad/dagconfig"
// ) "github.com/kaspanet/kaspad/util"
// "github.com/kaspanet/kaspad/dagconfig"
// var testnet = flag.Bool("testnet", false, "operate on the testnet Kaspa network") )
//
// // By default (without -testnet), use mainnet. var testnet = flag.Bool("testnet", false, "operate on the testnet Kaspa network")
// var dagParams = &dagconfig.MainNetParams
// // By default (without --testnet), use mainnet.
// func main() { var dagParams = &dagconfig.MainNetParams
// flag.Parse()
// func main() {
// // Modify active network parameters if operating on testnet. flag.Parse()
// if *testnet {
// dagParams = &dagconfig.TestNetParams // Modify active network parameters if operating on testnet.
// } if *testnet {
// dagParams = &dagconfig.TestNetParams
// // later... }
//
// // Create and print new payment address, specific to the active network. // later...
// pubKeyHash := make([]byte, 20)
// addr, err := util.NewAddressPubKeyHash(pubKeyHash, dagParams) // Create and print new payment address, specific to the active network.
// if err != nil { pubKeyHash := make([]byte, 20)
// log.Fatal(err) addr, err := util.NewAddressPubKeyHash(pubKeyHash, dagParams)
// } if err != nil {
// fmt.Println(addr) log.Fatal(err)
// } }
// fmt.Println(addr)
// If an application does not use one of the three standard Kaspa networks, }
// a new Params struct may be created which defines the parameters for the
// non-standard network. As a general rule of thumb, all network parameters If an application does not use one of the standard Kaspa networks, a new
// should be unique to the network, but parameter collisions can still occur Params struct may be created which defines the parameters for the non-
// (unfortunately, this is the case with regtest and testnet sharing magics). standard network. As a general rule of thumb, all network parameters
should be unique to the network, but parameter collisions can still occur.
*/
package dagconfig package dagconfig

View File

@ -1,7 +1,3 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package database provides a block and metadata storage database. Package database provides a block and metadata storage database.

View File

@ -1,7 +1,3 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package ffldb implements a driver for the database package that uses leveldb Package ffldb implements a driver for the database package that uses leveldb
for the backing metadata and flat files for block storage. for the backing metadata and flat files for block storage.

View File

@ -1,7 +1,3 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package treap implements a treap data structure that is used to hold ordered Package treap implements a treap data structure that is used to hold ordered
key/value pairs using a combination of binary search tree and heap semantics. key/value pairs using a combination of binary search tree and heap semantics.

122
doc.go
View File

@ -1,121 +1,27 @@
// Copyright (c) 2013-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Copyright (c) 2018-2019 The kaspanet developers
Copyright (c) 2013-2018 The btcsuite developers
Copyright (c) 2015-2016 The Decred developers
Copyright (c) 2013-2014 Conformal Systems LLC.
Use of this source code is governed by an ISC
license that can be found in the LICENSE file.
kaspad is a full-node kaspa implementation written in Go. kaspad is a full-node kaspa implementation written in Go.
The default options are sane for most users. This means kaspad will work 'out of The default options are sane for most users. This means kaspad will work 'out of
the box' for most users. However, there are also a wide variety of flags that the box' for most users. However, there are also a wide variety of flags that
can be used to control it. can be used to control it.
The following section provides a usage overview which enumerates the flags. An
interesting point to note is that the long form of all of these options
(except -C) can be specified in a configuration file that is automatically
parsed when kaspad starts up. By default, the configuration file is located at
~/.kaspad/kaspad.conf on POSIX-style operating systems and %LOCALAPPDATA%\kaspad\kaspad.conf
on Windows. The -C (--configfile) flag, as shown below, can be used to override
this location.
Usage: Usage:
kaspad [OPTIONS] kaspad [OPTIONS]
Application Options: For an up-to-date help message:
-V, --version Display version information and exit kaspad --help
-C, --configfile= Path to configuration file
-b, --datadir= Directory to store data
--logdir= Directory to log output.
-a, --addpeer= Add a peer to connect with at startup
--connect= Connect only to the specified peers at startup
--nolisten Disable listening for incoming connections -- NOTE:
Listening is automatically disabled if the --connect
or --proxy options are used without also specifying
listen interfaces via --listen
--listen= Add an interface/port to listen for connections
(default all interfaces port: 16111, testnet: 16211)
--maxpeers= Max number of inbound and outbound peers (125)
--nobanning Disable banning of misbehaving peers
--banduration= How long to ban misbehaving peers. Valid time units
are {s, m, h}. Minimum 1 second (24h0m0s)
--banthreshold= Maximum allowed ban score before disconnecting and
banning misbehaving peers.
--whitelist= Add an IP network or IP that will not be banned.
(eg. 192.168.1.0/24 or ::1)
-u, --rpcuser= Username for RPC connections
-P, --rpcpass= Password for RPC connections
--rpclimituser= Username for limited RPC connections
--rpclimitpass= Password for limited RPC connections
--rpclisten= Add an interface/port to listen for RPC connections
(default port: 16110, testnet: 16210)
--rpccert= File containing the certificate file
--rpckey= File containing the certificate key
--rpcmaxclients= Max number of RPC clients for standard connections
(10)
--rpcmaxwebsockets= Max number of RPC websocket connections (25)
--norpc Disable built-in RPC server -- NOTE: The RPC server
is disabled by default if no rpcuser/rpcpass or
rpclimituser/rpclimitpass is specified
--notls Disable TLS for the RPC server -- NOTE: This is only
allowed if the RPC server is bound to localhost
--nodnsseed Disable DNS seeding for peers
--externalip= Add an ip to the list of local addresses we claim to
listen on to peers
--proxy= Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)
--proxyuser= Username for proxy server
--proxypass= Password for proxy server
--onion= Connect to tor hidden services via SOCKS5 proxy
(eg. 127.0.0.1:9050)
--onionuser= Username for onion proxy server
--onionpass= Password for onion proxy server
--noonion Disable connecting to tor hidden services
--torisolation Enable Tor stream isolation by randomizing user
credentials for each connection.
--testnet Use the test network
--regtest Use the regression test network
--simnet Use the simulation test network
--uacomment= Comment to add to the user agent --
See BIP 14 for more information.
--dbtype= Database backend to use for the Block DAG (ffldb)
--profile= Enable HTTP profiling on given port -- NOTE port
must be between 1024 and 65536
--cpuprofile= Write CPU profile to the specified file
-d, --debuglevel= Logging level for all subsystems {trace, debug,
info, warn, error, critical} -- You may also specify
<subsystem>=<level>,<subsystem2>=<level>,... to set
the log level for individual subsystems -- Use show
to list available subsystems (info)
--upnp Use UPnP to map our listening port outside of NAT
--minrelaytxfee= The minimum transaction fee in KAS/kB to be
considered a non-zero fee.
--limitfreerelay= Limit relay of transactions with no transaction fee
to the given amount in thousands of bytes per
minute (15)
--norelaypriority Do not require free or low-fee transactions to have
high priority for relaying
--maxorphantx= Max number of orphan transactions to keep in memory
(100)
--generate Generate (mine) kaspa using the CPU
--miningaddr= Add the specified payment address to the list of
addresses to use for generated blocks -- At least
one address is required if the generate option is
set
--blockminsize= Mininum block size in bytes to be used when creating
a block
--blockmaxsize= Maximum block size in bytes to be used when creating
a block (750000)
--blockprioritysize= Size in bytes for high-priority/low-fee transactions
when creating a block (50000)
--nopeerbloomfilters Disable bloom filtering support.
--sigcachemaxsize= The maximum number of entries in the signature
verification cache.
--blocksonly Do not accept transactions from remote peers.
--relaynonstd Relay non-standard transactions regardless of the
default settings for the active network.
--rejectnonstd Reject non-standard transactions regardless of the
default settings for the active network.
Help Options:
-h, --help Show this help message
The long form of all option flags (except -C) can be specified in a configuration
file that is automatically parsed when kaspad starts up. By default, the
configuration file is located at ~/.kaspad/kaspad.conf on POSIX-style operating
systems and %LOCALAPPDATA%\kaspad\kaspad.conf on Windows. The -C (--configfile)
flag can be used to override this location.
*/ */
package main package main

View File

@ -1,7 +1,3 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package ecc implements support for the elliptic curves needed for kaspa. Package ecc implements support for the elliptic curves needed for kaspa.
@ -14,8 +10,7 @@ This package provides the data structures and functions implementing the
crypto/elliptic Curve interface in order to permit using these curves crypto/elliptic Curve interface in order to permit using these curves
with the standard crypto/ecdsa package provided with go. Helper with the standard crypto/ecdsa package provided with go. Helper
functionality is provided to parse signatures and public keys from functionality is provided to parse signatures and public keys from
standard formats. It was designed for use with kaspad, but should be standard formats. It was originally based on some initial work by
general enough for other uses of elliptic curve crypto. It was originally based ThePiachu, but has significantly diverged since then.
on some initial work by ThePiachu, but has significantly diverged since then.
*/ */
package ecc package ecc

View File

@ -1,12 +1,9 @@
// Package rpctest provides a kaspad-specific RPC testing harness crafting and /*
// executing integration tests by driving a `kaspad` instance via the `RPC` Package rpctest provides a kaspad-specific RPC testing harness crafting and
// interface. Each instance of an active harness comes equipped with a simple executing integration tests by driving a `kaspad` instance via the `RPC`
// in-memory HD wallet capable of properly syncing to the generated chain, interface. Each instance of an active harness comes equipped with a simple
// creating new addresses, and crafting fully signed transactions paying to an in-memory HD wallet capable of properly syncing to the generated chain,
// arbitrary set of outputs. creating new addresses, and crafting fully signed transactions paying to an
// arbitrary set of outputs.
// This package was designed specifically to act as an RPC testing harness for */
// `kaspad`. However, the constructs presented are general enough to be adapted to
// any project wishing to programmatically drive a `kaspad` instance of its
// systems/integration tests.
package rpctest package rpctest

View File

@ -1,15 +0,0 @@
ISC License
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.

View File

@ -1,7 +1,3 @@
// Copyright (c) 2013-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package logs defines an interface and default implementation for subsystem Package logs defines an interface and default implementation for subsystem
logging. logging.

View File

@ -1,7 +1,3 @@
// Copyright (c) 2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package mempool provides a policy-enforced pool of unmined kaspa transactions. Package mempool provides a policy-enforced pool of unmined kaspa transactions.
@ -51,14 +47,10 @@ be an exhaustive list.
- Configurable transaction acceptance policy - Configurable transaction acceptance policy
- Option to accept or reject standard transactions - Option to accept or reject standard transactions
- Option to accept or reject transactions based on priority calculations - Option to accept or reject transactions based on priority calculations
- Rate limiting of low-fee and free transactions
- Non-zero fee threshold
- Max signature operations per transaction - Max signature operations per transaction
- Max orphan transaction size
- Max number of orphan transactions allowed - Max number of orphan transactions allowed
- Additional metadata tracking for each transaction - Additional metadata tracking for each transaction
- Timestamp when the transaction was added to the pool - Timestamp when the transaction was added to the pool
- Most recent block height when the transaction was added to the pool
- The fee the transaction pays - The fee the transaction pays
- The starting priority for the transaction - The starting priority for the transaction
- Manual control of transaction removal - Manual control of transaction removal

View File

@ -1,7 +1,3 @@
// Copyright (c) 2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package netsync implements a concurrency safe block syncing protocol. The Package netsync implements a concurrency safe block syncing protocol. The
SyncManager communicates with connected peers to perform an initial block SyncManager communicates with connected peers to perform an initial block

View File

@ -1,7 +1,3 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package peer provides a common base for creating and managing kaspa network Package peer provides a common base for creating and managing kaspa network
peers. peers.
@ -133,13 +129,5 @@ Peer Statistics
A snapshot of the current peer statistics can be obtained with the StatsSnapshot A snapshot of the current peer statistics can be obtained with the StatsSnapshot
function. This includes statistics such as the total number of bytes read and function. This includes statistics such as the total number of bytes read and
written, the remote address, user agent, and negotiated protocol version. written, the remote address, user agent, and negotiated protocol version.
Logging
This package provides extensive logging capabilities through the UseLogger
function which allows a logs.Logger to be specified. For example, logging at
the debug level provides summaries of every message sent and received, and
logging at the trace level provides full dumps of parsed messages as well as the
raw message bytes using a format similar to hexdump -C.
*/ */
package peer package peer

View File

@ -1,7 +1,3 @@
// Copyright (c) 2014-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package rpcclient implements a websocket-enabled kaspa JSON-RPC client. Package rpcclient implements a websocket-enabled kaspa JSON-RPC client.
@ -59,8 +55,8 @@ work when connected via websockets. This should intuitively make sense
because HTTP POST mode does not keep a connection open! because HTTP POST mode does not keep a connection open!
All notifications provided by kaspad require registration to opt-in. For example, All notifications provided by kaspad require registration to opt-in. For example,
if you want to be notified when funds are received by a set of addresses, you if you want to be notified when blocks are added to the DAG, you register the
register the addresses via the NotifyReceived (or NotifyReceivedAsync) function. via the NotifyBlocks (or NotifyBlocksAsync) function.
Notification Handlers Notification Handlers
@ -123,7 +119,7 @@ The third category of errors, that is errors returned by the server, can be
detected by type asserting the error in a *rpcmodel.RPCError. For example, to detected by type asserting the error in a *rpcmodel.RPCError. For example, to
detect if a command is unimplemented by the remote RPC server: detect if a command is unimplemented by the remote RPC server:
amount, err := client.GetBalance("") netTotals, err := client.GetNetTotals()
if err != nil { if err != nil {
if jerr, ok := err.(*rpcmodel.RPCError); ok { if jerr, ok := err.(*rpcmodel.RPCError); ok {
switch jerr.Code { switch jerr.Code {
@ -147,7 +143,6 @@ The following full-blown client examples are in the examples directory:
and gets the current block count and gets the current block count
- websockets - websockets
Connects to a kaspad RPC server using TLS-secured websockets, registers for Connects to a kaspad RPC server using TLS-secured websockets, registers for
block connected and block disconnected notifications, and gets the current block added notifications, and gets the current block count
block count
*/ */
package rpcclient package rpcclient

View File

@ -1,7 +1,3 @@
// Copyright (c) 2015 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package rpcmodel provides primitives for working with the kaspa JSON-RPC API. Package rpcmodel provides primitives for working with the kaspa JSON-RPC API.

View File

@ -1,7 +1,3 @@
// Copyright (c) 2013-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package txscript implements the kaspa transaction script language. Package txscript implements the kaspa transaction script language.
@ -18,8 +14,8 @@ performing basic and bitwise arithmetic, conditional branching, comparing
hashes, and checking cryptographic signatures. Scripts are processed from left hashes, and checking cryptographic signatures. Scripts are processed from left
to right and intentionally do not provide loops. to right and intentionally do not provide loops.
The vast majority of kaspa scripts at the time of this writing are of several Typical kaspa scripts at the time of this writing are of several standard
standard forms which consist of a spender providing a public key and a signature forms which consist of a spender providing a public key and a signature
which proves the spender owns the associated private key. This information which proves the spender owns the associated private key. This information
is used to prove the the spender is authorized to perform the transaction. is used to prove the the spender is authorized to perform the transaction.

View File

@ -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

View File

@ -1,7 +1,3 @@
// Copyright (c) 2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package base58 provides an API for working with modified base58 and Base58Check Package base58 provides an API for working with modified base58 and Base58Check
encodings. encodings.
@ -17,13 +13,7 @@ The modified base58 alphabet used by kaspa, and hence this package, omits the
0, O, I, and l characters that look the same in many fonts and are therefore 0, O, I, and l characters that look the same in many fonts and are therefore
hard to humans to distinguish. hard to humans to distinguish.
Base58Check Encoding Scheme At the time of this writing, the Base58 encoding scheme is primarily used
for kaspa private keys.
The Base58Check encoding scheme is primarily used for kaspa addresses at the
time of this writing, however it can be used to generically encode arbitrary
byte arrays into human-readable strings along with a version byte that can be
used to differentiate the same payload. For kaspa addresses, the extra
version is used to differentiate the network of otherwise identical public keys
which helps prevent using an address intended for one network on another.
*/ */
package base58 package base58

View File

@ -1,12 +1,8 @@
// Copyright (c) 2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package bech32 provides a Go implementation of the bech32 format. Package bech32 provides a Go implementation of the bech32 format.
Bech32 strings consist of a prefix, followed by the Bech32 strings consist of a prefix, followed by the separator :,
separator :, then a checksummed data part encoded using the 32 characters then a checksummed data part encoded using the 32 characters
"qpzry9x8gf2tvdw0s3jn54khce6mua7l". "qpzry9x8gf2tvdw0s3jn54khce6mua7l".
*/ */
package bech32 package bech32

View File

@ -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

View File

@ -1,28 +0,0 @@
github.com/conformal/btcutil/bloom/murmurhash3.go MurmurHash3 100.00% (31/31)
github.com/conformal/btcutil/bloom/merkleblock.go NewMerkleBlock 100.00% (19/19)
github.com/conformal/btcutil/bloom/merkleblock.go merkleBlock.traverseAndBuild 100.00% (10/10)
github.com/conformal/btcutil/bloom/merkleblock.go merkleBlock.calcHash 100.00% (8/8)
github.com/conformal/btcutil/bloom/filter.go Filter.maybeAddOutpoint 100.00% (7/7)
github.com/conformal/btcutil/bloom/filter.go Filter.addOutpoint 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.IsLoaded 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.MsgFilterLoad 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.matchesOutpoint 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.MatchesOutpoint 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.MatchTxAndUpdate 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.Matches 100.00% (4/4)
github.com/conformal/btcutil/bloom/filter.go Filter.Add 100.00% (3/3)
github.com/conformal/btcutil/bloom/filter.go Filter.Reload 100.00% (3/3)
github.com/conformal/btcutil/bloom/filter.go Filter.Unload 100.00% (3/3)
github.com/conformal/btcutil/bloom/filter.go Filter.AddShaHash 100.00% (3/3)
github.com/conformal/btcutil/bloom/filter.go Filter.AddOutpoint 100.00% (3/3)
github.com/conformal/btcutil/bloom/filter.go minUint32 100.00% (3/3)
github.com/conformal/btcutil/bloom/filter.go Filter.hash 100.00% (2/2)
github.com/conformal/btcutil/bloom/merkleblock.go merkleBlock.calcTreeWidth 100.00% (1/1)
github.com/conformal/btcutil/bloom/filter.go LoadFilter 100.00% (1/1)
github.com/conformal/btcutil/bloom/filter.go Filter.matchTxAndUpdate 91.30% (21/23)
github.com/conformal/btcutil/bloom/filter.go Filter.matches 85.71% (6/7)
github.com/conformal/btcutil/bloom/filter.go NewFilter 81.82% (9/11)
github.com/conformal/btcutil/bloom/filter.go Filter.add 80.00% (4/5)
github.com/conformal/btcutil/bloom ---------------------------- 96.49% (165/171)

View File

@ -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

View File

@ -1,5 +1,7 @@
// Package daghash provides abstracted hash functionality. /*
// Package daghash provides abstracted hash functionality.
// This package provides a generic hash type and associated functions that
// allows the specific hash algorithm to be abstracted. This package provides a generic hash type and associated functions that
allows the specific hash algorithm to be abstracted.
*/
package daghash package daghash

View File

@ -1,7 +1,3 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package util provides kaspa-specific convenience functions and types. Package util provides kaspa-specific convenience functions and types.
@ -24,19 +20,14 @@ Address Overview
The Address interface provides an abstraction for a kaspa address. While the The Address interface provides an abstraction for a kaspa address. While the
most common type is a pay-to-pubkey-hash, kaspa already supports others and most common type is a pay-to-pubkey-hash, kaspa already supports others and
may well support more in the future. This package currently provides may well support more in the future. This package currently provides
implementations for the pay-to-pubkey, pay-to-pubkey-hash, and implementations for the pay-to-pubkey-hash, and pay-to-script-hash address
pay-to-script-hash address types. types.
To decode/encode an address: To decode/encode an address:
// NOTE: The default network is only used for address types which do not addrString := "kaspa:qqfgqp8l9l90zwetj84k2jcac2m8falvvyy8xjtnhd"
// already contain that information. At this time, that is only defaultPrefix := util.Bech32PrefixKaspa
// pay-to-pubkey addresses. addr, err := util.DecodeAddress(addrString, defaultPrefix)
addrString := "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962" +
"e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d57" +
"8a4c702b6bf11d5f"
defaultNet := &dagconfig.MainNetParams
addr, err := util.DecodeAddress(addrString, defaultNet)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return return

View File

@ -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

View File

@ -1,7 +1,3 @@
// Copyright (c) 2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package hdkeychain provides an API for kaspa hierarchical deterministic Package hdkeychain provides an API for kaspa hierarchical deterministic
extended keys (BIP0032). extended keys (BIP0032).

View File

@ -1,20 +0,0 @@
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.String 100.00% (18/18)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Zero 100.00% (9/9)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.pubKeyBytes 100.00% (7/7)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Neuter 100.00% (6/6)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.ECPrivKey 100.00% (4/4)
github.com/conformal/btcutil/hdkeychain/extendedkey.go zero 100.00% (3/3)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.SetNet 100.00% (3/3)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Address 100.00% (2/2)
github.com/conformal/btcutil/hdkeychain/extendedkey.go newExtendedKey 100.00% (1/1)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.IsPrivate 100.00% (1/1)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.ParentFingerprint 100.00% (1/1)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.ECPubKey 100.00% (1/1)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.IsForNet 100.00% (1/1)
github.com/conformal/btcutil/hdkeychain/extendedkey.go NewKeyFromString 95.83% (23/24)
github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Child 91.67% (33/36)
github.com/conformal/btcutil/hdkeychain/extendedkey.go NewMaster 91.67% (11/12)
github.com/conformal/btcutil/hdkeychain/extendedkey.go GenerateSeed 85.71% (6/7)
github.com/conformal/btcutil/hdkeychain ----------------------------- 95.59% (130/136)

View File

@ -1,9 +1,5 @@
// Copyright (c) 2015 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package txsort provides the transaction sorting according to BIP 69. Package txsort provides the transaction sorting compatible with BIP 69.
Overview Overview

View File

@ -1,7 +1,3 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/* /*
Package wire implements the kaspa wire protocol. Package wire implements the kaspa wire protocol.
@ -47,14 +43,7 @@ interactions in no particular order.
getdata message (MsgGetData) block message (MsgBlock) -or- getdata message (MsgGetData) block message (MsgBlock) -or-
tx message (MsgTx) -or- tx message (MsgTx) -or-
notfound message (MsgNotFound) notfound message (MsgNotFound)
getheaders message (MsgGetHeaders) headers message (MsgHeaders) ping message (MsgPing) pong message (MsgPong)
ping message (MsgPing) pong message (MsgHeaders)* -or-
(none -- Ability to send message is enough)
NOTES:
* The pong message was not added until later protocol versions as defined
in BIP0031. The BIP0031Version constant can be used to detect a recent
enough protocol version for this purpose (version > BIP0031Version).
Common Parameters Common Parameters
@ -77,10 +66,11 @@ The kaspa network is a magic number which is used to identify the start of a
message and which kaspa network the message applies to. This package provides message and which kaspa network the message applies to. This package provides
the following constants: the following constants:
wire.MainNet wire.MainNet
wire.RegTest (Regression test network) wire.TestNet (Test network)
wire.TestNet (Test network) wire.RegTest (Regression test network)
wire.SimNet (Simulation test network) wire.SimNet (Simulation test network)
wire.DevNet (Development network)
Determining Message Type Determining Message Type