errcode

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2018 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MempoolErrorBase = iota * 1000
	ScriptErrorBase
	TxErrorBase
	ChainErrorBase
	RPCErrorBase
	DiskErrorBase
)

Variables

View Source
var ChainErrString = map[ChainErr]string{
	ErrorBlockHeaderNoValid:        "The block header is not valid",
	ErrorBlockHeaderNoParent:       "Can not find this block header's father",
	ErrorBlockSize:                 "ErrorBlockSize",
	ErrorPowCheckErr:               "ErrorPowCheckErr",
	ErrorBadTxnMrklRoot:            "ErrorBadTxnMrklRoot",
	ErrorbadTxnsDuplicate:          "ErrorbadTxnsDuplicate",
	ErrorBadBlkLength:              "ErrorBadBlkLength",
	ErrorBadBlkTxSize:              "ErrorBadBlkTxSize",
	ErrorBadBlkTx:                  "ErrorBadBlkTx",
	ErrorBlockAlreadyExists:        "block already exists",
	ErrorBlockNotStartWithCoinBase: "block does not start with a coinbase",
}
View Source
var DiskErrString = map[DiskErr]string{
	ErrorOutOfDiskSpace:                    "ErrorOutOfDiskSpace",
	ErrorNotFindUndoFile:                   "ErrorNotFindUndoFile",
	ErrorFailedToWriteToCoinDatabase:       "ErrorFailedToWriteToCoinDatabase",
	ErrorFailedToWriteToBlockIndexDatabase: "ErrorFailedToWriteToBlockIndexDatabase",
	SystemErrorWhileFlushing:               "SystemErrorWhileFlushing",
	ErrorOpenUndoFileFailed:                "ErrorOpenUndoFileFailed",
	FailedToReadBlock:                      "FailedToReadBlock",
	DisconnectTipUndoFailed:                "DisconnectTipUndoFailed",
	ErrorOpenBlockDataDir:                  "ErrorOpenBlockDataDir",
	ErrorDeleteBlockFile:                   "ErrorDeleteBlockFile",
}

Functions

func GetBip22Result added in v0.0.3

func GetBip22Result(rerr error) (err error)

func IsErrorCode

func IsErrorCode(err error, errCode fmt.Stringer) bool

func MakeError added in v0.0.3

func MakeError(code RejectCode, format string, innerErr error) error

func New

func New(errCode fmt.Stringer) error

func NewError added in v0.0.3

func NewError(errCode fmt.Stringer, desc string) error

Types

type ChainErr

type ChainErr int
const (
	ErrorBlockHeaderNoValid ChainErr = ChainErrorBase + iota
	ErrorBlockHeaderNoParent
	ErrorBlockSize
	ErrorPowCheckErr
	ErrorBadTxnMrklRoot
	ErrorbadTxnsDuplicate
	ErrorBadBlkLength
	ErrorBadBlkTxSize
	ErrorBadBlkTx
	ErrorBlockAlreadyExists
	ErrorBlockNotStartWithCoinBase
	ErrorNotExistsInChainMap // errorTest
)

func (ChainErr) String

func (chainerr ChainErr) String() string

type DiskErr

type DiskErr int
const (
	ErrorOutOfDiskSpace DiskErr = DiskErrorBase + iota
	ErrorNotFindUndoFile
	ErrorFailedToWriteToCoinDatabase
	ErrorFailedToWriteToBlockIndexDatabase
	SystemErrorWhileFlushing
	ErrorOpenUndoFileFailed
	FailedToReadBlock
	DisconnectTipUndoFailed
	ErrorOpenBlockDataDir
	ErrorDeleteBlockFile

	// ErrorNotExistsInDiskMap used in error test
	ErrorNotExistsInDiskMap
)

func (DiskErr) String

func (de DiskErr) String() string

type InternalRejectCode added in v0.0.3

type InternalRejectCode int
const (
	RejectHighFee      InternalRejectCode = 0x100
	RejectAlreadyKnown InternalRejectCode = 0x101
	RejectConflict     InternalRejectCode = 0x102
)

func (InternalRejectCode) String added in v0.0.3

func (code InternalRejectCode) String() string

String returns the RejectCode in human-readable form.

type MemPoolErr

