/
errors.go
143 lines (126 loc) · 8.61 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package blockchain
import "errors"
var (
// BlockChain
errIndexAlreadyInitialized = errors.New("the block index can only be initialized before it has been modified")
errConnectMainChain = errors.New("connectBlock must be called with a block that extends the main chain")
errDisconnectMainChain = errors.New("disconnectBlock must be called with the block at the end of the main chain")
errWaitForOldBlockHeight = errors.New("blockWaiter wait for old block height")
// BlockTree
errExpandOrphanRootBlockNode = errors.New("can not expand orphan block on root of blockTree")
errExpandChildRootBlockNode = errors.New("can not expand child block on root of blockTree")
errRemoveAllRootBlockNode = errors.New("can not remove all nodes on blockTree")
errAttachNonLeafBlockNode = errors.New("can not attach non-leaf block to blockTree")
errDetachParentBlockNode = errors.New("can not detach parent block from blockTree")
errRootNodeAlreadyExists = errors.New("can not set root node multiple times")
// DoubleMiningDetector
errInvalidDmdTree = errors.New("invalid double-mining-detector tree")
// ProposalPool
errFaultPubKeyGetBlockHeader = errors.New("fail to create new faultPubKey due to header data lost")
// Block Validate
errUnexpectedHeight = errors.New("illegal block for AddrIndexer, unexpected block height")
errIncompleteCoinbasePayload = errors.New("size of coinbase payload less than block height need")
errBlockNoTransactions = errors.New("block does not contain any transactions")
errBlockCacheNotExists = errors.New("required block cache not exists")
ErrInvalidTime = errors.New("block timestamp has a higher precsion the one second")
ErrTimeTooOld = errors.New("block timestamp is not after expected prevNode")
ErrTimeTooNew = errors.New("block timestamp is too far in the future")
ErrUnexpectedDifficulty = errors.New("block difficulty is not the expected value")
ErrUnexpectedChallenge = errors.New("block challenge is not the expected value")
ErrInvalidMerkleRoot = errors.New("block transaction merkle root is invalid")
ErrInvalidProposalRoot = errors.New("block proposal merkle root is invalid")
ErrTooManyTransactions = errors.New("block contains too many transactions")
ErrNoTxOutputs = errors.New("transaction has no outputs")
ErrDuplicateTxInputs = errors.New("transaction contains duplicate inputs")
ErrConnectGenesis = errors.New("genesis block should not be connected")
ErrOverwriteTx = errors.New("tried to overwrite not fully spent transaction")
ErrTooManySigOps = errors.New("too many signature operations")
ErrFirstTxNotCoinbase = errors.New("first transaction in block is not a coinbase")
ErrMultipleCoinbases = errors.New("block contains other coinbase")
ErrLowQuality = errors.New("block's proof quality is lower than expected min target")
ErrTimestampFormat = errors.New("wrong timestamp format")
ErrBadBlockHeight = errors.New("block height does not match the expected height")
ErrChainID = errors.New("block's chainID is not equal to expected chainID")
ErrBlockSIG = errors.New("block signature verify failed")
ErrInvalidBlockVersion = errors.New("block's version is not valid")
ErrInvalidBitLength = errors.New("block's bitLength is smaller than the last submission of this public key")
ErrMismatchedBindingRoot = errors.New("block binding root mismatched")
ErrNoValidBinding = errors.New("no valid binding")
ErrInvalidProofType = errors.New("invalid proof type")
ErrCheckpointTimeTooOld = errors.New("ErrCheckpointTimeTooOld")
ErrBadCheckpoint = errors.New("ErrBadCheckpoint")
ErrForkTooOld = errors.New("ErrForkTooOld")
// BanList
ErrBannedPk = errors.New("block builder puKey has been banned")
ErrBanSelfPk = errors.New("block's pubKey is banned in header banList")
ErrBanList = errors.New("invalid banList")
ErrCheckBannedPk = errors.New("invalid faultPk")
// TxPool
ErrTxPoolNil = errors.New("the txpool is nil")
ErrTxExsit = errors.New("transaction is not in the pool")
ErrFindTxByAddr = errors.New("address does not have any transactions in the pool")
ErrCoinbaseTx = errors.New("transaction is an individual coinbase")
ErrProhibitionOrphanTx = errors.New("Do not accept orphan transactions")
ErrInvalidTxVersion = errors.New("transaction version is invalid")
// Coinbase
ErrCoinbaseTxInWitness = errors.New("coinbaseTx txIn`s witness size must be 0")
ErrBadCoinbaseValue = errors.New("coinbase transaction for block pays is more than expected value")
ErrBadCoinbaseHeight = errors.New("the coinbase payload serialized block height does not equal expected height")
ErrCoinbaseOutputValue = errors.New("the coinbaseTx output value is not correct")
ErrCoinbaseOutputNum = errors.New("incorrect coinbase output number")
ErrUnexpectedCoinbase = errors.New("unexpected coinbase")
ErrNilChiaPoolPk = errors.New("nil chia pool pk")
// StakingTx & BindingTx
ErrStandardBindingTx = errors.New("input and output of the transaction are all binding transactions")
ErrInvalidStakingTxValue = errors.New("invalid staking tx value")
ErrInvalidFrozenPeriod = errors.New("invalid frozen period")
ErrStakingRewardNum = errors.New("incorrect staking reward number")
ErrBindingPubKey = errors.New("binding pubkey does not match miner pubkey")
ErrBindingInputMissing = errors.New("input of binding missing")
ErrDuplicateStaking = errors.New("duplicate staking")
ErrPlotPKAlreadyBound = errors.New("plot pk already bound")
ErrPlotPKNotBound = errors.New("plot pk not bound")
ErrBindingValueNotEnough = errors.New("binding value not enough")
ErrInvalidBindingScript = errors.New("invalid binding script")
ErrFeeForPoolPkCoinbase = errors.New("fee for setting pool_pk coinbase not enough")
ErrPayloadNonce = errors.New("invalid payload nonce")
// TxIn
ErrFindReferenceInput = errors.New("unable find reference transaction ")
ErrBadTxInput = errors.New("transaction input refers to previous output is invalid")
ErrMissingTx = errors.New("unable to find input transaction")
ErrNoTxInputs = errors.New("transaction has no inputs")
// LockTime
ErrSequenceNotSatisfied = errors.New("transaction's sequence locks on inputs not met")
ErrImmatureSpend = errors.New("try to spend immature coins")
ErrUnfinalizedTx = errors.New("transaction is not finalized")
errUnFinalizedTx = errors.New("block contains unFinalized transaction")
// Value
ErrDoubleSpend = errors.New("the transaction has been spent")
ErrDuplicateTx = errors.New("the transaction is duplicate")
ErrBadTxOutValue = errors.New("transaction output value is invalid")
ErrSpendTooHigh = errors.New("total value of all transaction inputs is less than the spent value of output")
// Fee
ErrBadFees = errors.New("total fees for block overflows accumulator")
ErrInsufficientFee = errors.New("transaction`s fees is under the required amount")
ErrInsufficientPriority = errors.New("transaction`s Priority is under the required amount")
ErrDust = errors.New("transaction output payment is dust")
// Size
ErrNonStandardTxSize = errors.New("transaction size is larger than max allowed size")
ErrWitnessSize = errors.New("transaction input witness size is large than max allowed size")
ErrTxTooBig = errors.New("transaction size is too big")
ErrBlockTooBig = errors.New("block size more than MaxBlockPayload")
ErrTxMsgPayloadSize = errors.New("transaction payload size is large than max allowed size")
// TxScript
ErrSignaturePushOnly = errors.New("transaction input witness is not push only")
ErrNuLLDataScript = errors.New("more than one transaction output in a nulldata script")
ErrNonStandardType = errors.New("non-standard script form")
ErrParseInputScript = errors.New("failed to parse transaction input script")
ErrExpectedSignInput = errors.New("transaction expected input signature not satisfied")
ErrMultiSigScriptPKNum = errors.New("multi-signature script with wrong pubkey number ")
ErrMultiSigNumSign = errors.New("multi-signature script with wrong signature number ")
ErrScriptMalformed = errors.New("failed to construct vm engine")
ErrScriptValidation = errors.New("failed to validate signature")
ErrWitnessLength = errors.New("invalid witness length")
// Listener
errNilArgument = errors.New("nil argument")
)