This updates the blockchain/stake module dependencies, the copyright year in the files modified since the previous release, and serves as a base for blockchain/stake/v4.0.0. The updated direct dependencies in this commit are as follows: - github.com/decred/dcrd/database/v3@v3.0.0 - github.com/decred/dcrd/dcrutil/v4@v4.0.0 The full list of updated direct dependencies since the previous blockchain/stake/v3.0.0 release are as follows: - github.com/decred/dcrd/chaincfg/chainhash@v1.0.3 - github.com/decred/dcrd/chaincfg/v3@v3.1.0 - github.com/decred/dcrd/database/v3@v3.0.0 - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 - github.com/decred/dcrd/dcrutil/v4@v4.0.0 - github.com/decred/dcrd/txscript/v4@v4.0.0 - github.com/decred/dcrd/wire@v1.5.0 - github.com/decred/slog@v1.2.0 The following direct dependencies are no longer required as compared to the previous release: - github.com/decred/dcrd/dcrec Finally, all modules in the repository that depend on the module are tidied to ensure they are updated to use the latest versions hoisted forward as a result.
77 lines
2.7 KiB
Go
77 lines
2.7 KiB
Go
// Copyright (c) 2015-2021 The Decred developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package ticketdb
|
|
|
|
// ErrorKind identifies a kind of error. It has full support for errors.Is
|
|
// and errors.As, so the caller can directly check against an error kind
|
|
// when determining the reason for an error.
|
|
type ErrorKind string
|
|
|
|
// These constants are used to identify a specific DBError.
|
|
const (
|
|
// ErrUndoDataShortRead indicates that the given undo serialized data
|
|
// was took small.
|
|
ErrUndoDataShortRead = ErrorKind("ErrUndoDataShortRead")
|
|
|
|
// ErrUndoDataNoEntries indicates that the data for undoing ticket data
|
|
// in a serialized entry was corrupt.
|
|
ErrUndoDataCorrupt = ErrorKind("ErrUndoDataCorrupt")
|
|
|
|
// ErrTicketHashesShortRead indicates that the given ticket hashes
|
|
// serialized data was took small.
|
|
ErrTicketHashesShortRead = ErrorKind("ErrTicketHashesShortRead")
|
|
|
|
// ErrTicketHashesCorrupt indicates that the data for ticket hashes
|
|
// in a serialized entry was corrupt.
|
|
ErrTicketHashesCorrupt = ErrorKind("ErrTicketHashesCorrupt")
|
|
|
|
// ErrUninitializedBucket indicates that a database bucket was not
|
|
// initialized and therefore could not be written to or read from.
|
|
ErrUninitializedBucket = ErrorKind("ErrUninitializedBucket")
|
|
|
|
// ErrMissingKey indicates that a key was not found in a bucket.
|
|
ErrMissingKey = ErrorKind("ErrMissingKey")
|
|
|
|
// ErrChainStateShortRead indicates that the given chain state data
|
|
// was too small.
|
|
ErrChainStateShortRead = ErrorKind("ErrChainStateShortRead")
|
|
|
|
// ErrDatabaseInfoShortRead indicates that the given database information
|
|
// was too small.
|
|
ErrDatabaseInfoShortRead = ErrorKind("ErrDatabaseInfoShortRead")
|
|
|
|
// ErrLoadAllTickets indicates that there was an error loading the tickets
|
|
// from the database, presumably at startup.
|
|
ErrLoadAllTickets = ErrorKind("ErrLoadAllTickets")
|
|
)
|
|
|
|
// Error satisfies the error interface and prints human-readable errors.
|
|
func (e ErrorKind) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
// DBError identifies an error related to the stake database for tickets. It
|
|
// has full support for errors.Is and errors.As, so the caller can ascertain
|
|
// the specific reason for the error by checking the underlying error.
|
|
type DBError struct {
|
|
Description string
|
|
Err error
|
|
}
|
|
|
|
// Error satisfies the error interface and prints human-readable errors.
|
|
func (e DBError) Error() string {
|
|
return e.Description
|
|
}
|
|
|
|
// Unwrap returns the underlying wrapped error.
|
|
func (e DBError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
// ticketDBError creates an DBError given a set of arguments.
|
|
func ticketDBError(kind ErrorKind, desc string) DBError {
|
|
return DBError{Err: kind, Description: desc}
|
|
}
|