type MemPoolErr int
const (
	MissParent MemPoolErr = MempoolErrorBase + iota
	RejectTx
	AlreadHaveTx
	Nomature
	ManyUnspendDepend
	ErrorNotExistsInMemMap
)

func (MemPoolErr) String

func (me MemPoolErr) String() string

type ProjectError

type ProjectError struct {
	Module string
	Code   int
	Desc   string

	ErrorCode fmt.Stringer
}

func (ProjectError) Error

func (e ProjectError) Error() string

type RPCErr

type RPCErr int
const (
	ModelValid RPCErr = RPCErrorBase + iota
	ModelInvalid
	ModelError
	ErrorNotExistInRPCMap
)

func (RPCErr) String

func (re RPCErr) String() string

type RejectCode added in v0.0.3

type RejectCode uint8

RejectCode represents a numeric value by which a remote peer indicates why a message was rejected.

const (
	RejectMalformed       RejectCode = 0x01
	RejectInvalid         RejectCode = 0x10
	RejectObsolete        RejectCode = 0x11
	RejectDuplicate       RejectCode = 0x12
	RejectNonstandard     RejectCode = 0x40
	RejectDust            RejectCode = 0x41
	RejectInsufficientFee RejectCode = 0x42
	RejectCheckpoint      RejectCode = 0x43
)

These constants define the various supported reject codes.

func IsRejectCode added in v0.0.3

func IsRejectCode(err error) (RejectCode, string, bool)

IsRejectCode BIP61 reject code; never send internal reject codes over P2P.

func (RejectCode) String added in v0.0.3

func (code RejectCode) String() string

String returns the RejectCode in human-readable form.

type ScriptErr

type ScriptErr int
const (
	ScriptErrOK ScriptErr = ScriptErrorBase + iota
	ScriptErrUnknownError
	ScriptErrEvalFalse
	ScriptErrOpReturn

	ScriptErrScriptSize
	ScriptErrPushSize
	ScriptErrOpCount
	ScriptErrStackSize
	ScriptErrSigCount
	ScriptErrPubKeyCount

	ScriptErrInvalidOperandSize
	ScriptErrInvalidNumberRange
	ScriptErrImpossibleEncoding
	ScriptErrInvalidSplitRange

	ScriptErrVerify
	ScriptErrEqualVerify
	ScriptErrCheckMultiSigVerify
	ScriptErrCheckSigVerify
	ScriptErrCheckDataSigVerify
	ScriptErrNumEqualVerify

	ScriptErrBadOpCode
	ScriptErrDisabledOpCode
	ScriptErrInvalidStackOperation
	ScriptErrInvalidAltStackOperation
	ScriptErrUnbalancedConditional

	ScriptErrDivByZero
	ScriptErrModByZero

	ScriptErrNegativeLockTime
	ScriptErrUnsatisfiedLockTime

	ScriptErrSigHashType
	ScriptErrSigDer
	ScriptErrMinimalData
	ScriptErrSigPushOnly
	ScriptErrSigHighs
	ScriptErrSigNullDummy
	ScriptErrPubKeyType
	ScriptErrCleanStack
	ScriptErrMinimalIf
	ScriptErrSigNullFail

	ScriptErrDiscourageUpgradableNops
	ScriptErrDiscourageUpgradableWitnessProgram

	ScriptErrNonCompressedPubKey

	ScriptErrIllegalForkID
	ScriptErrMustUseForkID

	ScriptErrErrorCount

	// ScriptErrSize other errcode
	ScriptErrSize
	ScriptErrNonStandard
	ScriptErrNullData
	ScriptErrBareMultiSig
	ScriptErrMultiOpReturn
	ScriptErrInvalidSignatureEncoding

	ScriptErrInvalidOpCode
	ScriptErrInValidPubKeyOrSig
	ScriptErrScriptSigNotPushOnly
)

func (ScriptErr) String

func (se ScriptErr) String() string

type TxErr

type TxErr int
const (
	TxErrRejectCheckPoint TxErr = 0x43

	TxErrNoPreviousOut TxErr = TxErrorBase + iota
	ScriptCheckInputsBug
	TxErrSignRawTransaction
	TxErrInvalidIndexOfIn
	TxErrPubKeyType
)

func (TxErr) String

func (te TxErr) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL