Documentation ¶
Overview ¶
Package blockproducer implements blockproducer node block genreation and database management logics.
Index ¶
- Variables
- type Chain
- type ChainRPCService
- func (s *ChainRPCService) AddTx(req *types.AddTxReq, _ *types.AddTxResp) (err error)
- func (s *ChainRPCService) AdviseNewBlock(req *types.AdviseNewBlockReq, resp *types.AdviseNewBlockResp) error
- func (s *ChainRPCService) FetchBlock(req *types.FetchBlockReq, resp *types.FetchBlockResp) error
- func (s *ChainRPCService) FetchBlockByCount(req *types.FetchBlockByCountReq, resp *types.FetchBlockResp) error
- func (s *ChainRPCService) FetchLastIrreversibleBlock(req *types.FetchLastIrreversibleBlockReq, ...) error
- func (s *ChainRPCService) FetchTxBilling(req *types.FetchTxBillingReq, resp *types.FetchTxBillingResp) error
- func (s *ChainRPCService) NextAccountNonce(req *types.NextAccountNonceReq, resp *types.NextAccountNonceResp) (err error)
- func (s *ChainRPCService) QueryAccountSQLChainProfiles(req *types.QueryAccountSQLChainProfilesReq, ...) (err error)
- func (s *ChainRPCService) QueryAccountTokenBalance(req *types.QueryAccountTokenBalanceReq, ...) (err error)
- func (s *ChainRPCService) QuerySQLChainProfile(req *types.QuerySQLChainProfileReq, resp *types.QuerySQLChainProfileResp) (err error)
- func (s *ChainRPCService) QueryTxState(req *types.QueryTxStateReq, resp *types.QueryTxStateResp) (err error)
- type Config
- type MinerInfos
- type RunMode
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchDatabase defines database meta not exists error. ErrNoSuchDatabase = errors.New("no such database") // ErrParentNotFound defines that the parent block cannot be found. ErrParentNotFound = errors.New("previous block cannot be found") // ErrInvalidHash defines invalid hash error. ErrInvalidHash = errors.New("Hash is invalid") // ErrExistedTx defines existed tx error. ErrExistedTx = errors.New("Tx existed") // ErrParentNotMatch defines invalid parent hash. ErrParentNotMatch = errors.New("Block's parent hash cannot match best block") // ErrTooManyTransactionsInBlock defines error of too many transactions in a block. ErrTooManyTransactionsInBlock = errors.New("too many transactions in block") // ErrBalanceOverflow indicates that there will be an overflow after balance manipulation. ErrBalanceOverflow = errors.New("balance overflow") // ErrInsufficientBalance indicates that an account has insufficient balance for spending. ErrInsufficientBalance = errors.New("insufficient balance") // ErrInsufficientTransfer indicates that the transfer amount is insufficient for paying arrears. ErrInsufficientTransfer = errors.New("insufficient transfer") // ErrAccountNotFound indicates that an account is not found. ErrAccountNotFound = errors.New("account not found") // ErrAccountExists indicates that the an account already exists. ErrAccountExists = errors.New("account already exists") // ErrDatabaseNotFound indicates that a database is not found. ErrDatabaseNotFound = errors.New("database not found") // ErrDatabaseExists indicates that the database already exists. ErrDatabaseExists = errors.New("database already exists") // ErrDatabaseUserExists indicates that the database user already exists. ErrDatabaseUserExists = errors.New("database user already exists") // ErrInvalidAccountNonce indicates that a transaction has a invalid account nonce. ErrInvalidAccountNonce = errors.New("invalid account nonce") // ErrUnknownTransactionType indicates that a transaction has a unknown type and cannot be // further processed. ErrUnknownTransactionType = errors.New("unknown transaction type") // ErrInvalidSender indicates that tx.Signee != tx.Sender. ErrInvalidSender = errors.New("invalid sender") // ErrInvalidRange indicates that the billing range is invalid. ErrInvalidRange = errors.New("invalid billing range") // ErrNoSuchMiner indicates that this miner does not exist or register. ErrNoSuchMiner = errors.New("no such miner") // ErrNoEnoughMiner indicates that there is not enough miners ErrNoEnoughMiner = errors.New("can not get enough miners") // ErrAccountPermissionDeny indicates that the sender does not own admin permission to the sqlchain. ErrAccountPermissionDeny = errors.New("account permission deny") // ErrNoSuperUserLeft indicates there is no super user in sqlchain. ErrNoSuperUserLeft = errors.New("no super user left") // ErrInvalidPermission indicates that the permission is invalid. ErrInvalidPermission = errors.New("invalid permission") // ErrMinerUserNotMatch indicates that the miner and user do not match. ErrMinerUserNotMatch = errors.New("miner and user do not match") // ErrInsufficientAdvancePayment indicates that the advance payment is insufficient. ErrInsufficientAdvancePayment = errors.New("insufficient advance payment") // ErrNilGenesis indicates that the genesis block is nil in config. ErrNilGenesis = errors.New("nil genesis block") // ErrMultipleGenesis indicates that there're multiple genesis blocks while loading. ErrMultipleGenesis = errors.New("multiple genesis blocks") // ErrGenesisHashNotMatch indicates that the genesis block hash in config doesn't match // the persisted one. ErrGenesisHashNotMatch = errors.New("persisted genesis block hash not match") // ErrInvalidGasPrice indicates that the gas price is invalid. ErrInvalidGasPrice = errors.New("gas price is invalid") // ErrInvalidMinerCount indicates that the miner node count is invalid. ErrInvalidMinerCount = errors.New("miner node count is invalid") // ErrLocalNodeNotFound indicates that the local node id is not found in the given peer list. ErrLocalNodeNotFound = errors.New("local node id not found in peer list") // ErrNoAvailableBranch indicates that there is no available branch from the state storage. ErrNoAvailableBranch = errors.New("no available branch from state storage") // ErrWrongTokenType indicates that token type in transfer is wrong. ErrWrongTokenType = errors.New("wrong token type") )
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct { sync.RWMutex // protects following fields // contains filtered or unexported fields }
Chain defines the main chain.
func NewChainWithContext ¶
NewChainWithContext creates a new blockchain with context.
type ChainRPCService ¶
type ChainRPCService struct {
// contains filtered or unexported fields
}
ChainRPCService defines a main chain RPC server.
func (*ChainRPCService) AdviseNewBlock ¶
func (s *ChainRPCService) AdviseNewBlock(req *types.AdviseNewBlockReq, resp *types.AdviseNewBlockResp) error
AdviseNewBlock is the RPC method to advise a new block to target server.
func (*ChainRPCService) FetchBlock ¶
func (s *ChainRPCService) FetchBlock(req *types.FetchBlockReq, resp *types.FetchBlockResp) error
FetchBlock is the RPC method to fetch a known block from the target server.
func (*ChainRPCService) FetchBlockByCount ¶
func (s *ChainRPCService) FetchBlockByCount(req *types.FetchBlockByCountReq, resp *types.FetchBlockResp) error
FetchBlockByCount is the RPC method to fetch a known block from the target server.
func (*ChainRPCService) FetchLastIrreversibleBlock ¶
func (s *ChainRPCService) FetchLastIrreversibleBlock( req *types.FetchLastIrreversibleBlockReq, resp *types.FetchLastIrreversibleBlockResp) error
FetchLastIrreversibleBlock fetches the last block irreversible block from block producer.
func (*ChainRPCService) FetchTxBilling ¶
func (s *ChainRPCService) FetchTxBilling(req *types.FetchTxBillingReq, resp *types.FetchTxBillingResp) error
FetchTxBilling is the RPC method to fetch a known billing tx from the target server.
func (*ChainRPCService) NextAccountNonce ¶
func (s *ChainRPCService) NextAccountNonce( req *types.NextAccountNonceReq, resp *types.NextAccountNonceResp) (err error, )
NextAccountNonce is the RPC method to query the next nonce of an account.
func (*ChainRPCService) QueryAccountSQLChainProfiles ¶
func (s *ChainRPCService) QueryAccountSQLChainProfiles( req *types.QueryAccountSQLChainProfilesReq, resp *types.QueryAccountSQLChainProfilesResp) (err error, )
QueryAccountSQLChainProfiles is the RPC method to query account sqlchain profiles.
func (*ChainRPCService) QueryAccountTokenBalance ¶
func (s *ChainRPCService) QueryAccountTokenBalance( req *types.QueryAccountTokenBalanceReq, resp *types.QueryAccountTokenBalanceResp) (err error, )
QueryAccountTokenBalance is the RPC method to query account token balance.
func (*ChainRPCService) QuerySQLChainProfile ¶
func (s *ChainRPCService) QuerySQLChainProfile(req *types.QuerySQLChainProfileReq, resp *types.QuerySQLChainProfileResp) (err error)
QuerySQLChainProfile is the RPC method to query SQLChainProfile.
func (*ChainRPCService) QueryTxState ¶
func (s *ChainRPCService) QueryTxState( req *types.QueryTxStateReq, resp *types.QueryTxStateResp) (err error, )
QueryTxState is the RPC method to query a transaction state.
type Config ¶
type Config struct { Mode RunMode Genesis *types.BPBlock DataFile string Server *rpc.Server Peers *proto.Peers NodeID proto.NodeID ConfirmThreshold float64 Period time.Duration Tick time.Duration BlockCacheSize int }
Config is the main chain configuration.
type MinerInfos ¶
MinerInfos is MinerInfo array.
func (MinerInfos) Less ¶
func (x MinerInfos) Less(i, j int) bool
Less returns true if MinerInfo i is less than node j.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package interfaces defines commonly used interfaces for block producers.
|
Package interfaces defines commonly used interfaces for block producers. |