Commit 9ead966c authored by David Vorick's avatar David Vorick

add linting for the modules package

The makefile code needed to be changed as well to support multi-package
linting.
parent d0d84850
......@@ -46,9 +46,12 @@ vet:
go vet $(pkgs)
# will always run on some packages for a while.
lintpkgs = ./modules/host ./modules
lint:
golint -min_confidence=1.0 ./modules/host
@test -z $$(golint -min_confidence=1.0 ./modules/host)
@for package in $(lintpkgs); do \
golint -min_confidence=1.0 $$package \
&& test -z $$(golint -min_confidence=1.0 $$package) ; \
done
# REBUILD touches all of the build-dependent source files, forcing them to be
# rebuilt. This is necessary because the go tool is not smart enough to trigger
......
......@@ -5,11 +5,19 @@ import (
)
const (
// GatewayDir is the name of the directory used to store the gateway's
// persistent data.
GatewayDir = "gateway"
)
// TODO: Move this and it's functionality into the gateway package.
var (
// BootstrapPeers is a list of peers that can be used to find other peers -
// when a client first connects to the network, the only options for
// finding peers are either manual entry of peers or to use a hardcoded
// bootstrap point. While the bootstrap point could be a central service,
// it can also be a list of peers that are known to be stable. We have
// chosen to hardcode known-stable peers.
BootstrapPeers = []NetAddress{
"23.239.14.98:9981",
"87.98.216.46:9981",
......
......@@ -11,7 +11,7 @@ const (
// HostDir names the directory that contains the host persistence.
HostDir = "host"
// MaxfileContractSetLen determines the maximum allowed size of a
// MaxFileContractSetLen determines the maximum allowed size of a
// transaction set that can be sent when trying to negotiate a file
// contract. The transaction set will contain all of the unconfirmed
// dependencies of the file contract, meaning that it can be quite large.
......
......@@ -4,16 +4,16 @@ import (
"testing"
)
// TestMaxFileContractSetLenSanity checks that a sensible value for
// TestUnitMaxFileContractSetLenSanity checks that a sensible value for
// MaxFileContractSetLen has been chosen.
func TestMaxFileContractSetLenSanity(t *testing.T) {
func TestUnitMaxFileContractSetLenSanity(t *testing.T) {
// It does not make sense for the contract set limit to be higher than the
// IsStandard limit in the transaction pool. Such a transaction set would
// never be accepted by the transaction pool, and therefore is going to
// cause a failure later on in the host process. An extra 1kb is left
// because the file contract transaction is going to grow as the terms are
// negotiated and as signatures are added.
if MaxFileContractSetLen > TransactionSetSizeLimit - 1e3 {
if MaxFileContractSetLen > TransactionSetSizeLimit-1e3 {
t.Fatal("MaxfileContractSetLen does not have a sensible value - should be smaller than the TransactionSetSizeLimit")
}
......
......@@ -5,6 +5,8 @@ import (
)
const (
// MinerDir is the name of the directory that is used to store the miner's
// persistent data.
MinerDir = "miner"
)
......
......@@ -8,7 +8,14 @@ import (
)
var (
LogSettings = log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile
// LogSettings is the recommended settings for logging. This value is
// DEPRECATED. Instead, the persist.Logger should be used.
LogSettings = log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile
// SafeMutexDelay is the recommended timeout for the deadlock detecting
// mutex. This value is DEPRECATED, as safe mutexes are no longer
// recommended. Instead, the locking conventions should be followed and a
// traditional mutex or a demote mutex should be used.
SafeMutexDelay time.Duration
)
......
......@@ -8,6 +8,8 @@ import (
)
var (
// RenterDir is the name of the directory that is used to store the
// renter's persistent data.
RenterDir = "renter"
)
......
......@@ -7,18 +7,46 @@ import (
)
const (
TransactionSizeLimit = 16e3
// TransactionSizeLimit defines the size of the largest transaction that
// will be accepted by the transaction pool according to the IsStandard
// rules.
TransactionSizeLimit = 16e3
// TransactionSetSizeLimit defines the largest set of dependent unconfirmed
// transactions that will be accepted by the transaction pool.
TransactionSetSizeLimit = 250e3
)
var (
// ErrDuplicateTransactionSet is the error that gets returned if a
// duplicate transaction set is given to the transaction pool.
ErrDuplicateTransactionSet = errors.New("transaction is a duplicate")
ErrLargeTransaction = errors.New("transaction is too large for this transaction pool")
ErrLargeTransactionSet = errors.New("transaction set is too large for this transaction pool")
ErrInvalidArbPrefix = errors.New("transaction contains non-standard arbitrary data")
// ErrLargeTransaction is the error that gets returned if a transaction
// provided to the transaction pool is larger than what is allowed by the
// IsStandard rules.
ErrLargeTransaction = errors.New("transaction is too large for this transaction pool")
// ErrLargeTransactionSet is the error that gets returned if a transaction
// set is given to the transaction pool if the transaction is larger than
// limit placed by the IsStandard rules of the transaction pool.
ErrLargeTransactionSet = errors.New("transaction set is too large for this transaction pool")
// ErrInvalidArbPrefix is the error that gets returned if a transaction is
// submitted to the transaction pool which contains a prefix that is not
// recognized. This helps prevent miners on old versions from mining
// potentially illegal transactions in the event of a soft-fork.
ErrInvalidArbPrefix = errors.New("transaction contains non-standard arbitrary data")
// PrefixNonSia defines the prefix that should be appended to any
// transactions that use the arbitrary data for reasons outside of the
// standard Sia protocol. This will prevent these transactions from being
// rejected by the IsStandard set of rules, but also means that the data
// will never be used within the formal Sia protocol.
PrefixNonSia = types.Specifier{'N', 'o', 'n', 'S', 'i', 'a'}
// TransactionPoolDir is the name of the directory that is used to store
// the transaction pool's persistent data.
TransactionPoolDir = "transactionpool"
)
......
......@@ -18,7 +18,12 @@ const (
// addresses to prevent accidental spending.
SeedChecksumSize = 6
PublicKeysPerSeed = 2500
// PublicKeysPerSeed define the number of public keys that get pregenerated
// for a seed at startup when searching for balances in the blockchain.
PublicKeysPerSeed = 2500
// WalletSeedPreloadDepth is the number of addresses that get automatically
// loaded by the wallet at startup.
WalletSeedPreloadDepth = 25
)
......@@ -41,8 +46,8 @@ var (
)
type (
// AddressSeed is cryptographic entropy that is used to derive spendable
// wallet addresses.
// Seed is cryptographic entropy that is used to derive spendable wallet
// addresses.
Seed [crypto.EntropySize]byte
// WalletTransactionID is a unique identifier for a wallet transaction.
......@@ -78,7 +83,7 @@ type (
Value types.Currency `json:"value"`
}
// A processed transaction is a transaction that has been processed into
// A ProcessedTransaction is a transaction that has been processed into
// explicit inputs and outputs and tagged with some header data such as
// confirmation height + timestamp.
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment