Documentation
¶
Overview ¶
Copyright 2017 Delos Development Foundation and contributors. Licensed under the Apache License, Version 2.0. See the COPYING file at the root of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
Copyright 2017 Delos Development Foundation and contributors. Licensed under the Apache License, Version 2.0. See the COPYING file at the root of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
Copyright 2017 Delos Development Foundation and contributors. Licensed under the Apache License, Version 2.0. See the COPYING file at the root of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
Copyright 2017 Delos Development Foundation and contributors. Licensed under the Apache License, Version 2.0. See the COPYING file at the root of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
Index ¶
- Constants
- Variables
- func AppExists(name string) (yes bool)
- func RunNode(logger *zap.Logger, config cfg.Config)
- type Accounts
- type GetAccountAmountRes
- type LastBlockInfo
- type ManagedState
- type MyApp
- func (app *MyApp) CheckTx(bs []byte) error
- func (app *MyApp) CompatibleWithDngine()
- func (app *MyApp) ExecuteTx(blockHash []byte, bs []byte, txIndex int) (validtx []byte, err error)
- func (app *MyApp) GetDngineHooks() types.Hooks
- func (app *MyApp) Info() (resInfo types.ResultInfo)
- func (app *MyApp) LoadLastBlock() (lastBlock LastBlockInfo)
- func (app *MyApp) Lock()
- func (app *MyApp) OnCommit(height, round int, block *types.Block) (interface{}, error)
- func (app *MyApp) OnExecute(height, round int, block *types.Block) (interface{}, error)
- func (app *MyApp) Query(query []byte) types.Result
- func (app *MyApp) SaveLastBlock(lastBlock LastBlockInfo)
- func (app *MyApp) Start()
- func (app *MyApp) Stop()
- func (app *MyApp) Unlock()
- type MyNode
- type MyTx
- type Node
- type RPCNode
Constants ¶
const ( ReceiptsPrefix = "receipts-" OfficialAddress = "0x7752b42608a0f1943c19fc5802cb027e60b4c911" )
const ChainIDArg = "chainid"
Variables ¶
var ( ErrUnknownTx = fmt.Errorf("unknown tx") ErrShardExists = fmt.Errorf("shard exists") ErrFailToStop = fmt.Errorf("stop shard failed") )
var Apps = make(map[string]types.AppMaker)
var (
ErrInvalidChainID = fmt.Errorf("no such chain id")
)
Functions ¶
Types ¶
type GetAccountAmountRes ¶
type GetAccountAmountRes struct {
Amount int `json:"amount"`
}
type LastBlockInfo ¶
type ManagedState ¶
type ManagedState struct {
// contains filtered or unexported fields
}
type MyApp ¶
type MyApp struct {
Txs [][]byte
RunningChainIDs map[string]string
Shards map[string]*MyNode
// contains filtered or unexported fields
}
func (*MyApp) CompatibleWithDngine ¶
func (app *MyApp) CompatibleWithDngine()
func (*MyApp) ExecuteTx ¶
ExecuteTx execute tx one by one in the loop, without lock, so should always be called between Lock() and Unlock() on the *stateDup
func (*MyApp) GetDngineHooks ¶
func (*MyApp) Info ¶
func (app *MyApp) Info() (resInfo types.ResultInfo)
func (*MyApp) LoadLastBlock ¶
func (app *MyApp) LoadLastBlock() (lastBlock LastBlockInfo)
func (*MyApp) OnCommit ¶
OnCommit run in a sync way, we don't need to lock stateDupMtx, but stateMtx is still needed
func (*MyApp) SaveLastBlock ¶
func (app *MyApp) SaveLastBlock(lastBlock LastBlockInfo)
type MyNode ¶
type MyNode struct {
Dngine *dngine.Dngine
DngineTune *dngine.DngineTunes
Application types.Application
GenesisDoc *types.GenesisDoc
// contains filtered or unexported fields
}
func (*MyNode) GetSpecialVote ¶
type MyTx ¶
type MyTx struct {
App string `json:"app"`
Act byte `json:"act"`
ChainID string `json:"chainid"`
Genesis types.GenesisDoc `json:"genesis"`
Config map[string]interface{} `json:"config"`
Time time.Time `json:"time"`
Signature crypto.SignatureEd25519 `json:"signature"`
DestAddress string `json:"destaddress"`
SourceAddress string `json:"sourceaddress"`
Amount int `json:"amount"`
}
func (*MyTx) SignByPrivKey ¶
func (t *MyTx) SignByPrivKey(p crypto.PrivKeyEd25519) error
func (*MyTx) VerifySignature ¶
func (t *MyTx) VerifySignature(pubKey crypto.PubKeyEd25519, signature crypto.SignatureEd25519) bool
type Node ¶
func (*Node) PrivValidator ¶
func (n *Node) PrivValidator() *types.PrivValidator
type RPCNode ¶
type RPCNode interface {
GetShard(string) (*MyNode, error)
Height() int
GetBlock(height int) (*types.Block, *types.BlockMeta)
BroadcastTx(tx []byte) error
BroadcastTxCommit(tx []byte) error
FlushMempool()
GetValidators() (int, []*types.Validator)
GetP2PNetInfo() (bool, []string, []*types.Peer)
GetNumPeers() int
GetConsensusStateInfo() (string, []string)
GetNumUnconfirmedTxs() int
GetUnconfirmedTxs() []types.Tx
IsNodeValidator(pub crypto.PubKey) bool
GetBlacklist() []string
GetAccountAmount(address string) *big.Int
}
RPCNode define the node's abilities provided for rpc calls