github.com/core-coin/go-core/v2@v2.1.9/core/error.go (about)

     1  // Copyright 2014 by the Authors
     2  // This file is part of the go-core library.
     3  //
     4  // The go-core library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-core library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-core library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package core
    18  
    19  import "errors"
    20  
    21  var (
    22  	// ErrKnownBlock is returned when a block to import is already known locally.
    23  	ErrKnownBlock = errors.New("block already known")
    24  
    25  	// ErrBlacklistedHash is returned if a block to import is on the blacklist.
    26  	ErrBlacklistedHash = errors.New("blacklisted hash")
    27  
    28  	// ErrNoGenesis is returned when there is no Genesis Block.
    29  	ErrNoGenesis = errors.New("genesis not found in chain")
    30  )
    31  
    32  // List of cvm-call-message pre-checking errors. All state transition messages will
    33  // be pre-checked before execution. If any invalidation detected, the corresponding
    34  // error should be returned which is defined here.
    35  //
    36  // - If the pre-checking happens in the miner, then the transaction won't be packed.
    37  // - If the pre-checking happens in the block processing procedure, then a "BAD BLOCk"
    38  // error should be emitted.
    39  var (
    40  	// ErrNonceTooLow is returned if the nonce of a transaction is lower than the
    41  	// one present in the local chain.
    42  	ErrNonceTooLow = errors.New("nonce too low")
    43  
    44  	// ErrNonceTooHigh is returned if the nonce of a transaction is higher than the
    45  	// next one expected based on the local chain.
    46  	ErrNonceTooHigh = errors.New("nonce too high")
    47  
    48  	// ErrEnergyLimitReached is returned by the energy pool if the amount of energy required
    49  	// by a transaction is higher than what's left in the block.
    50  	ErrEnergyLimitReached = errors.New("energy limit reached")
    51  
    52  	// ErrInsufficientFundsForTransfer is returned if the transaction sender doesn't
    53  	// have enough funds for transfer(topmost call only).
    54  	ErrInsufficientFundsForTransfer = errors.New("insufficient funds for transfer")
    55  
    56  	// ErrInsufficientFunds is returned if the total cost of executing a transaction
    57  	// is higher than the balance of the user's account.
    58  	ErrInsufficientFunds = errors.New("insufficient funds for energy * price + value")
    59  
    60  	// ErrEnergyUintOverflow is returned when calculating energy usage.
    61  	ErrEnergyUintOverflow = errors.New("energy uint64 overflow")
    62  
    63  	// ErrIntrinsicEnergy is returned if the transaction is specified to use less energy
    64  	// than required to start the invocation.
    65  	ErrIntrinsicEnergy = errors.New("intrinsic energy too low")
    66  )