id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
131,200
tendermint/tendermint
rpc/lib/server/handlers.go
funcArgTypes
func funcArgTypes(f interface{}) []reflect.Type { t := reflect.TypeOf(f) n := t.NumIn() typez := make([]reflect.Type, n) for i := 0; i < n; i++ { typez[i] = t.In(i) } return typez }
go
func funcArgTypes(f interface{}) []reflect.Type { t := reflect.TypeOf(f) n := t.NumIn() typez := make([]reflect.Type, n) for i := 0; i < n; i++ { typez[i] = t.In(i) } return typez }
[ "func", "funcArgTypes", "(", "f", "interface", "{", "}", ")", "[", "]", "reflect", ".", "Type", "{", "t", ":=", "reflect", ".", "TypeOf", "(", "f", ")", "\n", "n", ":=", "t", ".", "NumIn", "(", ")", "\n", "typez", ":=", "make", "(", "[", "]", ...
// return a function's argument types
[ "return", "a", "function", "s", "argument", "types" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L76-L84
131,201
tendermint/tendermint
rpc/lib/server/handlers.go
funcReturnTypes
func funcReturnTypes(f interface{}) []reflect.Type { t := reflect.TypeOf(f) n := t.NumOut() typez := make([]reflect.Type, n) for i := 0; i < n; i++ { typez[i] = t.Out(i) } return typez }
go
func funcReturnTypes(f interface{}) []reflect.Type { t := reflect.TypeOf(f) n := t.NumOut() typez := make([]reflect.Type, n) for i := 0; i < n; i++ { typez[i] = t.Out(i) } return typez }
[ "func", "funcReturnTypes", "(", "f", "interface", "{", "}", ")", "[", "]", "reflect", ".", "Type", "{", "t", ":=", "reflect", ".", "TypeOf", "(", "f", ")", "\n", "n", ":=", "t", ".", "NumOut", "(", ")", "\n", "typez", ":=", "make", "(", "[", "]...
// return a function's return types
[ "return", "a", "function", "s", "return", "types" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L87-L95
131,202
tendermint/tendermint
rpc/lib/server/handlers.go
OnDisconnect
func OnDisconnect(onDisconnect func(remoteAddr string)) func(*wsConnection) { return func(wsc *wsConnection) { wsc.onDisconnect = onDisconnect } }
go
func OnDisconnect(onDisconnect func(remoteAddr string)) func(*wsConnection) { return func(wsc *wsConnection) { wsc.onDisconnect = onDisconnect } }
[ "func", "OnDisconnect", "(", "onDisconnect", "func", "(", "remoteAddr", "string", ")", ")", "func", "(", "*", "wsConnection", ")", "{", "return", "func", "(", "wsc", "*", "wsConnection", ")", "{", "wsc", ".", "onDisconnect", "=", "onDisconnect", "\n", "}",...
// OnDisconnect sets a callback which is used upon disconnect - not // Goroutine-safe. Nop by default.
[ "OnDisconnect", "sets", "a", "callback", "which", "is", "used", "upon", "disconnect", "-", "not", "Goroutine", "-", "safe", ".", "Nop", "by", "default", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L480-L484
131,203
tendermint/tendermint
rpc/lib/server/handlers.go
WriteWait
func WriteWait(writeWait time.Duration) func(*wsConnection) { return func(wsc *wsConnection) { wsc.writeWait = writeWait } }
go
func WriteWait(writeWait time.Duration) func(*wsConnection) { return func(wsc *wsConnection) { wsc.writeWait = writeWait } }
[ "func", "WriteWait", "(", "writeWait", "time", ".", "Duration", ")", "func", "(", "*", "wsConnection", ")", "{", "return", "func", "(", "wsc", "*", "wsConnection", ")", "{", "wsc", ".", "writeWait", "=", "writeWait", "\n", "}", "\n", "}" ]
// WriteWait sets the amount of time to wait before a websocket write times out. // It should only be used in the constructor - not Goroutine-safe.
[ "WriteWait", "sets", "the", "amount", "of", "time", "to", "wait", "before", "a", "websocket", "write", "times", "out", ".", "It", "should", "only", "be", "used", "in", "the", "constructor", "-", "not", "Goroutine", "-", "safe", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L488-L492
131,204
tendermint/tendermint
rpc/lib/server/handlers.go
ReadWait
func ReadWait(readWait time.Duration) func(*wsConnection) { return func(wsc *wsConnection) { wsc.readWait = readWait } }
go
func ReadWait(readWait time.Duration) func(*wsConnection) { return func(wsc *wsConnection) { wsc.readWait = readWait } }
[ "func", "ReadWait", "(", "readWait", "time", ".", "Duration", ")", "func", "(", "*", "wsConnection", ")", "{", "return", "func", "(", "wsc", "*", "wsConnection", ")", "{", "wsc", ".", "readWait", "=", "readWait", "\n", "}", "\n", "}" ]
// ReadWait sets the amount of time to wait before a websocket read times out. // It should only be used in the constructor - not Goroutine-safe.
[ "ReadWait", "sets", "the", "amount", "of", "time", "to", "wait", "before", "a", "websocket", "read", "times", "out", ".", "It", "should", "only", "be", "used", "in", "the", "constructor", "-", "not", "Goroutine", "-", "safe", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L504-L508
131,205
tendermint/tendermint
rpc/lib/server/handlers.go
OnStart
func (wsc *wsConnection) OnStart() error { wsc.writeChan = make(chan types.RPCResponse, wsc.writeChanCapacity) // Read subscriptions/unsubscriptions to events go wsc.readRoutine() // Write responses, BLOCKING. wsc.writeRoutine() return nil }
go
func (wsc *wsConnection) OnStart() error { wsc.writeChan = make(chan types.RPCResponse, wsc.writeChanCapacity) // Read subscriptions/unsubscriptions to events go wsc.readRoutine() // Write responses, BLOCKING. wsc.writeRoutine() return nil }
[ "func", "(", "wsc", "*", "wsConnection", ")", "OnStart", "(", ")", "error", "{", "wsc", ".", "writeChan", "=", "make", "(", "chan", "types", ".", "RPCResponse", ",", "wsc", ".", "writeChanCapacity", ")", "\n\n", "// Read subscriptions/unsubscriptions to events",...
// OnStart implements cmn.Service by starting the read and write routines. It // blocks until the connection closes.
[ "OnStart", "implements", "cmn", ".", "Service", "by", "starting", "the", "read", "and", "write", "routines", ".", "It", "blocks", "until", "the", "connection", "closes", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L520-L529
131,206
tendermint/tendermint
rpc/lib/server/handlers.go
WriteRPCResponse
func (wsc *wsConnection) WriteRPCResponse(resp types.RPCResponse) { select { case <-wsc.Quit(): return case wsc.writeChan <- resp: } }
go
func (wsc *wsConnection) WriteRPCResponse(resp types.RPCResponse) { select { case <-wsc.Quit(): return case wsc.writeChan <- resp: } }
[ "func", "(", "wsc", "*", "wsConnection", ")", "WriteRPCResponse", "(", "resp", "types", ".", "RPCResponse", ")", "{", "select", "{", "case", "<-", "wsc", ".", "Quit", "(", ")", ":", "return", "\n", "case", "wsc", ".", "writeChan", "<-", "resp", ":", ...
// WriteRPCResponse pushes a response to the writeChan, and blocks until it is accepted. // It implements WSRPCConnection. It is Goroutine-safe.
[ "WriteRPCResponse", "pushes", "a", "response", "to", "the", "writeChan", "and", "blocks", "until", "it", "is", "accepted", ".", "It", "implements", "WSRPCConnection", ".", "It", "is", "Goroutine", "-", "safe", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L553-L559
131,207
tendermint/tendermint
rpc/lib/server/handlers.go
TryWriteRPCResponse
func (wsc *wsConnection) TryWriteRPCResponse(resp types.RPCResponse) bool { select { case <-wsc.Quit(): return false case wsc.writeChan <- resp: return true default: return false } }
go
func (wsc *wsConnection) TryWriteRPCResponse(resp types.RPCResponse) bool { select { case <-wsc.Quit(): return false case wsc.writeChan <- resp: return true default: return false } }
[ "func", "(", "wsc", "*", "wsConnection", ")", "TryWriteRPCResponse", "(", "resp", "types", ".", "RPCResponse", ")", "bool", "{", "select", "{", "case", "<-", "wsc", ".", "Quit", "(", ")", ":", "return", "false", "\n", "case", "wsc", ".", "writeChan", "...
// TryWriteRPCResponse attempts to push a response to the writeChan, but does not block. // It implements WSRPCConnection. It is Goroutine-safe
[ "TryWriteRPCResponse", "attempts", "to", "push", "a", "response", "to", "the", "writeChan", "but", "does", "not", "block", ".", "It", "implements", "WSRPCConnection", ".", "It", "is", "Goroutine", "-", "safe" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L563-L572
131,208
tendermint/tendermint
rpc/lib/server/handlers.go
Context
func (wsc *wsConnection) Context() context.Context { if wsc.ctx != nil { return wsc.ctx } wsc.ctx, wsc.cancel = context.WithCancel(context.Background()) return wsc.ctx }
go
func (wsc *wsConnection) Context() context.Context { if wsc.ctx != nil { return wsc.ctx } wsc.ctx, wsc.cancel = context.WithCancel(context.Background()) return wsc.ctx }
[ "func", "(", "wsc", "*", "wsConnection", ")", "Context", "(", ")", "context", ".", "Context", "{", "if", "wsc", ".", "ctx", "!=", "nil", "{", "return", "wsc", ".", "ctx", "\n", "}", "\n", "wsc", ".", "ctx", ",", "wsc", ".", "cancel", "=", "contex...
// Context returns the connection's context. // The context is canceled when the client's connection closes.
[ "Context", "returns", "the", "connection", "s", "context", ".", "The", "context", "is", "canceled", "when", "the", "client", "s", "connection", "closes", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L582-L588
131,209
tendermint/tendermint
rpc/lib/server/handlers.go
writeRoutine
func (wsc *wsConnection) writeRoutine() { pingTicker := time.NewTicker(wsc.pingPeriod) defer func() { pingTicker.Stop() if err := wsc.baseConn.Close(); err != nil { wsc.Logger.Error("Error closing connection", "err", err) } }() // https://github.com/gorilla/websocket/issues/97 pongs := make(chan string, ...
go
func (wsc *wsConnection) writeRoutine() { pingTicker := time.NewTicker(wsc.pingPeriod) defer func() { pingTicker.Stop() if err := wsc.baseConn.Close(); err != nil { wsc.Logger.Error("Error closing connection", "err", err) } }() // https://github.com/gorilla/websocket/issues/97 pongs := make(chan string, ...
[ "func", "(", "wsc", "*", "wsConnection", ")", "writeRoutine", "(", ")", "{", "pingTicker", ":=", "time", ".", "NewTicker", "(", "wsc", ".", "pingPeriod", ")", "\n", "defer", "func", "(", ")", "{", "pingTicker", ".", "Stop", "(", ")", "\n", "if", "err...
// receives on a write channel and writes out on the socket
[ "receives", "on", "a", "write", "channel", "and", "writes", "out", "on", "the", "socket" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L680-L728
131,210
tendermint/tendermint
rpc/lib/server/handlers.go
NewWebsocketManager
func NewWebsocketManager(funcMap map[string]*RPCFunc, cdc *amino.Codec, wsConnOptions ...func(*wsConnection)) *WebsocketManager { return &WebsocketManager{ funcMap: funcMap, cdc: cdc, Upgrader: websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { // TODO ??? return true }, }, logge...
go
func NewWebsocketManager(funcMap map[string]*RPCFunc, cdc *amino.Codec, wsConnOptions ...func(*wsConnection)) *WebsocketManager { return &WebsocketManager{ funcMap: funcMap, cdc: cdc, Upgrader: websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { // TODO ??? return true }, }, logge...
[ "func", "NewWebsocketManager", "(", "funcMap", "map", "[", "string", "]", "*", "RPCFunc", ",", "cdc", "*", "amino", ".", "Codec", ",", "wsConnOptions", "...", "func", "(", "*", "wsConnection", ")", ")", "*", "WebsocketManager", "{", "return", "&", "Websock...
// NewWebsocketManager returns a new WebsocketManager that passes a map of // functions, connection options and logger to new WS connections.
[ "NewWebsocketManager", "returns", "a", "new", "WebsocketManager", "that", "passes", "a", "map", "of", "functions", "connection", "options", "and", "logger", "to", "new", "WS", "connections", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L755-L768
131,211
tendermint/tendermint
rpc/lib/server/handlers.go
writeListOfEndpoints
func writeListOfEndpoints(w http.ResponseWriter, r *http.Request, funcMap map[string]*RPCFunc) { noArgNames := []string{} argNames := []string{} for name, funcData := range funcMap { if len(funcData.args) == 0 { noArgNames = append(noArgNames, name) } else { argNames = append(argNames, name) } } sort.S...
go
func writeListOfEndpoints(w http.ResponseWriter, r *http.Request, funcMap map[string]*RPCFunc) { noArgNames := []string{} argNames := []string{} for name, funcData := range funcMap { if len(funcData.args) == 0 { noArgNames = append(noArgNames, name) } else { argNames = append(argNames, name) } } sort.S...
[ "func", "writeListOfEndpoints", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "funcMap", "map", "[", "string", "]", "*", "RPCFunc", ")", "{", "noArgNames", ":=", "[", "]", "string", "{", "}", "\n", "argNames", ":=...
// writes a list of available rpc endpoints as an html page
[ "writes", "a", "list", "of", "available", "rpc", "endpoints", "as", "an", "html", "page" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/server/handlers.go#L813-L850
131,212
tendermint/tendermint
libs/db/remotedb/grpcdb/client.go
NewClient
func NewClient(serverAddr, serverCert string) (protodb.DBClient, error) { creds, err := credentials.NewClientTLSFromFile(serverCert, "") if err != nil { return nil, err } cc, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(creds)) if err != nil { return nil, err } return protodb.NewDBClient(cc), n...
go
func NewClient(serverAddr, serverCert string) (protodb.DBClient, error) { creds, err := credentials.NewClientTLSFromFile(serverCert, "") if err != nil { return nil, err } cc, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(creds)) if err != nil { return nil, err } return protodb.NewDBClient(cc), n...
[ "func", "NewClient", "(", "serverAddr", ",", "serverCert", "string", ")", "(", "protodb", ".", "DBClient", ",", "error", ")", "{", "creds", ",", "err", ":=", "credentials", ".", "NewClientTLSFromFile", "(", "serverCert", ",", "\"", "\"", ")", "\n", "if", ...
// NewClient creates a gRPC client connected to the bound gRPC server at serverAddr. // Use kind to set the level of security to either Secure or Insecure.
[ "NewClient", "creates", "a", "gRPC", "client", "connected", "to", "the", "bound", "gRPC", "server", "at", "serverAddr", ".", "Use", "kind", "to", "set", "the", "level", "of", "security", "to", "either", "Secure", "or", "Insecure", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/db/remotedb/grpcdb/client.go#L12-L22
131,213
tendermint/tendermint
p2p/node_info.go
NewProtocolVersion
func NewProtocolVersion(p2p, block, app version.Protocol) ProtocolVersion { return ProtocolVersion{ P2P: p2p, Block: block, App: app, } }
go
func NewProtocolVersion(p2p, block, app version.Protocol) ProtocolVersion { return ProtocolVersion{ P2P: p2p, Block: block, App: app, } }
[ "func", "NewProtocolVersion", "(", "p2p", ",", "block", ",", "app", "version", ".", "Protocol", ")", "ProtocolVersion", "{", "return", "ProtocolVersion", "{", "P2P", ":", "p2p", ",", "Block", ":", "block", ",", "App", ":", "app", ",", "}", "\n", "}" ]
// NewProtocolVersion returns a fully populated ProtocolVersion.
[ "NewProtocolVersion", "returns", "a", "fully", "populated", "ProtocolVersion", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/node_info.go#L60-L66
131,214
tendermint/tendermint
p2p/node_info.go
NetAddress
func (info DefaultNodeInfo) NetAddress() (*NetAddress, error) { idAddr := IDAddressString(info.ID(), info.ListenAddr) return NewNetAddressString(idAddr) }
go
func (info DefaultNodeInfo) NetAddress() (*NetAddress, error) { idAddr := IDAddressString(info.ID(), info.ListenAddr) return NewNetAddressString(idAddr) }
[ "func", "(", "info", "DefaultNodeInfo", ")", "NetAddress", "(", ")", "(", "*", "NetAddress", ",", "error", ")", "{", "idAddr", ":=", "IDAddressString", "(", "info", ".", "ID", "(", ")", ",", "info", ".", "ListenAddr", ")", "\n", "return", "NewNetAddressS...
// NetAddress returns a NetAddress derived from the DefaultNodeInfo - // it includes the authenticated peer ID and the self-reported // ListenAddr. Note that the ListenAddr is not authenticated and // may not match that address actually dialed if its an outbound peer.
[ "NetAddress", "returns", "a", "NetAddress", "derived", "from", "the", "DefaultNodeInfo", "-", "it", "includes", "the", "authenticated", "peer", "ID", "and", "the", "self", "-", "reported", "ListenAddr", ".", "Note", "that", "the", "ListenAddr", "is", "not", "a...
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/node_info.go#L217-L220
131,215
tendermint/tendermint
state/store.go
LoadStateFromDBOrGenesisFile
func LoadStateFromDBOrGenesisFile(stateDB dbm.DB, genesisFilePath string) (State, error) { state := LoadState(stateDB) if state.IsEmpty() { var err error state, err = MakeGenesisStateFromFile(genesisFilePath) if err != nil { return state, err } SaveState(stateDB, state) } return state, nil }
go
func LoadStateFromDBOrGenesisFile(stateDB dbm.DB, genesisFilePath string) (State, error) { state := LoadState(stateDB) if state.IsEmpty() { var err error state, err = MakeGenesisStateFromFile(genesisFilePath) if err != nil { return state, err } SaveState(stateDB, state) } return state, nil }
[ "func", "LoadStateFromDBOrGenesisFile", "(", "stateDB", "dbm", ".", "DB", ",", "genesisFilePath", "string", ")", "(", "State", ",", "error", ")", "{", "state", ":=", "LoadState", "(", "stateDB", ")", "\n", "if", "state", ".", "IsEmpty", "(", ")", "{", "v...
// LoadStateFromDBOrGenesisFile loads the most recent state from the database, // or creates a new one from the given genesisFilePath and persists the result // to the database.
[ "LoadStateFromDBOrGenesisFile", "loads", "the", "most", "recent", "state", "from", "the", "database", "or", "creates", "a", "new", "one", "from", "the", "given", "genesisFilePath", "and", "persists", "the", "result", "to", "the", "database", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/store.go#L37-L49
131,216
tendermint/tendermint
state/store.go
LoadStateFromDBOrGenesisDoc
func LoadStateFromDBOrGenesisDoc(stateDB dbm.DB, genesisDoc *types.GenesisDoc) (State, error) { state := LoadState(stateDB) if state.IsEmpty() { var err error state, err = MakeGenesisState(genesisDoc) if err != nil { return state, err } SaveState(stateDB, state) } return state, nil }
go
func LoadStateFromDBOrGenesisDoc(stateDB dbm.DB, genesisDoc *types.GenesisDoc) (State, error) { state := LoadState(stateDB) if state.IsEmpty() { var err error state, err = MakeGenesisState(genesisDoc) if err != nil { return state, err } SaveState(stateDB, state) } return state, nil }
[ "func", "LoadStateFromDBOrGenesisDoc", "(", "stateDB", "dbm", ".", "DB", ",", "genesisDoc", "*", "types", ".", "GenesisDoc", ")", "(", "State", ",", "error", ")", "{", "state", ":=", "LoadState", "(", "stateDB", ")", "\n", "if", "state", ".", "IsEmpty", ...
// LoadStateFromDBOrGenesisDoc loads the most recent state from the database, // or creates a new one from the given genesisDoc and persists the result // to the database.
[ "LoadStateFromDBOrGenesisDoc", "loads", "the", "most", "recent", "state", "from", "the", "database", "or", "creates", "a", "new", "one", "from", "the", "given", "genesisDoc", "and", "persists", "the", "result", "to", "the", "database", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/store.go#L54-L66
131,217
tendermint/tendermint
state/store.go
NewABCIResponses
func NewABCIResponses(block *types.Block) *ABCIResponses { resDeliverTxs := make([]*abci.ResponseDeliverTx, block.NumTxs) if block.NumTxs == 0 { // This makes Amino encoding/decoding consistent. resDeliverTxs = nil } return &ABCIResponses{ DeliverTx: resDeliverTxs, } }
go
func NewABCIResponses(block *types.Block) *ABCIResponses { resDeliverTxs := make([]*abci.ResponseDeliverTx, block.NumTxs) if block.NumTxs == 0 { // This makes Amino encoding/decoding consistent. resDeliverTxs = nil } return &ABCIResponses{ DeliverTx: resDeliverTxs, } }
[ "func", "NewABCIResponses", "(", "block", "*", "types", ".", "Block", ")", "*", "ABCIResponses", "{", "resDeliverTxs", ":=", "make", "(", "[", "]", "*", "abci", ".", "ResponseDeliverTx", ",", "block", ".", "NumTxs", ")", "\n", "if", "block", ".", "NumTxs...
// NewABCIResponses returns a new ABCIResponses
[ "NewABCIResponses", "returns", "a", "new", "ABCIResponses" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/store.go#L124-L133
131,218
tendermint/tendermint
state/store.go
LoadValidators
func LoadValidators(db dbm.DB, height int64) (*types.ValidatorSet, error) { valInfo := loadValidatorsInfo(db, height) if valInfo == nil { return nil, ErrNoValSetForHeight{height} } if valInfo.ValidatorSet == nil { lastStoredHeight := lastStoredHeightFor(height, valInfo.LastHeightChanged) valInfo2 := loadValid...
go
func LoadValidators(db dbm.DB, height int64) (*types.ValidatorSet, error) { valInfo := loadValidatorsInfo(db, height) if valInfo == nil { return nil, ErrNoValSetForHeight{height} } if valInfo.ValidatorSet == nil { lastStoredHeight := lastStoredHeightFor(height, valInfo.LastHeightChanged) valInfo2 := loadValid...
[ "func", "LoadValidators", "(", "db", "dbm", ".", "DB", ",", "height", "int64", ")", "(", "*", "types", ".", "ValidatorSet", ",", "error", ")", "{", "valInfo", ":=", "loadValidatorsInfo", "(", "db", ",", "height", ")", "\n", "if", "valInfo", "==", "nil"...
// LoadValidators loads the ValidatorSet for a given height. // Returns ErrNoValSetForHeight if the validator set can't be found for this height.
[ "LoadValidators", "loads", "the", "ValidatorSet", "for", "a", "given", "height", ".", "Returns", "ErrNoValSetForHeight", "if", "the", "validator", "set", "can", "t", "be", "found", "for", "this", "height", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/store.go#L188-L218
131,219
tendermint/tendermint
state/store.go
LoadConsensusParams
func LoadConsensusParams(db dbm.DB, height int64) (types.ConsensusParams, error) { empty := types.ConsensusParams{} paramsInfo := loadConsensusParamsInfo(db, height) if paramsInfo == nil { return empty, ErrNoConsensusParamsForHeight{height} } if paramsInfo.ConsensusParams.Equals(&empty) { paramsInfo2 := load...
go
func LoadConsensusParams(db dbm.DB, height int64) (types.ConsensusParams, error) { empty := types.ConsensusParams{} paramsInfo := loadConsensusParamsInfo(db, height) if paramsInfo == nil { return empty, ErrNoConsensusParamsForHeight{height} } if paramsInfo.ConsensusParams.Equals(&empty) { paramsInfo2 := load...
[ "func", "LoadConsensusParams", "(", "db", "dbm", ".", "DB", ",", "height", "int64", ")", "(", "types", ".", "ConsensusParams", ",", "error", ")", "{", "empty", ":=", "types", ".", "ConsensusParams", "{", "}", "\n\n", "paramsInfo", ":=", "loadConsensusParamsI...
// LoadConsensusParams loads the ConsensusParams for a given height.
[ "LoadConsensusParams", "loads", "the", "ConsensusParams", "for", "a", "given", "height", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/store.go#L278-L301
131,220
tendermint/tendermint
libs/flowrate/io.go
NewReader
func NewReader(r io.Reader, limit int64) *Reader { return &Reader{r, New(0, 0), limit, true} }
go
func NewReader(r io.Reader, limit int64) *Reader { return &Reader{r, New(0, 0), limit, true} }
[ "func", "NewReader", "(", "r", "io", ".", "Reader", ",", "limit", "int64", ")", "*", "Reader", "{", "return", "&", "Reader", "{", "r", ",", "New", "(", "0", ",", "0", ")", ",", "limit", ",", "true", "}", "\n", "}" ]
// NewReader restricts all Read operations on r to limit bytes per second.
[ "NewReader", "restricts", "all", "Read", "operations", "on", "r", "to", "limit", "bytes", "per", "second", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/io.go#L37-L39
131,221
tendermint/tendermint
libs/flowrate/io.go
SetBlocking
func (r *Reader) SetBlocking(new bool) (old bool) { old, r.block = r.block, new return }
go
func (r *Reader) SetBlocking(new bool) (old bool) { old, r.block = r.block, new return }
[ "func", "(", "r", "*", "Reader", ")", "SetBlocking", "(", "new", "bool", ")", "(", "old", "bool", ")", "{", "old", ",", "r", ".", "block", "=", "r", ".", "block", ",", "new", "\n", "return", "\n", "}" ]
// SetBlocking changes the blocking behavior and returns the previous setting. A // Read call on a non-blocking reader returns immediately if no additional bytes // may be read at this time due to the rate limit.
[ "SetBlocking", "changes", "the", "blocking", "behavior", "and", "returns", "the", "previous", "setting", ".", "A", "Read", "call", "on", "a", "non", "-", "blocking", "reader", "returns", "immediately", "if", "no", "additional", "bytes", "may", "be", "read", ...
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/io.go#L62-L65
131,222
tendermint/tendermint
libs/flowrate/io.go
Close
func (r *Reader) Close() error { defer r.Done() if c, ok := r.Reader.(io.Closer); ok { return c.Close() } return nil }
go
func (r *Reader) Close() error { defer r.Done() if c, ok := r.Reader.(io.Closer); ok { return c.Close() } return nil }
[ "func", "(", "r", "*", "Reader", ")", "Close", "(", ")", "error", "{", "defer", "r", ".", "Done", "(", ")", "\n", "if", "c", ",", "ok", ":=", "r", ".", "Reader", ".", "(", "io", ".", "Closer", ")", ";", "ok", "{", "return", "c", ".", "Close...
// Close closes the underlying reader if it implements the io.Closer interface.
[ "Close", "closes", "the", "underlying", "reader", "if", "it", "implements", "the", "io", ".", "Closer", "interface", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/io.go#L68-L74
131,223
tendermint/tendermint
libs/flowrate/io.go
SetBlocking
func (w *Writer) SetBlocking(new bool) (old bool) { old, w.block = w.block, new return }
go
func (w *Writer) SetBlocking(new bool) (old bool) { old, w.block = w.block, new return }
[ "func", "(", "w", "*", "Writer", ")", "SetBlocking", "(", "new", "bool", ")", "(", "old", "bool", ")", "{", "old", ",", "w", ".", "block", "=", "w", ".", "block", ",", "new", "\n", "return", "\n", "}" ]
// SetBlocking changes the blocking behavior and returns the previous setting. A // Write call on a non-blocking writer returns as soon as no additional bytes // may be written at this time due to the rate limit.
[ "SetBlocking", "changes", "the", "blocking", "behavior", "and", "returns", "the", "previous", "setting", ".", "A", "Write", "call", "on", "a", "non", "-", "blocking", "writer", "returns", "as", "soon", "as", "no", "additional", "bytes", "may", "be", "written...
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/io.go#L121-L124
131,224
tendermint/tendermint
libs/flowrate/io.go
Close
func (w *Writer) Close() error { defer w.Done() if c, ok := w.Writer.(io.Closer); ok { return c.Close() } return nil }
go
func (w *Writer) Close() error { defer w.Done() if c, ok := w.Writer.(io.Closer); ok { return c.Close() } return nil }
[ "func", "(", "w", "*", "Writer", ")", "Close", "(", ")", "error", "{", "defer", "w", ".", "Done", "(", ")", "\n", "if", "c", ",", "ok", ":=", "w", ".", "Writer", ".", "(", "io", ".", "Closer", ")", ";", "ok", "{", "return", "c", ".", "Close...
// Close closes the underlying writer if it implements the io.Closer interface.
[ "Close", "closes", "the", "underlying", "writer", "if", "it", "implements", "the", "io", ".", "Closer", "interface", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/io.go#L127-L133
131,225
tendermint/tendermint
mempool/reactor.go
ReserveForPeer
func (ids *mempoolIDs) ReserveForPeer(peer p2p.Peer) { ids.mtx.Lock() defer ids.mtx.Unlock() curID := ids.nextPeerID() ids.peerMap[peer.ID()] = curID ids.activeIDs[curID] = struct{}{} }
go
func (ids *mempoolIDs) ReserveForPeer(peer p2p.Peer) { ids.mtx.Lock() defer ids.mtx.Unlock() curID := ids.nextPeerID() ids.peerMap[peer.ID()] = curID ids.activeIDs[curID] = struct{}{} }
[ "func", "(", "ids", "*", "mempoolIDs", ")", "ReserveForPeer", "(", "peer", "p2p", ".", "Peer", ")", "{", "ids", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "ids", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "curID", ":=", "ids", ".", "next...
// Reserve searches for the next unused ID and assignes it to the // peer.
[ "Reserve", "searches", "for", "the", "next", "unused", "ID", "and", "assignes", "it", "to", "the", "peer", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L53-L60
131,226
tendermint/tendermint
mempool/reactor.go
nextPeerID
func (ids *mempoolIDs) nextPeerID() uint16 { if len(ids.activeIDs) == maxActiveIDs { panic(fmt.Sprintf("node has maximum %d active IDs and wanted to get one more", maxActiveIDs)) } _, idExists := ids.activeIDs[ids.nextID] for idExists { ids.nextID++ _, idExists = ids.activeIDs[ids.nextID] } curID := ids.ne...
go
func (ids *mempoolIDs) nextPeerID() uint16 { if len(ids.activeIDs) == maxActiveIDs { panic(fmt.Sprintf("node has maximum %d active IDs and wanted to get one more", maxActiveIDs)) } _, idExists := ids.activeIDs[ids.nextID] for idExists { ids.nextID++ _, idExists = ids.activeIDs[ids.nextID] } curID := ids.ne...
[ "func", "(", "ids", "*", "mempoolIDs", ")", "nextPeerID", "(", ")", "uint16", "{", "if", "len", "(", "ids", ".", "activeIDs", ")", "==", "maxActiveIDs", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "maxActiveIDs", ")", ")", "\n", ...
// nextPeerID returns the next unused peer ID to use. // This assumes that ids's mutex is already locked.
[ "nextPeerID", "returns", "the", "next", "unused", "peer", "ID", "to", "use", ".", "This", "assumes", "that", "ids", "s", "mutex", "is", "already", "locked", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L64-L77
131,227
tendermint/tendermint
mempool/reactor.go
Reclaim
func (ids *mempoolIDs) Reclaim(peer p2p.Peer) { ids.mtx.Lock() defer ids.mtx.Unlock() removedID, ok := ids.peerMap[peer.ID()] if ok { delete(ids.activeIDs, removedID) delete(ids.peerMap, peer.ID()) } }
go
func (ids *mempoolIDs) Reclaim(peer p2p.Peer) { ids.mtx.Lock() defer ids.mtx.Unlock() removedID, ok := ids.peerMap[peer.ID()] if ok { delete(ids.activeIDs, removedID) delete(ids.peerMap, peer.ID()) } }
[ "func", "(", "ids", "*", "mempoolIDs", ")", "Reclaim", "(", "peer", "p2p", ".", "Peer", ")", "{", "ids", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "ids", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "removedID", ",", "ok", ":=", "ids", ...
// Reclaim returns the ID reserved for the peer back to unused pool.
[ "Reclaim", "returns", "the", "ID", "reserved", "for", "the", "peer", "back", "to", "unused", "pool", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L80-L89
131,228
tendermint/tendermint
mempool/reactor.go
GetForPeer
func (ids *mempoolIDs) GetForPeer(peer p2p.Peer) uint16 { ids.mtx.RLock() defer ids.mtx.RUnlock() return ids.peerMap[peer.ID()] }
go
func (ids *mempoolIDs) GetForPeer(peer p2p.Peer) uint16 { ids.mtx.RLock() defer ids.mtx.RUnlock() return ids.peerMap[peer.ID()] }
[ "func", "(", "ids", "*", "mempoolIDs", ")", "GetForPeer", "(", "peer", "p2p", ".", "Peer", ")", "uint16", "{", "ids", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "ids", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "return", "ids", ".", "p...
// GetForPeer returns an ID reserved for the peer.
[ "GetForPeer", "returns", "an", "ID", "reserved", "for", "the", "peer", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L92-L97
131,229
tendermint/tendermint
mempool/reactor.go
NewMempoolReactor
func NewMempoolReactor(config *cfg.MempoolConfig, mempool *Mempool) *MempoolReactor { memR := &MempoolReactor{ config: config, Mempool: mempool, ids: newMempoolIDs(), } memR.BaseReactor = *p2p.NewBaseReactor("MempoolReactor", memR) return memR }
go
func NewMempoolReactor(config *cfg.MempoolConfig, mempool *Mempool) *MempoolReactor { memR := &MempoolReactor{ config: config, Mempool: mempool, ids: newMempoolIDs(), } memR.BaseReactor = *p2p.NewBaseReactor("MempoolReactor", memR) return memR }
[ "func", "NewMempoolReactor", "(", "config", "*", "cfg", ".", "MempoolConfig", ",", "mempool", "*", "Mempool", ")", "*", "MempoolReactor", "{", "memR", ":=", "&", "MempoolReactor", "{", "config", ":", "config", ",", "Mempool", ":", "mempool", ",", "ids", ":...
// NewMempoolReactor returns a new MempoolReactor with the given config and mempool.
[ "NewMempoolReactor", "returns", "a", "new", "MempoolReactor", "with", "the", "given", "config", "and", "mempool", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L108-L116
131,230
tendermint/tendermint
mempool/reactor.go
SetLogger
func (memR *MempoolReactor) SetLogger(l log.Logger) { memR.Logger = l memR.Mempool.SetLogger(l) }
go
func (memR *MempoolReactor) SetLogger(l log.Logger) { memR.Logger = l memR.Mempool.SetLogger(l) }
[ "func", "(", "memR", "*", "MempoolReactor", ")", "SetLogger", "(", "l", "log", ".", "Logger", ")", "{", "memR", ".", "Logger", "=", "l", "\n", "memR", ".", "Mempool", ".", "SetLogger", "(", "l", ")", "\n", "}" ]
// SetLogger sets the Logger on the reactor and the underlying Mempool.
[ "SetLogger", "sets", "the", "Logger", "on", "the", "reactor", "and", "the", "underlying", "Mempool", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L119-L122
131,231
tendermint/tendermint
mempool/reactor.go
OnStart
func (memR *MempoolReactor) OnStart() error { if !memR.config.Broadcast { memR.Logger.Info("Tx broadcasting is disabled") } return nil }
go
func (memR *MempoolReactor) OnStart() error { if !memR.config.Broadcast { memR.Logger.Info("Tx broadcasting is disabled") } return nil }
[ "func", "(", "memR", "*", "MempoolReactor", ")", "OnStart", "(", ")", "error", "{", "if", "!", "memR", ".", "config", ".", "Broadcast", "{", "memR", ".", "Logger", ".", "Info", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// OnStart implements p2p.BaseReactor.
[ "OnStart", "implements", "p2p", ".", "BaseReactor", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L125-L130
131,232
tendermint/tendermint
mempool/reactor.go
AddPeer
func (memR *MempoolReactor) AddPeer(peer p2p.Peer) { memR.ids.ReserveForPeer(peer) go memR.broadcastTxRoutine(peer) }
go
func (memR *MempoolReactor) AddPeer(peer p2p.Peer) { memR.ids.ReserveForPeer(peer) go memR.broadcastTxRoutine(peer) }
[ "func", "(", "memR", "*", "MempoolReactor", ")", "AddPeer", "(", "peer", "p2p", ".", "Peer", ")", "{", "memR", ".", "ids", ".", "ReserveForPeer", "(", "peer", ")", "\n", "go", "memR", ".", "broadcastTxRoutine", "(", "peer", ")", "\n", "}" ]
// AddPeer implements Reactor. // It starts a broadcast routine ensuring all txs are forwarded to the given peer.
[ "AddPeer", "implements", "Reactor", ".", "It", "starts", "a", "broadcast", "routine", "ensuring", "all", "txs", "are", "forwarded", "to", "the", "given", "peer", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L145-L148
131,233
tendermint/tendermint
mempool/reactor.go
Receive
func (memR *MempoolReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { msg, err := decodeMsg(msgBytes) if err != nil { memR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes) memR.Switch.StopPeerForError(src, err) return } memR.Logger.Debug("Re...
go
func (memR *MempoolReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { msg, err := decodeMsg(msgBytes) if err != nil { memR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes) memR.Switch.StopPeerForError(src, err) return } memR.Logger.Debug("Re...
[ "func", "(", "memR", "*", "MempoolReactor", ")", "Receive", "(", "chID", "byte", ",", "src", "p2p", ".", "Peer", ",", "msgBytes", "[", "]", "byte", ")", "{", "msg", ",", "err", ":=", "decodeMsg", "(", "msgBytes", ")", "\n", "if", "err", "!=", "nil"...
// Receive implements Reactor. // It adds any received transactions to the mempool.
[ "Receive", "implements", "Reactor", ".", "It", "adds", "any", "received", "transactions", "to", "the", "mempool", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L158-L178
131,234
tendermint/tendermint
mempool/reactor.go
broadcastTxRoutine
func (memR *MempoolReactor) broadcastTxRoutine(peer p2p.Peer) { if !memR.config.Broadcast { return } peerID := memR.ids.GetForPeer(peer) var next *clist.CElement for { // In case of both next.NextWaitChan() and peer.Quit() are variable at the same time if !memR.IsRunning() || !peer.IsRunning() { return ...
go
func (memR *MempoolReactor) broadcastTxRoutine(peer p2p.Peer) { if !memR.config.Broadcast { return } peerID := memR.ids.GetForPeer(peer) var next *clist.CElement for { // In case of both next.NextWaitChan() and peer.Quit() are variable at the same time if !memR.IsRunning() || !peer.IsRunning() { return ...
[ "func", "(", "memR", "*", "MempoolReactor", ")", "broadcastTxRoutine", "(", "peer", "p2p", ".", "Peer", ")", "{", "if", "!", "memR", ".", "config", ".", "Broadcast", "{", "return", "\n", "}", "\n\n", "peerID", ":=", "memR", ".", "ids", ".", "GetForPeer...
// Send new mempool txs to peer.
[ "Send", "new", "mempool", "txs", "to", "peer", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/mempool/reactor.go#L186-L253
131,235
tendermint/tendermint
tools/tm-bench/transacter.go
Start
func (t *transacter) Start() error { t.stopped = false rand.Seed(time.Now().Unix()) for i := 0; i < t.Connections; i++ { c, _, err := connect(t.Target) if err != nil { return err } t.conns[i] = c } t.startingWg.Add(t.Connections) t.endingWg.Add(2 * t.Connections) for i := 0; i < t.Connections; i++ ...
go
func (t *transacter) Start() error { t.stopped = false rand.Seed(time.Now().Unix()) for i := 0; i < t.Connections; i++ { c, _, err := connect(t.Target) if err != nil { return err } t.conns[i] = c } t.startingWg.Add(t.Connections) t.endingWg.Add(2 * t.Connections) for i := 0; i < t.Connections; i++ ...
[ "func", "(", "t", "*", "transacter", ")", "Start", "(", ")", "error", "{", "t", ".", "stopped", "=", "false", "\n\n", "rand", ".", "Seed", "(", "time", ".", "Now", "(", ")", ".", "Unix", "(", ")", ")", "\n\n", "for", "i", ":=", "0", ";", "i",...
// Start opens N = `t.Connections` connections to the target and creates read // and write goroutines for each connection.
[ "Start", "opens", "N", "=", "t", ".", "Connections", "connections", "to", "the", "target", "and", "creates", "read", "and", "write", "goroutines", "for", "each", "connection", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-bench/transacter.go#L69-L92
131,236
tendermint/tendermint
tools/tm-bench/transacter.go
Stop
func (t *transacter) Stop() { t.stopped = true t.endingWg.Wait() for _, c := range t.conns { c.Close() } }
go
func (t *transacter) Stop() { t.stopped = true t.endingWg.Wait() for _, c := range t.conns { c.Close() } }
[ "func", "(", "t", "*", "transacter", ")", "Stop", "(", ")", "{", "t", ".", "stopped", "=", "true", "\n", "t", ".", "endingWg", ".", "Wait", "(", ")", "\n", "for", "_", ",", "c", ":=", "range", "t", ".", "conns", "{", "c", ".", "Close", "(", ...
// Stop closes the connections.
[ "Stop", "closes", "the", "connections", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-bench/transacter.go#L95-L101
131,237
tendermint/tendermint
tools/tm-bench/transacter.go
updateTx
func updateTx(tx []byte, txHex []byte, txNumber int) { binary.PutUvarint(tx[8:16], uint64(txNumber)) hexUpdate := make([]byte, 16) hex.Encode(hexUpdate, tx[8:16]) for i := 16; i < 32; i++ { txHex[i] = hexUpdate[i-16] } }
go
func updateTx(tx []byte, txHex []byte, txNumber int) { binary.PutUvarint(tx[8:16], uint64(txNumber)) hexUpdate := make([]byte, 16) hex.Encode(hexUpdate, tx[8:16]) for i := 16; i < 32; i++ { txHex[i] = hexUpdate[i-16] } }
[ "func", "updateTx", "(", "tx", "[", "]", "byte", ",", "txHex", "[", "]", "byte", ",", "txNumber", "int", ")", "{", "binary", ".", "PutUvarint", "(", "tx", "[", "8", ":", "16", "]", ",", "uint64", "(", "txNumber", ")", ")", "\n", "hexUpdate", ":="...
// warning, mutates input byte slice
[ "warning", "mutates", "input", "byte", "slice" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-bench/transacter.go#L280-L287
131,238
tendermint/tendermint
abci/types/messages.go
WriteMessage
func WriteMessage(msg proto.Message, w io.Writer) error { bz, err := proto.Marshal(msg) if err != nil { return err } return encodeByteSlice(w, bz) }
go
func WriteMessage(msg proto.Message, w io.Writer) error { bz, err := proto.Marshal(msg) if err != nil { return err } return encodeByteSlice(w, bz) }
[ "func", "WriteMessage", "(", "msg", "proto", ".", "Message", ",", "w", "io", ".", "Writer", ")", "error", "{", "bz", ",", "err", ":=", "proto", ".", "Marshal", "(", "msg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n"...
// WriteMessage writes a varint length-delimited protobuf message.
[ "WriteMessage", "writes", "a", "varint", "length", "-", "delimited", "protobuf", "message", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/types/messages.go#L16-L22
131,239
tendermint/tendermint
abci/types/messages.go
ReadMessage
func ReadMessage(r io.Reader, msg proto.Message) error { return readProtoMsg(r, msg, maxMsgSize) }
go
func ReadMessage(r io.Reader, msg proto.Message) error { return readProtoMsg(r, msg, maxMsgSize) }
[ "func", "ReadMessage", "(", "r", "io", ".", "Reader", ",", "msg", "proto", ".", "Message", ")", "error", "{", "return", "readProtoMsg", "(", "r", ",", "msg", ",", "maxMsgSize", ")", "\n", "}" ]
// ReadMessage reads a varint length-delimited protobuf message.
[ "ReadMessage", "reads", "a", "varint", "length", "-", "delimited", "protobuf", "message", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/types/messages.go#L25-L27
131,240
tendermint/tendermint
p2p/trust/store.go
NewTrustMetricStore
func NewTrustMetricStore(db dbm.DB, tmc TrustMetricConfig) *TrustMetricStore { tms := &TrustMetricStore{ peerMetrics: make(map[string]*TrustMetric), db: db, config: tmc, } tms.BaseService = *cmn.NewBaseService(nil, "TrustMetricStore", tms) return tms }
go
func NewTrustMetricStore(db dbm.DB, tmc TrustMetricConfig) *TrustMetricStore { tms := &TrustMetricStore{ peerMetrics: make(map[string]*TrustMetric), db: db, config: tmc, } tms.BaseService = *cmn.NewBaseService(nil, "TrustMetricStore", tms) return tms }
[ "func", "NewTrustMetricStore", "(", "db", "dbm", ".", "DB", ",", "tmc", "TrustMetricConfig", ")", "*", "TrustMetricStore", "{", "tms", ":=", "&", "TrustMetricStore", "{", "peerMetrics", ":", "make", "(", "map", "[", "string", "]", "*", "TrustMetric", ")", ...
// NewTrustMetricStore returns a store that saves data to the DB // and uses the config when creating new trust metrics. // Use Start to to initialize the trust metric store
[ "NewTrustMetricStore", "returns", "a", "store", "that", "saves", "data", "to", "the", "DB", "and", "uses", "the", "config", "when", "creating", "new", "trust", "metrics", ".", "Use", "Start", "to", "to", "initialize", "the", "trust", "metric", "store" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L40-L49
131,241
tendermint/tendermint
p2p/trust/store.go
OnStop
func (tms *TrustMetricStore) OnStop() { tms.BaseService.OnStop() tms.mtx.Lock() defer tms.mtx.Unlock() // Stop all trust metric go-routines for _, tm := range tms.peerMetrics { tm.Stop() } // Make the final trust history data save tms.saveToDB() }
go
func (tms *TrustMetricStore) OnStop() { tms.BaseService.OnStop() tms.mtx.Lock() defer tms.mtx.Unlock() // Stop all trust metric go-routines for _, tm := range tms.peerMetrics { tm.Stop() } // Make the final trust history data save tms.saveToDB() }
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "OnStop", "(", ")", "{", "tms", ".", "BaseService", ".", "OnStop", "(", ")", "\n\n", "tms", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "tms", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "/...
// OnStop implements Service
[ "OnStop", "implements", "Service" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L66-L79
131,242
tendermint/tendermint
p2p/trust/store.go
Size
func (tms *TrustMetricStore) Size() int { tms.mtx.Lock() defer tms.mtx.Unlock() return tms.size() }
go
func (tms *TrustMetricStore) Size() int { tms.mtx.Lock() defer tms.mtx.Unlock() return tms.size() }
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "Size", "(", ")", "int", "{", "tms", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "tms", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "return", "tms", ".", "size", "(", ")", "\n", "}" ]
// Size returns the number of entries in the trust metric store
[ "Size", "returns", "the", "number", "of", "entries", "in", "the", "trust", "metric", "store" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L82-L87
131,243
tendermint/tendermint
p2p/trust/store.go
AddPeerTrustMetric
func (tms *TrustMetricStore) AddPeerTrustMetric(key string, tm *TrustMetric) { tms.mtx.Lock() defer tms.mtx.Unlock() if key == "" || tm == nil { return } tms.peerMetrics[key] = tm }
go
func (tms *TrustMetricStore) AddPeerTrustMetric(key string, tm *TrustMetric) { tms.mtx.Lock() defer tms.mtx.Unlock() if key == "" || tm == nil { return } tms.peerMetrics[key] = tm }
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "AddPeerTrustMetric", "(", "key", "string", ",", "tm", "*", "TrustMetric", ")", "{", "tms", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "tms", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "if", ...
// AddPeerTrustMetric takes an existing trust metric and associates it with a peer key. // The caller is expected to call Start on the TrustMetric being added
[ "AddPeerTrustMetric", "takes", "an", "existing", "trust", "metric", "and", "associates", "it", "with", "a", "peer", "key", ".", "The", "caller", "is", "expected", "to", "call", "Start", "on", "the", "TrustMetric", "being", "added" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L91-L99
131,244
tendermint/tendermint
p2p/trust/store.go
GetPeerTrustMetric
func (tms *TrustMetricStore) GetPeerTrustMetric(key string) *TrustMetric { tms.mtx.Lock() defer tms.mtx.Unlock() tm, ok := tms.peerMetrics[key] if !ok { // If the metric is not available, we will create it tm = NewMetricWithConfig(tms.config) tm.Start() // The metric needs to be in the map tms.peerMetric...
go
func (tms *TrustMetricStore) GetPeerTrustMetric(key string) *TrustMetric { tms.mtx.Lock() defer tms.mtx.Unlock() tm, ok := tms.peerMetrics[key] if !ok { // If the metric is not available, we will create it tm = NewMetricWithConfig(tms.config) tm.Start() // The metric needs to be in the map tms.peerMetric...
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "GetPeerTrustMetric", "(", "key", "string", ")", "*", "TrustMetric", "{", "tms", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "tms", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "tm", ",", "ok", ...
// GetPeerTrustMetric returns a trust metric by peer key
[ "GetPeerTrustMetric", "returns", "a", "trust", "metric", "by", "peer", "key" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L102-L115
131,245
tendermint/tendermint
p2p/trust/store.go
PeerDisconnected
func (tms *TrustMetricStore) PeerDisconnected(key string) { tms.mtx.Lock() defer tms.mtx.Unlock() // If the Peer that disconnected has a metric, pause it if tm, ok := tms.peerMetrics[key]; ok { tm.Pause() } }
go
func (tms *TrustMetricStore) PeerDisconnected(key string) { tms.mtx.Lock() defer tms.mtx.Unlock() // If the Peer that disconnected has a metric, pause it if tm, ok := tms.peerMetrics[key]; ok { tm.Pause() } }
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "PeerDisconnected", "(", "key", "string", ")", "{", "tms", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "tms", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "// If the Peer that disconnected has a metric,...
// PeerDisconnected pauses the trust metric associated with the peer identified by the key
[ "PeerDisconnected", "pauses", "the", "trust", "metric", "associated", "with", "the", "peer", "identified", "by", "the", "key" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L118-L126
131,246
tendermint/tendermint
p2p/trust/store.go
SaveToDB
func (tms *TrustMetricStore) SaveToDB() { tms.mtx.Lock() defer tms.mtx.Unlock() tms.saveToDB() }
go
func (tms *TrustMetricStore) SaveToDB() { tms.mtx.Lock() defer tms.mtx.Unlock() tms.saveToDB() }
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "SaveToDB", "(", ")", "{", "tms", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "tms", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "tms", ".", "saveToDB", "(", ")", "\n", "}" ]
// Saves the history data for all peers to the store DB. // This public method acquires the trust metric store lock
[ "Saves", "the", "history", "data", "for", "all", "peers", "to", "the", "store", "DB", ".", "This", "public", "method", "acquires", "the", "trust", "metric", "store", "lock" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L130-L135
131,247
tendermint/tendermint
p2p/trust/store.go
saveToDB
func (tms *TrustMetricStore) saveToDB() { tms.Logger.Debug("Saving TrustHistory to DB", "size", tms.size()) peers := make(map[string]MetricHistoryJSON) for key, tm := range tms.peerMetrics { // Add an entry for the peer identified by key peers[key] = tm.HistoryJSON() } // Write all the data back to the DB ...
go
func (tms *TrustMetricStore) saveToDB() { tms.Logger.Debug("Saving TrustHistory to DB", "size", tms.size()) peers := make(map[string]MetricHistoryJSON) for key, tm := range tms.peerMetrics { // Add an entry for the peer identified by key peers[key] = tm.HistoryJSON() } // Write all the data back to the DB ...
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "saveToDB", "(", ")", "{", "tms", ".", "Logger", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "tms", ".", "size", "(", ")", ")", "\n\n", "peers", ":=", "make", "(", "map", "[", "string", ...
// Saves the history data for all peers to the store DB
[ "Saves", "the", "history", "data", "for", "all", "peers", "to", "the", "store", "DB" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L176-L193
131,248
tendermint/tendermint
p2p/trust/store.go
saveRoutine
func (tms *TrustMetricStore) saveRoutine() { t := time.NewTicker(defaultStorePeriodicSaveInterval) defer t.Stop() loop: for { select { case <-t.C: tms.SaveToDB() case <-tms.Quit(): break loop } } }
go
func (tms *TrustMetricStore) saveRoutine() { t := time.NewTicker(defaultStorePeriodicSaveInterval) defer t.Stop() loop: for { select { case <-t.C: tms.SaveToDB() case <-tms.Quit(): break loop } } }
[ "func", "(", "tms", "*", "TrustMetricStore", ")", "saveRoutine", "(", ")", "{", "t", ":=", "time", ".", "NewTicker", "(", "defaultStorePeriodicSaveInterval", ")", "\n", "defer", "t", ".", "Stop", "(", ")", "\n", "loop", ":", "for", "{", "select", "{", ...
// Periodically saves the trust history data to the DB
[ "Periodically", "saves", "the", "trust", "history", "data", "to", "the", "DB" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/trust/store.go#L196-L208
131,249
tendermint/tendermint
crypto/encoding/amino/amino.go
PubkeyAminoName
func PubkeyAminoName(cdc *amino.Codec, key crypto.PubKey) (string, bool) { route, found := nameTable[reflect.TypeOf(key)] return route, found }
go
func PubkeyAminoName(cdc *amino.Codec, key crypto.PubKey) (string, bool) { route, found := nameTable[reflect.TypeOf(key)] return route, found }
[ "func", "PubkeyAminoName", "(", "cdc", "*", "amino", ".", "Codec", ",", "key", "crypto", ".", "PubKey", ")", "(", "string", ",", "bool", ")", "{", "route", ",", "found", ":=", "nameTable", "[", "reflect", ".", "TypeOf", "(", "key", ")", "]", "\n", ...
// PubkeyAminoName returns the amino route of a pubkey // cdc is currently passed in, as eventually this will not be using // a package level codec.
[ "PubkeyAminoName", "returns", "the", "amino", "route", "of", "a", "pubkey", "cdc", "is", "currently", "passed", "in", "as", "eventually", "this", "will", "not", "be", "using", "a", "package", "level", "codec", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/encoding/amino/amino.go#L40-L43
131,250
tendermint/tendermint
proxy/multi_app_conn.go
NewMultiAppConn
func NewMultiAppConn(clientCreator ClientCreator) *multiAppConn { multiAppConn := &multiAppConn{ clientCreator: clientCreator, } multiAppConn.BaseService = *cmn.NewBaseService(nil, "multiAppConn", multiAppConn) return multiAppConn }
go
func NewMultiAppConn(clientCreator ClientCreator) *multiAppConn { multiAppConn := &multiAppConn{ clientCreator: clientCreator, } multiAppConn.BaseService = *cmn.NewBaseService(nil, "multiAppConn", multiAppConn) return multiAppConn }
[ "func", "NewMultiAppConn", "(", "clientCreator", "ClientCreator", ")", "*", "multiAppConn", "{", "multiAppConn", ":=", "&", "multiAppConn", "{", "clientCreator", ":", "clientCreator", ",", "}", "\n", "multiAppConn", ".", "BaseService", "=", "*", "cmn", ".", "New...
// Make all necessary abci connections to the application
[ "Make", "all", "necessary", "abci", "connections", "to", "the", "application" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/proxy/multi_app_conn.go#L41-L47
131,251
tendermint/tendermint
abci/server/socket_server.go
rmConn
func (s *SocketServer) rmConn(connID int) error { s.connsMtx.Lock() defer s.connsMtx.Unlock() conn, ok := s.conns[connID] if !ok { return fmt.Errorf("Connection %d does not exist", connID) } delete(s.conns, connID) return conn.Close() }
go
func (s *SocketServer) rmConn(connID int) error { s.connsMtx.Lock() defer s.connsMtx.Unlock() conn, ok := s.conns[connID] if !ok { return fmt.Errorf("Connection %d does not exist", connID) } delete(s.conns, connID) return conn.Close() }
[ "func", "(", "s", "*", "SocketServer", ")", "rmConn", "(", "connID", "int", ")", "error", "{", "s", ".", "connsMtx", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "connsMtx", ".", "Unlock", "(", ")", "\n\n", "conn", ",", "ok", ":=", "s", ".", ...
// deletes conn even if close errs
[ "deletes", "conn", "even", "if", "close", "errs" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/server/socket_server.go#L85-L96
131,252
tendermint/tendermint
abci/server/socket_server.go
handleRequests
func (s *SocketServer) handleRequests(closeConn chan error, conn net.Conn, responses chan<- *types.Response) { var count int var bufReader = bufio.NewReader(conn) for { var req = &types.Request{} err := types.ReadMessage(bufReader, req) if err != nil { if err == io.EOF { closeConn <- err } else { ...
go
func (s *SocketServer) handleRequests(closeConn chan error, conn net.Conn, responses chan<- *types.Response) { var count int var bufReader = bufio.NewReader(conn) for { var req = &types.Request{} err := types.ReadMessage(bufReader, req) if err != nil { if err == io.EOF { closeConn <- err } else { ...
[ "func", "(", "s", "*", "SocketServer", ")", "handleRequests", "(", "closeConn", "chan", "error", ",", "conn", "net", ".", "Conn", ",", "responses", "chan", "<-", "*", "types", ".", "Response", ")", "{", "var", "count", "int", "\n", "var", "bufReader", ...
// Read requests from conn and deal with them
[ "Read", "requests", "from", "conn", "and", "deal", "with", "them" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/server/socket_server.go#L146-L166
131,253
tendermint/tendermint
abci/server/socket_server.go
handleResponses
func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) { var count int var bufWriter = bufio.NewWriter(conn) for { var res = <-responses err := types.WriteMessage(res, bufWriter) if err != nil { closeConn <- fmt.Errorf("Error writing message: %v", err.E...
go
func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) { var count int var bufWriter = bufio.NewWriter(conn) for { var res = <-responses err := types.WriteMessage(res, bufWriter) if err != nil { closeConn <- fmt.Errorf("Error writing message: %v", err.E...
[ "func", "(", "s", "*", "SocketServer", ")", "handleResponses", "(", "closeConn", "chan", "error", ",", "conn", "net", ".", "Conn", ",", "responses", "<-", "chan", "*", "types", ".", "Response", ")", "{", "var", "count", "int", "\n", "var", "bufWriter", ...
// Pull responses from 'responses' and write them to conn.
[ "Pull", "responses", "from", "responses", "and", "write", "them", "to", "conn", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/server/socket_server.go#L207-L226
131,254
tendermint/tendermint
lite/dynamic_verifier.go
updateToHeight
func (dv *DynamicVerifier) updateToHeight(h int64) (FullCommit, error) { // Fetch latest full commit from source. sourceFC, err := dv.source.LatestFullCommit(dv.chainID, h, h) if err != nil { return FullCommit{}, err } // If sourceFC.Height() != h, we can't do it. if sourceFC.Height() != h { return FullComm...
go
func (dv *DynamicVerifier) updateToHeight(h int64) (FullCommit, error) { // Fetch latest full commit from source. sourceFC, err := dv.source.LatestFullCommit(dv.chainID, h, h) if err != nil { return FullCommit{}, err } // If sourceFC.Height() != h, we can't do it. if sourceFC.Height() != h { return FullComm...
[ "func", "(", "dv", "*", "DynamicVerifier", ")", "updateToHeight", "(", "h", "int64", ")", "(", "FullCommit", ",", "error", ")", "{", "// Fetch latest full commit from source.", "sourceFC", ",", "err", ":=", "dv", ".", "source", ".", "LatestFullCommit", "(", "d...
// updateToHeight will use divide-and-conquer to find a path to h. // Returns nil error iff we successfully verify and persist a full commit // for height h, using repeated applications of bisection if necessary. // // Returns ErrCommitNotFound if source provider doesn't have the commit for h.
[ "updateToHeight", "will", "use", "divide", "-", "and", "-", "conquer", "to", "find", "a", "path", "to", "h", ".", "Returns", "nil", "error", "iff", "we", "successfully", "verify", "and", "persist", "a", "full", "commit", "for", "height", "h", "using", "r...
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/dynamic_verifier.go#L211-L267
131,255
tendermint/tendermint
libs/pubsub/query/query.go
New
func New(s string) (*Query, error) { p := &QueryParser{Buffer: fmt.Sprintf(`"%s"`, s)} p.Init() if err := p.Parse(); err != nil { return nil, err } return &Query{str: s, parser: p}, nil }
go
func New(s string) (*Query, error) { p := &QueryParser{Buffer: fmt.Sprintf(`"%s"`, s)} p.Init() if err := p.Parse(); err != nil { return nil, err } return &Query{str: s, parser: p}, nil }
[ "func", "New", "(", "s", "string", ")", "(", "*", "Query", ",", "error", ")", "{", "p", ":=", "&", "QueryParser", "{", "Buffer", ":", "fmt", ".", "Sprintf", "(", "`\"%s\"`", ",", "s", ")", "}", "\n", "p", ".", "Init", "(", ")", "\n", "if", "e...
// New parses the given string and returns a query or error if the string is // invalid.
[ "New", "parses", "the", "given", "string", "and", "returns", "a", "query", "or", "error", "if", "the", "string", "is", "invalid", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/query/query.go#L35-L42
131,256
tendermint/tendermint
libs/pubsub/query/query.go
MustParse
func MustParse(s string) *Query { q, err := New(s) if err != nil { panic(fmt.Sprintf("failed to parse %s: %v", s, err)) } return q }
go
func MustParse(s string) *Query { q, err := New(s) if err != nil { panic(fmt.Sprintf("failed to parse %s: %v", s, err)) } return q }
[ "func", "MustParse", "(", "s", "string", ")", "*", "Query", "{", "q", ",", "err", ":=", "New", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ",", "err", ")", ")", "\n", "...
// MustParse turns the given string into a query or panics; for tests or others // cases where you know the string is valid.
[ "MustParse", "turns", "the", "given", "string", "into", "a", "query", "or", "panics", ";", "for", "tests", "or", "others", "cases", "where", "you", "know", "the", "string", "is", "valid", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/query/query.go#L46-L52
131,257
tendermint/tendermint
libs/pubsub/pubsub.go
SubscribeUnbuffered
func (s *Server) SubscribeUnbuffered(ctx context.Context, clientID string, query Query) (*Subscription, error) { return s.subscribe(ctx, clientID, query, 0) }
go
func (s *Server) SubscribeUnbuffered(ctx context.Context, clientID string, query Query) (*Subscription, error) { return s.subscribe(ctx, clientID, query, 0) }
[ "func", "(", "s", "*", "Server", ")", "SubscribeUnbuffered", "(", "ctx", "context", ".", "Context", ",", "clientID", "string", ",", "query", "Query", ")", "(", "*", "Subscription", ",", "error", ")", "{", "return", "s", ".", "subscribe", "(", "ctx", ",...
// SubscribeUnbuffered does the same as Subscribe, except it returns a // subscription with unbuffered channel. Use with caution as it can freeze the // server.
[ "SubscribeUnbuffered", "does", "the", "same", "as", "Subscribe", "except", "it", "returns", "a", "subscription", "with", "unbuffered", "channel", ".", "Use", "with", "caution", "as", "it", "can", "freeze", "the", "server", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/pubsub.go#L159-L161
131,258
tendermint/tendermint
libs/pubsub/pubsub.go
Unsubscribe
func (s *Server) Unsubscribe(ctx context.Context, clientID string, query Query) error { s.mtx.RLock() clientSubscriptions, ok := s.subscriptions[clientID] if ok { _, ok = clientSubscriptions[query.String()] } s.mtx.RUnlock() if !ok { return ErrSubscriptionNotFound } select { case s.cmds <- cmd{op: unsub, ...
go
func (s *Server) Unsubscribe(ctx context.Context, clientID string, query Query) error { s.mtx.RLock() clientSubscriptions, ok := s.subscriptions[clientID] if ok { _, ok = clientSubscriptions[query.String()] } s.mtx.RUnlock() if !ok { return ErrSubscriptionNotFound } select { case s.cmds <- cmd{op: unsub, ...
[ "func", "(", "s", "*", "Server", ")", "Unsubscribe", "(", "ctx", "context", ".", "Context", ",", "clientID", "string", ",", "query", "Query", ")", "error", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "clientSubscriptions", ",", "ok", ":=", "s...
// Unsubscribe removes the subscription on the given query. An error will be // returned to the caller if the context is canceled or if subscription does // not exist.
[ "Unsubscribe", "removes", "the", "subscription", "on", "the", "given", "query", ".", "An", "error", "will", "be", "returned", "to", "the", "caller", "if", "the", "context", "is", "canceled", "or", "if", "subscription", "does", "not", "exist", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/pubsub.go#L194-L219
131,259
tendermint/tendermint
libs/pubsub/pubsub.go
UnsubscribeAll
func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error { s.mtx.RLock() _, ok := s.subscriptions[clientID] s.mtx.RUnlock() if !ok { return ErrSubscriptionNotFound } select { case s.cmds <- cmd{op: unsub, clientID: clientID}: s.mtx.Lock() delete(s.subscriptions, clientID) s.mtx.Unlock...
go
func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error { s.mtx.RLock() _, ok := s.subscriptions[clientID] s.mtx.RUnlock() if !ok { return ErrSubscriptionNotFound } select { case s.cmds <- cmd{op: unsub, clientID: clientID}: s.mtx.Lock() delete(s.subscriptions, clientID) s.mtx.Unlock...
[ "func", "(", "s", "*", "Server", ")", "UnsubscribeAll", "(", "ctx", "context", ".", "Context", ",", "clientID", "string", ")", "error", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "_", ",", "ok", ":=", "s", ".", "subscriptions", "[", "clien...
// UnsubscribeAll removes all client subscriptions. An error will be returned // to the caller if the context is canceled or if subscription does not exist.
[ "UnsubscribeAll", "removes", "all", "client", "subscriptions", ".", "An", "error", "will", "be", "returned", "to", "the", "caller", "if", "the", "context", "is", "canceled", "or", "if", "subscription", "does", "not", "exist", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/pubsub.go#L223-L242
131,260
tendermint/tendermint
libs/pubsub/pubsub.go
NumClients
func (s *Server) NumClients() int { s.mtx.RLock() defer s.mtx.RUnlock() return len(s.subscriptions) }
go
func (s *Server) NumClients() int { s.mtx.RLock() defer s.mtx.RUnlock() return len(s.subscriptions) }
[ "func", "(", "s", "*", "Server", ")", "NumClients", "(", ")", "int", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "len", "(", "s", ".", "subscriptions", ")", "\n", "}" ]
// NumClients returns the number of clients.
[ "NumClients", "returns", "the", "number", "of", "clients", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/pubsub.go#L245-L249
131,261
tendermint/tendermint
libs/pubsub/pubsub.go
NumClientSubscriptions
func (s *Server) NumClientSubscriptions(clientID string) int { s.mtx.RLock() defer s.mtx.RUnlock() return len(s.subscriptions[clientID]) }
go
func (s *Server) NumClientSubscriptions(clientID string) int { s.mtx.RLock() defer s.mtx.RUnlock() return len(s.subscriptions[clientID]) }
[ "func", "(", "s", "*", "Server", ")", "NumClientSubscriptions", "(", "clientID", "string", ")", "int", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "len", "(", "s", ".", "...
// NumClientSubscriptions returns the number of subscriptions the client has.
[ "NumClientSubscriptions", "returns", "the", "number", "of", "subscriptions", "the", "client", "has", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/pubsub/pubsub.go#L252-L256
131,262
tendermint/tendermint
libs/fail/fail.go
FailRand
func FailRand(n int) { if callIndexToFail < 0 { return } if callRandIndexToFail < 0 { // first call in the loop, pick a random index to fail at callRandIndexToFail = rand.Intn(n) callRandIndex = 0 } if callIndex == callIndexToFail { if callRandIndex == callRandIndexToFail { Exit() } } callRandI...
go
func FailRand(n int) { if callIndexToFail < 0 { return } if callRandIndexToFail < 0 { // first call in the loop, pick a random index to fail at callRandIndexToFail = rand.Intn(n) callRandIndex = 0 } if callIndex == callIndexToFail { if callRandIndex == callRandIndexToFail { Exit() } } callRandI...
[ "func", "FailRand", "(", "n", "int", ")", "{", "if", "callIndexToFail", "<", "0", "{", "return", "\n", "}", "\n\n", "if", "callRandIndexToFail", "<", "0", "{", "// first call in the loop, pick a random index to fail at", "callRandIndexToFail", "=", "rand", ".", "I...
// FailRand should be called n successive times. // It will fail on a random one of those calls // n must be greater than 0
[ "FailRand", "should", "be", "called", "n", "successive", "times", ".", "It", "will", "fail", "on", "a", "random", "one", "of", "those", "calls", "n", "must", "be", "greater", "than", "0" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/fail/fail.go#L49-L71
131,263
tendermint/tendermint
privval/file_deprecated.go
LoadOldFilePV
func LoadOldFilePV(filePath string) (*OldFilePV, error) { pvJSONBytes, err := ioutil.ReadFile(filePath) if err != nil { return nil, err } pv := &OldFilePV{} err = cdc.UnmarshalJSON(pvJSONBytes, &pv) if err != nil { return nil, err } // overwrite pubkey and address for convenience pv.PubKey = pv.PrivKey.Pu...
go
func LoadOldFilePV(filePath string) (*OldFilePV, error) { pvJSONBytes, err := ioutil.ReadFile(filePath) if err != nil { return nil, err } pv := &OldFilePV{} err = cdc.UnmarshalJSON(pvJSONBytes, &pv) if err != nil { return nil, err } // overwrite pubkey and address for convenience pv.PubKey = pv.PrivKey.Pu...
[ "func", "LoadOldFilePV", "(", "filePath", "string", ")", "(", "*", "OldFilePV", ",", "error", ")", "{", "pvJSONBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filePath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// LoadOldFilePV loads an OldFilePV from the filePath.
[ "LoadOldFilePV", "loads", "an", "OldFilePV", "from", "the", "filePath", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/file_deprecated.go#L28-L45
131,264
tendermint/tendermint
privval/file_deprecated.go
Upgrade
func (oldFilePV *OldFilePV) Upgrade(keyFilePath, stateFilePath string) *FilePV { privKey := oldFilePV.PrivKey pvKey := FilePVKey{ PrivKey: privKey, PubKey: privKey.PubKey(), Address: privKey.PubKey().Address(), filePath: keyFilePath, } pvState := FilePVLastSignState{ Height: oldFilePV.LastHeight, ...
go
func (oldFilePV *OldFilePV) Upgrade(keyFilePath, stateFilePath string) *FilePV { privKey := oldFilePV.PrivKey pvKey := FilePVKey{ PrivKey: privKey, PubKey: privKey.PubKey(), Address: privKey.PubKey().Address(), filePath: keyFilePath, } pvState := FilePVLastSignState{ Height: oldFilePV.LastHeight, ...
[ "func", "(", "oldFilePV", "*", "OldFilePV", ")", "Upgrade", "(", "keyFilePath", ",", "stateFilePath", "string", ")", "*", "FilePV", "{", "privKey", ":=", "oldFilePV", ".", "PrivKey", "\n", "pvKey", ":=", "FilePVKey", "{", "PrivKey", ":", "privKey", ",", "P...
// Upgrade convets the OldFilePV to the new FilePV, separating the immutable and mutable components, // and persisting them to the keyFilePath and stateFilePath, respectively. // It renames the original file by adding ".bak".
[ "Upgrade", "convets", "the", "OldFilePV", "to", "the", "new", "FilePV", "separating", "the", "immutable", "and", "mutable", "components", "and", "persisting", "them", "to", "the", "keyFilePath", "and", "stateFilePath", "respectively", ".", "It", "renames", "the", ...
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/file_deprecated.go#L50-L81
131,265
tendermint/tendermint
lite/helpers.go
genPrivKeys
func genPrivKeys(n int) privKeys { res := make(privKeys, n) for i := range res { res[i] = ed25519.GenPrivKey() } return res }
go
func genPrivKeys(n int) privKeys { res := make(privKeys, n) for i := range res { res[i] = ed25519.GenPrivKey() } return res }
[ "func", "genPrivKeys", "(", "n", "int", ")", "privKeys", "{", "res", ":=", "make", "(", "privKeys", ",", "n", ")", "\n", "for", "i", ":=", "range", "res", "{", "res", "[", "i", "]", "=", "ed25519", ".", "GenPrivKey", "(", ")", "\n", "}", "\n", ...
// genPrivKeys produces an array of private keys to generate commits.
[ "genPrivKeys", "produces", "an", "array", "of", "private", "keys", "to", "generate", "commits", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/helpers.go#L22-L28
131,266
tendermint/tendermint
lite/helpers.go
Change
func (pkz privKeys) Change(i int) privKeys { res := make(privKeys, len(pkz)) copy(res, pkz) res[i] = ed25519.GenPrivKey() return res }
go
func (pkz privKeys) Change(i int) privKeys { res := make(privKeys, len(pkz)) copy(res, pkz) res[i] = ed25519.GenPrivKey() return res }
[ "func", "(", "pkz", "privKeys", ")", "Change", "(", "i", "int", ")", "privKeys", "{", "res", ":=", "make", "(", "privKeys", ",", "len", "(", "pkz", ")", ")", "\n", "copy", "(", "res", ",", "pkz", ")", "\n", "res", "[", "i", "]", "=", "ed25519",...
// Change replaces the key at index i.
[ "Change", "replaces", "the", "key", "at", "index", "i", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/helpers.go#L31-L36
131,267
tendermint/tendermint
lite/helpers.go
GenSecpPrivKeys
func GenSecpPrivKeys(n int) privKeys { res := make(privKeys, n) for i := range res { res[i] = secp256k1.GenPrivKey() } return res }
go
func GenSecpPrivKeys(n int) privKeys { res := make(privKeys, n) for i := range res { res[i] = secp256k1.GenPrivKey() } return res }
[ "func", "GenSecpPrivKeys", "(", "n", "int", ")", "privKeys", "{", "res", ":=", "make", "(", "privKeys", ",", "n", ")", "\n", "for", "i", ":=", "range", "res", "{", "res", "[", "i", "]", "=", "secp256k1", ".", "GenPrivKey", "(", ")", "\n", "}", "\...
// GenSecpPrivKeys produces an array of secp256k1 private keys to generate commits.
[ "GenSecpPrivKeys", "produces", "an", "array", "of", "secp256k1", "private", "keys", "to", "generate", "commits", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/helpers.go#L45-L51
131,268
tendermint/tendermint
lite/helpers.go
signHeader
func (pkz privKeys) signHeader(header *types.Header, first, last int) *types.Commit { commitSigs := make([]*types.CommitSig, len(pkz)) // We need this list to keep the ordering. vset := pkz.ToValidators(1, 0) // Fill in the votes we want. for i := first; i < last && i < len(pkz); i++ { vote := makeVote(header,...
go
func (pkz privKeys) signHeader(header *types.Header, first, last int) *types.Commit { commitSigs := make([]*types.CommitSig, len(pkz)) // We need this list to keep the ordering. vset := pkz.ToValidators(1, 0) // Fill in the votes we want. for i := first; i < last && i < len(pkz); i++ { vote := makeVote(header,...
[ "func", "(", "pkz", "privKeys", ")", "signHeader", "(", "header", "*", "types", ".", "Header", ",", "first", ",", "last", "int", ")", "*", "types", ".", "Commit", "{", "commitSigs", ":=", "make", "(", "[", "]", "*", "types", ".", "CommitSig", ",", ...
// signHeader properly signs the header with all keys from first to last exclusive.
[ "signHeader", "properly", "signs", "the", "header", "with", "all", "keys", "from", "first", "to", "last", "exclusive", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/helpers.go#L72-L85
131,269
tendermint/tendermint
lite/helpers.go
GenFullCommit
func (pkz privKeys) GenFullCommit(chainID string, height int64, txs types.Txs, valset, nextValset *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) FullCommit { header := genHeader(chainID, height, txs, valset, nextValset, appHash, consHash, resHash) commit := types.SignedHeader{ Header: he...
go
func (pkz privKeys) GenFullCommit(chainID string, height int64, txs types.Txs, valset, nextValset *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) FullCommit { header := genHeader(chainID, height, txs, valset, nextValset, appHash, consHash, resHash) commit := types.SignedHeader{ Header: he...
[ "func", "(", "pkz", "privKeys", ")", "GenFullCommit", "(", "chainID", "string", ",", "height", "int64", ",", "txs", "types", ".", "Txs", ",", "valset", ",", "nextValset", "*", "types", ".", "ValidatorSet", ",", "appHash", ",", "consHash", ",", "resHash", ...
// GenFullCommit calls genHeader and signHeader and combines them into a FullCommit.
[ "GenFullCommit", "calls", "genHeader", "and", "signHeader", "and", "combines", "them", "into", "a", "FullCommit", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/helpers.go#L144-L153
131,270
tendermint/tendermint
rpc/core/dev.go
UnsafeFlushMempool
func UnsafeFlushMempool(ctx *rpctypes.Context) (*ctypes.ResultUnsafeFlushMempool, error) { mempool.Flush() return &ctypes.ResultUnsafeFlushMempool{}, nil }
go
func UnsafeFlushMempool(ctx *rpctypes.Context) (*ctypes.ResultUnsafeFlushMempool, error) { mempool.Flush() return &ctypes.ResultUnsafeFlushMempool{}, nil }
[ "func", "UnsafeFlushMempool", "(", "ctx", "*", "rpctypes", ".", "Context", ")", "(", "*", "ctypes", ".", "ResultUnsafeFlushMempool", ",", "error", ")", "{", "mempool", ".", "Flush", "(", ")", "\n", "return", "&", "ctypes", ".", "ResultUnsafeFlushMempool", "{...
// UnsafeFlushMempool removes all transactions from the mempool.
[ "UnsafeFlushMempool", "removes", "all", "transactions", "from", "the", "mempool", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/core/dev.go#L12-L15
131,271
tendermint/tendermint
rpc/core/dev.go
UnsafeStartCPUProfiler
func UnsafeStartCPUProfiler(ctx *rpctypes.Context, filename string) (*ctypes.ResultUnsafeProfile, error) { var err error profFile, err = os.Create(filename) if err != nil { return nil, err } err = pprof.StartCPUProfile(profFile) if err != nil { return nil, err } return &ctypes.ResultUnsafeProfile{}, nil }
go
func UnsafeStartCPUProfiler(ctx *rpctypes.Context, filename string) (*ctypes.ResultUnsafeProfile, error) { var err error profFile, err = os.Create(filename) if err != nil { return nil, err } err = pprof.StartCPUProfile(profFile) if err != nil { return nil, err } return &ctypes.ResultUnsafeProfile{}, nil }
[ "func", "UnsafeStartCPUProfiler", "(", "ctx", "*", "rpctypes", ".", "Context", ",", "filename", "string", ")", "(", "*", "ctypes", ".", "ResultUnsafeProfile", ",", "error", ")", "{", "var", "err", "error", "\n", "profFile", ",", "err", "=", "os", ".", "C...
// UnsafeStartCPUProfiler starts a pprof profiler using the given filename.
[ "UnsafeStartCPUProfiler", "starts", "a", "pprof", "profiler", "using", "the", "given", "filename", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/core/dev.go#L20-L31
131,272
tendermint/tendermint
rpc/core/dev.go
UnsafeStopCPUProfiler
func UnsafeStopCPUProfiler(ctx *rpctypes.Context) (*ctypes.ResultUnsafeProfile, error) { pprof.StopCPUProfile() if err := profFile.Close(); err != nil { return nil, err } return &ctypes.ResultUnsafeProfile{}, nil }
go
func UnsafeStopCPUProfiler(ctx *rpctypes.Context) (*ctypes.ResultUnsafeProfile, error) { pprof.StopCPUProfile() if err := profFile.Close(); err != nil { return nil, err } return &ctypes.ResultUnsafeProfile{}, nil }
[ "func", "UnsafeStopCPUProfiler", "(", "ctx", "*", "rpctypes", ".", "Context", ")", "(", "*", "ctypes", ".", "ResultUnsafeProfile", ",", "error", ")", "{", "pprof", ".", "StopCPUProfile", "(", ")", "\n", "if", "err", ":=", "profFile", ".", "Close", "(", "...
// UnsafeStopCPUProfiler stops the running pprof profiler.
[ "UnsafeStopCPUProfiler", "stops", "the", "running", "pprof", "profiler", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/core/dev.go#L34-L40
131,273
tendermint/tendermint
rpc/core/dev.go
UnsafeWriteHeapProfile
func UnsafeWriteHeapProfile(ctx *rpctypes.Context, filename string) (*ctypes.ResultUnsafeProfile, error) { memProfFile, err := os.Create(filename) if err != nil { return nil, err } if err := pprof.WriteHeapProfile(memProfFile); err != nil { return nil, err } if err := memProfFile.Close(); err != nil { retur...
go
func UnsafeWriteHeapProfile(ctx *rpctypes.Context, filename string) (*ctypes.ResultUnsafeProfile, error) { memProfFile, err := os.Create(filename) if err != nil { return nil, err } if err := pprof.WriteHeapProfile(memProfFile); err != nil { return nil, err } if err := memProfFile.Close(); err != nil { retur...
[ "func", "UnsafeWriteHeapProfile", "(", "ctx", "*", "rpctypes", ".", "Context", ",", "filename", "string", ")", "(", "*", "ctypes", ".", "ResultUnsafeProfile", ",", "error", ")", "{", "memProfFile", ",", "err", ":=", "os", ".", "Create", "(", "filename", ")...
// UnsafeWriteHeapProfile dumps a heap profile to the given filename.
[ "UnsafeWriteHeapProfile", "dumps", "a", "heap", "profile", "to", "the", "given", "filename", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/core/dev.go#L43-L56
131,274
tendermint/tendermint
lite/multiprovider.go
NewMultiProvider
func NewMultiProvider(providers ...PersistentProvider) *multiProvider { return &multiProvider{ logger: log.NewNopLogger(), providers: providers, } }
go
func NewMultiProvider(providers ...PersistentProvider) *multiProvider { return &multiProvider{ logger: log.NewNopLogger(), providers: providers, } }
[ "func", "NewMultiProvider", "(", "providers", "...", "PersistentProvider", ")", "*", "multiProvider", "{", "return", "&", "multiProvider", "{", "logger", ":", "log", ".", "NewNopLogger", "(", ")", ",", "providers", ":", "providers", ",", "}", "\n", "}" ]
// NewMultiProvider returns a new provider which wraps multiple other providers.
[ "NewMultiProvider", "returns", "a", "new", "provider", "which", "wraps", "multiple", "other", "providers", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/multiprovider.go#L19-L24
131,275
tendermint/tendermint
lite/multiprovider.go
SetLogger
func (mc *multiProvider) SetLogger(logger log.Logger) { mc.logger = logger for _, p := range mc.providers { p.SetLogger(logger) } }
go
func (mc *multiProvider) SetLogger(logger log.Logger) { mc.logger = logger for _, p := range mc.providers { p.SetLogger(logger) } }
[ "func", "(", "mc", "*", "multiProvider", ")", "SetLogger", "(", "logger", "log", ".", "Logger", ")", "{", "mc", ".", "logger", "=", "logger", "\n", "for", "_", ",", "p", ":=", "range", "mc", ".", "providers", "{", "p", ".", "SetLogger", "(", "logge...
// SetLogger sets logger on self and all subproviders.
[ "SetLogger", "sets", "logger", "on", "self", "and", "all", "subproviders", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/multiprovider.go#L27-L32
131,276
tendermint/tendermint
lite/multiprovider.go
SaveFullCommit
func (mc *multiProvider) SaveFullCommit(fc FullCommit) (err error) { for _, p := range mc.providers { err = p.SaveFullCommit(fc) if err != nil { return } } return }
go
func (mc *multiProvider) SaveFullCommit(fc FullCommit) (err error) { for _, p := range mc.providers { err = p.SaveFullCommit(fc) if err != nil { return } } return }
[ "func", "(", "mc", "*", "multiProvider", ")", "SaveFullCommit", "(", "fc", "FullCommit", ")", "(", "err", "error", ")", "{", "for", "_", ",", "p", ":=", "range", "mc", ".", "providers", "{", "err", "=", "p", ".", "SaveFullCommit", "(", "fc", ")", "...
// SaveFullCommit saves on all providers, and aborts on the first error.
[ "SaveFullCommit", "saves", "on", "all", "providers", "and", "aborts", "on", "the", "first", "error", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/multiprovider.go#L35-L43
131,277
tendermint/tendermint
lite/multiprovider.go
ValidatorSet
func (mc *multiProvider) ValidatorSet(chainID string, height int64) (valset *types.ValidatorSet, err error) { for _, p := range mc.providers { valset, err = p.ValidatorSet(chainID, height) if err == nil { // TODO Log unexpected types of errors. return valset, nil } } return nil, lerr.ErrUnknownValidators...
go
func (mc *multiProvider) ValidatorSet(chainID string, height int64) (valset *types.ValidatorSet, err error) { for _, p := range mc.providers { valset, err = p.ValidatorSet(chainID, height) if err == nil { // TODO Log unexpected types of errors. return valset, nil } } return nil, lerr.ErrUnknownValidators...
[ "func", "(", "mc", "*", "multiProvider", ")", "ValidatorSet", "(", "chainID", "string", ",", "height", "int64", ")", "(", "valset", "*", "types", ".", "ValidatorSet", ",", "err", "error", ")", "{", "for", "_", ",", "p", ":=", "range", "mc", ".", "pro...
// ValidatorSet returns validator set at height as provided by the first // provider which has it, or an error otherwise.
[ "ValidatorSet", "returns", "validator", "set", "at", "height", "as", "provided", "by", "the", "first", "provider", "which", "has", "it", "or", "an", "error", "otherwise", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/multiprovider.go#L76-L85
131,278
tendermint/tendermint
rpc/lib/client/ws_client.go
ReadWait
func ReadWait(readWait time.Duration) func(*WSClient) { return func(c *WSClient) { c.readWait = readWait } }
go
func ReadWait(readWait time.Duration) func(*WSClient) { return func(c *WSClient) { c.readWait = readWait } }
[ "func", "ReadWait", "(", "readWait", "time", ".", "Duration", ")", "func", "(", "*", "WSClient", ")", "{", "return", "func", "(", "c", "*", "WSClient", ")", "{", "c", ".", "readWait", "=", "readWait", "\n", "}", "\n", "}" ]
// ReadWait sets the amount of time to wait before a websocket read times out. // It should only be used in the constructor and is not Goroutine-safe.
[ "ReadWait", "sets", "the", "amount", "of", "time", "to", "wait", "before", "a", "websocket", "read", "times", "out", ".", "It", "should", "only", "be", "used", "in", "the", "constructor", "and", "is", "not", "Goroutine", "-", "safe", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L118-L122
131,279
tendermint/tendermint
rpc/lib/client/ws_client.go
WriteWait
func WriteWait(writeWait time.Duration) func(*WSClient) { return func(c *WSClient) { c.writeWait = writeWait } }
go
func WriteWait(writeWait time.Duration) func(*WSClient) { return func(c *WSClient) { c.writeWait = writeWait } }
[ "func", "WriteWait", "(", "writeWait", "time", ".", "Duration", ")", "func", "(", "*", "WSClient", ")", "{", "return", "func", "(", "c", "*", "WSClient", ")", "{", "c", ".", "writeWait", "=", "writeWait", "\n", "}", "\n", "}" ]
// WriteWait sets the amount of time to wait before a websocket write times out. // It should only be used in the constructor and is not Goroutine-safe.
[ "WriteWait", "sets", "the", "amount", "of", "time", "to", "wait", "before", "a", "websocket", "write", "times", "out", ".", "It", "should", "only", "be", "used", "in", "the", "constructor", "and", "is", "not", "Goroutine", "-", "safe", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L126-L130
131,280
tendermint/tendermint
rpc/lib/client/ws_client.go
String
func (c *WSClient) String() string { return fmt.Sprintf("%s (%s)", c.Address, c.Endpoint) }
go
func (c *WSClient) String() string { return fmt.Sprintf("%s (%s)", c.Address, c.Endpoint) }
[ "func", "(", "c", "*", "WSClient", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Address", ",", "c", ".", "Endpoint", ")", "\n", "}" ]
// String returns WS client full address.
[ "String", "returns", "WS", "client", "full", "address", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L149-L151
131,281
tendermint/tendermint
rpc/lib/client/ws_client.go
OnStart
func (c *WSClient) OnStart() error { err := c.dial() if err != nil { return err } c.ResponsesCh = make(chan types.RPCResponse) c.send = make(chan types.RPCRequest) // 1 additional error may come from the read/write // goroutine depending on which failed first. c.reconnectAfter = make(chan error, 1) // capa...
go
func (c *WSClient) OnStart() error { err := c.dial() if err != nil { return err } c.ResponsesCh = make(chan types.RPCResponse) c.send = make(chan types.RPCRequest) // 1 additional error may come from the read/write // goroutine depending on which failed first. c.reconnectAfter = make(chan error, 1) // capa...
[ "func", "(", "c", "*", "WSClient", ")", "OnStart", "(", ")", "error", "{", "err", ":=", "c", ".", "dial", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "c", ".", "ResponsesCh", "=", "make", "(", "chan", "typ...
// OnStart implements cmn.Service by dialing a server and creating read and // write routines.
[ "OnStart", "implements", "cmn", ".", "Service", "by", "dialing", "a", "server", "and", "creating", "read", "and", "write", "routines", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L155-L175
131,282
tendermint/tendermint
rpc/lib/client/ws_client.go
IsReconnecting
func (c *WSClient) IsReconnecting() bool { c.mtx.RLock() defer c.mtx.RUnlock() return c.reconnecting }
go
func (c *WSClient) IsReconnecting() bool { c.mtx.RLock() defer c.mtx.RUnlock() return c.reconnecting }
[ "func", "(", "c", "*", "WSClient", ")", "IsReconnecting", "(", ")", "bool", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "reconnecting", "\n", "}" ]
// IsReconnecting returns true if the client is reconnecting right now.
[ "IsReconnecting", "returns", "true", "if", "the", "client", "is", "reconnecting", "right", "now", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L191-L195
131,283
tendermint/tendermint
rpc/lib/client/ws_client.go
Send
func (c *WSClient) Send(ctx context.Context, request types.RPCRequest) error { select { case c.send <- request: c.Logger.Info("sent a request", "req", request) return nil case <-ctx.Done(): return ctx.Err() } }
go
func (c *WSClient) Send(ctx context.Context, request types.RPCRequest) error { select { case c.send <- request: c.Logger.Info("sent a request", "req", request) return nil case <-ctx.Done(): return ctx.Err() } }
[ "func", "(", "c", "*", "WSClient", ")", "Send", "(", "ctx", "context", ".", "Context", ",", "request", "types", ".", "RPCRequest", ")", "error", "{", "select", "{", "case", "c", ".", "send", "<-", "request", ":", "c", ".", "Logger", ".", "Info", "(...
// Send the given RPC request to the server. Results will be available on // ResponsesCh, errors, if any, on ErrorsCh. Will block until send succeeds or // ctx.Done is closed.
[ "Send", "the", "given", "RPC", "request", "to", "the", "server", ".", "Results", "will", "be", "available", "on", "ResponsesCh", "errors", "if", "any", "on", "ErrorsCh", ".", "Will", "block", "until", "send", "succeeds", "or", "ctx", ".", "Done", "is", "...
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L205-L213
131,284
tendermint/tendermint
rpc/lib/client/ws_client.go
Call
func (c *WSClient) Call(ctx context.Context, method string, params map[string]interface{}) error { request, err := types.MapToRequest(c.cdc, types.JSONRPCStringID("ws-client"), method, params) if err != nil { return err } return c.Send(ctx, request) }
go
func (c *WSClient) Call(ctx context.Context, method string, params map[string]interface{}) error { request, err := types.MapToRequest(c.cdc, types.JSONRPCStringID("ws-client"), method, params) if err != nil { return err } return c.Send(ctx, request) }
[ "func", "(", "c", "*", "WSClient", ")", "Call", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "params", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "request", ",", "err", ":=", "types", ".", "MapToReque...
// Call the given method. See Send description.
[ "Call", "the", "given", "method", ".", "See", "Send", "description", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L216-L222
131,285
tendermint/tendermint
rpc/lib/client/ws_client.go
reconnect
func (c *WSClient) reconnect() error { attempt := 0 c.mtx.Lock() c.reconnecting = true c.mtx.Unlock() defer func() { c.mtx.Lock() c.reconnecting = false c.mtx.Unlock() }() for { jitterSeconds := time.Duration(cmn.RandFloat64() * float64(time.Second)) // 1s == (1e9 ns) backoffDuration := jitterSeconds...
go
func (c *WSClient) reconnect() error { attempt := 0 c.mtx.Lock() c.reconnecting = true c.mtx.Unlock() defer func() { c.mtx.Lock() c.reconnecting = false c.mtx.Unlock() }() for { jitterSeconds := time.Duration(cmn.RandFloat64() * float64(time.Second)) // 1s == (1e9 ns) backoffDuration := jitterSeconds...
[ "func", "(", "c", "*", "WSClient", ")", "reconnect", "(", ")", "error", "{", "attempt", ":=", "0", "\n\n", "c", ".", "mtx", ".", "Lock", "(", ")", "\n", "c", ".", "reconnecting", "=", "true", "\n", "c", ".", "mtx", ".", "Unlock", "(", ")", "\n"...
// reconnect tries to redial up to maxReconnectAttempts with exponential // backoff.
[ "reconnect", "tries", "to", "redial", "up", "to", "maxReconnectAttempts", "with", "exponential", "backoff", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L261-L297
131,286
tendermint/tendermint
rpc/lib/client/ws_client.go
writeRoutine
func (c *WSClient) writeRoutine() { var ticker *time.Ticker if c.pingPeriod > 0 { // ticker with a predefined period ticker = time.NewTicker(c.pingPeriod) } else { // ticker that never fires ticker = &time.Ticker{C: make(<-chan time.Time)} } defer func() { ticker.Stop() if err := c.conn.Close(); err !...
go
func (c *WSClient) writeRoutine() { var ticker *time.Ticker if c.pingPeriod > 0 { // ticker with a predefined period ticker = time.NewTicker(c.pingPeriod) } else { // ticker that never fires ticker = &time.Ticker{C: make(<-chan time.Time)} } defer func() { ticker.Stop() if err := c.conn.Close(); err !...
[ "func", "(", "c", "*", "WSClient", ")", "writeRoutine", "(", ")", "{", "var", "ticker", "*", "time", ".", "Ticker", "\n", "if", "c", ".", "pingPeriod", ">", "0", "{", "// ticker with a predefined period", "ticker", "=", "time", ".", "NewTicker", "(", "c"...
// The client ensures that there is at most one writer to a connection by // executing all writes from this goroutine.
[ "The", "client", "ensures", "that", "there", "is", "at", "most", "one", "writer", "to", "a", "connection", "by", "executing", "all", "writes", "from", "this", "goroutine", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L360-L418
131,287
tendermint/tendermint
rpc/lib/client/ws_client.go
readRoutine
func (c *WSClient) readRoutine() { defer func() { if err := c.conn.Close(); err != nil { // ignore error; it will trigger in tests // likely because it's closing an already closed connection } c.wg.Done() }() c.conn.SetPongHandler(func(string) error { // gather latency stats c.mtx.RLock() t := c.s...
go
func (c *WSClient) readRoutine() { defer func() { if err := c.conn.Close(); err != nil { // ignore error; it will trigger in tests // likely because it's closing an already closed connection } c.wg.Done() }() c.conn.SetPongHandler(func(string) error { // gather latency stats c.mtx.RLock() t := c.s...
[ "func", "(", "c", "*", "WSClient", ")", "readRoutine", "(", ")", "{", "defer", "func", "(", ")", "{", "if", "err", ":=", "c", ".", "conn", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "// ignore error; it will trigger in tests", "// likely becau...
// The client ensures that there is at most one reader to a connection by // executing all reads from this goroutine.
[ "The", "client", "ensures", "that", "there", "is", "at", "most", "one", "reader", "to", "a", "connection", "by", "executing", "all", "reads", "from", "this", "goroutine", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L422-L476
131,288
tendermint/tendermint
rpc/lib/client/ws_client.go
UnsubscribeAll
func (c *WSClient) UnsubscribeAll(ctx context.Context) error { params := map[string]interface{}{} return c.Call(ctx, "unsubscribe_all", params) }
go
func (c *WSClient) UnsubscribeAll(ctx context.Context) error { params := map[string]interface{}{} return c.Call(ctx, "unsubscribe_all", params) }
[ "func", "(", "c", "*", "WSClient", ")", "UnsubscribeAll", "(", "ctx", "context", ".", "Context", ")", "error", "{", "params", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "return", "c", ".", "Call", "(", "ctx", ",", "\"",...
// UnsubscribeAll from all. Note the server must have a "unsubscribe_all" route // defined.
[ "UnsubscribeAll", "from", "all", ".", "Note", "the", "server", "must", "have", "a", "unsubscribe_all", "route", "defined", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/rpc/lib/client/ws_client.go#L497-L500
131,289
tendermint/tendermint
crypto/tmhash/hash.go
SumTruncated
func SumTruncated(bz []byte) []byte { hash := sha256.Sum256(bz) return hash[:TruncatedSize] }
go
func SumTruncated(bz []byte) []byte { hash := sha256.Sum256(bz) return hash[:TruncatedSize] }
[ "func", "SumTruncated", "(", "bz", "[", "]", "byte", ")", "[", "]", "byte", "{", "hash", ":=", "sha256", ".", "Sum256", "(", "bz", ")", "\n", "return", "hash", "[", ":", "TruncatedSize", "]", "\n", "}" ]
// SumTruncated returns the first 20 bytes of SHA256 of the bz.
[ "SumTruncated", "returns", "the", "first", "20", "bytes", "of", "SHA256", "of", "the", "bz", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/tmhash/hash.go#L62-L65
131,290
tendermint/tendermint
types/proposal.go
NewProposal
func NewProposal(height int64, round int, polRound int, blockID BlockID) *Proposal { return &Proposal{ Type: ProposalType, Height: height, Round: round, BlockID: blockID, POLRound: polRound, Timestamp: tmtime.Now(), } }
go
func NewProposal(height int64, round int, polRound int, blockID BlockID) *Proposal { return &Proposal{ Type: ProposalType, Height: height, Round: round, BlockID: blockID, POLRound: polRound, Timestamp: tmtime.Now(), } }
[ "func", "NewProposal", "(", "height", "int64", ",", "round", "int", ",", "polRound", "int", ",", "blockID", "BlockID", ")", "*", "Proposal", "{", "return", "&", "Proposal", "{", "Type", ":", "ProposalType", ",", "Height", ":", "height", ",", "Round", ":"...
// NewProposal returns a new Proposal. // If there is no POLRound, polRound should be -1.
[ "NewProposal", "returns", "a", "new", "Proposal", ".", "If", "there", "is", "no", "POLRound", "polRound", "should", "be", "-", "1", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/proposal.go#L35-L44
131,291
tendermint/tendermint
types/proposal.go
String
func (p *Proposal) String() string { return fmt.Sprintf("Proposal{%v/%v (%v, %v) %X @ %s}", p.Height, p.Round, p.BlockID, p.POLRound, cmn.Fingerprint(p.Signature), CanonicalTime(p.Timestamp)) }
go
func (p *Proposal) String() string { return fmt.Sprintf("Proposal{%v/%v (%v, %v) %X @ %s}", p.Height, p.Round, p.BlockID, p.POLRound, cmn.Fingerprint(p.Signature), CanonicalTime(p.Timestamp)) }
[ "func", "(", "p", "*", "Proposal", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "Height", ",", "p", ".", "Round", ",", "p", ".", "BlockID", ",", "p", ".", "POLRound", ",", "cmn", ".", ...
// String returns a string representation of the Proposal.
[ "String", "returns", "a", "string", "representation", "of", "the", "Proposal", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/proposal.go#L80-L88
131,292
tendermint/tendermint
types/proposal.go
SignBytes
func (p *Proposal) SignBytes(chainID string) []byte { bz, err := cdc.MarshalBinaryLengthPrefixed(CanonicalizeProposal(chainID, p)) if err != nil { panic(err) } return bz }
go
func (p *Proposal) SignBytes(chainID string) []byte { bz, err := cdc.MarshalBinaryLengthPrefixed(CanonicalizeProposal(chainID, p)) if err != nil { panic(err) } return bz }
[ "func", "(", "p", "*", "Proposal", ")", "SignBytes", "(", "chainID", "string", ")", "[", "]", "byte", "{", "bz", ",", "err", ":=", "cdc", ".", "MarshalBinaryLengthPrefixed", "(", "CanonicalizeProposal", "(", "chainID", ",", "p", ")", ")", "\n", "if", "...
// SignBytes returns the Proposal bytes for signing
[ "SignBytes", "returns", "the", "Proposal", "bytes", "for", "signing" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/proposal.go#L91-L97
131,293
tendermint/tendermint
libs/flowrate/util.go
clockRound
func clockRound(d time.Duration) time.Duration { return (d + clockRate>>1) / clockRate * clockRate }
go
func clockRound(d time.Duration) time.Duration { return (d + clockRate>>1) / clockRate * clockRate }
[ "func", "clockRound", "(", "d", "time", ".", "Duration", ")", "time", ".", "Duration", "{", "return", "(", "d", "+", "clockRate", ">>", "1", ")", "/", "clockRate", "*", "clockRate", "\n", "}" ]
// clockRound returns d rounded to the nearest clockRate increment.
[ "clockRound", "returns", "d", "rounded", "to", "the", "nearest", "clockRate", "increment", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/util.go#L31-L33
131,294
tendermint/tendermint
libs/flowrate/util.go
percentOf
func percentOf(x, total float64) Percent { if x < 0 || total <= 0 { return 0 } else if p := round(x / total * 1e5); p <= math.MaxUint32 { return Percent(p) } return Percent(math.MaxUint32) }
go
func percentOf(x, total float64) Percent { if x < 0 || total <= 0 { return 0 } else if p := round(x / total * 1e5); p <= math.MaxUint32 { return Percent(p) } return Percent(math.MaxUint32) }
[ "func", "percentOf", "(", "x", ",", "total", "float64", ")", "Percent", "{", "if", "x", "<", "0", "||", "total", "<=", "0", "{", "return", "0", "\n", "}", "else", "if", "p", ":=", "round", "(", "x", "/", "total", "*", "1e5", ")", ";", "p", "<...
// percentOf calculates what percent of the total is x.
[ "percentOf", "calculates", "what", "percent", "of", "the", "total", "is", "x", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/flowrate/util.go#L47-L54
131,295
tendermint/tendermint
cmd/tendermint/commands/run_node.go
AddNodeFlags
func AddNodeFlags(cmd *cobra.Command) { // bind flags cmd.Flags().String("moniker", config.Moniker, "Node Name") // priv val flags cmd.Flags().String("priv_validator_laddr", config.PrivValidatorListenAddr, "Socket address to listen on for connections from external priv_validator process") // node flags cmd.Flag...
go
func AddNodeFlags(cmd *cobra.Command) { // bind flags cmd.Flags().String("moniker", config.Moniker, "Node Name") // priv val flags cmd.Flags().String("priv_validator_laddr", config.PrivValidatorListenAddr, "Socket address to listen on for connections from external priv_validator process") // node flags cmd.Flag...
[ "func", "AddNodeFlags", "(", "cmd", "*", "cobra", ".", "Command", ")", "{", "// bind flags", "cmd", ".", "Flags", "(", ")", ".", "String", "(", "\"", "\"", ",", "config", ".", "Moniker", ",", "\"", "\"", ")", "\n\n", "// priv val flags", "cmd", ".", ...
// AddNodeFlags exposes some common configuration options on the command-line // These are exposed for convenience of commands embedding a tendermint node
[ "AddNodeFlags", "exposes", "some", "common", "configuration", "options", "on", "the", "command", "-", "line", "These", "are", "exposed", "for", "convenience", "of", "commands", "embedding", "a", "tendermint", "node" ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/cmd/tendermint/commands/run_node.go#L14-L44
131,296
tendermint/tendermint
cmd/tendermint/commands/run_node.go
NewRunNodeCmd
func NewRunNodeCmd(nodeProvider nm.NodeProvider) *cobra.Command { cmd := &cobra.Command{ Use: "node", Short: "Run the tendermint node", RunE: func(cmd *cobra.Command, args []string) error { n, err := nodeProvider(config, logger) if err != nil { return fmt.Errorf("Failed to create node: %v", err) }...
go
func NewRunNodeCmd(nodeProvider nm.NodeProvider) *cobra.Command { cmd := &cobra.Command{ Use: "node", Short: "Run the tendermint node", RunE: func(cmd *cobra.Command, args []string) error { n, err := nodeProvider(config, logger) if err != nil { return fmt.Errorf("Failed to create node: %v", err) }...
[ "func", "NewRunNodeCmd", "(", "nodeProvider", "nm", ".", "NodeProvider", ")", "*", "cobra", ".", "Command", "{", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "RunE", ":", "func", "(", "...
// NewRunNodeCmd returns the command that allows the CLI to start a node. // It can be used with a custom PrivValidator and in-process ABCI application.
[ "NewRunNodeCmd", "returns", "the", "command", "that", "allows", "the", "CLI", "to", "start", "a", "node", ".", "It", "can", "be", "used", "with", "a", "custom", "PrivValidator", "and", "in", "-", "process", "ABCI", "application", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/cmd/tendermint/commands/run_node.go#L48-L77
131,297
tendermint/tendermint
cmd/tendermint/commands/reset_priv_validator.go
ResetAll
func ResetAll(dbDir, addrBookFile, privValKeyFile, privValStateFile string, logger log.Logger) { removeAddrBook(addrBookFile, logger) if err := os.RemoveAll(dbDir); err == nil { logger.Info("Removed all blockchain history", "dir", dbDir) } else { logger.Error("Error removing all blockchain history", "dir", dbDir...
go
func ResetAll(dbDir, addrBookFile, privValKeyFile, privValStateFile string, logger log.Logger) { removeAddrBook(addrBookFile, logger) if err := os.RemoveAll(dbDir); err == nil { logger.Info("Removed all blockchain history", "dir", dbDir) } else { logger.Error("Error removing all blockchain history", "dir", dbDir...
[ "func", "ResetAll", "(", "dbDir", ",", "addrBookFile", ",", "privValKeyFile", ",", "privValStateFile", "string", ",", "logger", "log", ".", "Logger", ")", "{", "removeAddrBook", "(", "addrBookFile", ",", "logger", ")", "\n", "if", "err", ":=", "os", ".", "...
// ResetAll removes address book files plus all data, and resets the privValdiator data. // Exported so other CLI tools can use it.
[ "ResetAll", "removes", "address", "book", "files", "plus", "all", "data", "and", "resets", "the", "privValdiator", "data", ".", "Exported", "so", "other", "CLI", "tools", "can", "use", "it", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/cmd/tendermint/commands/reset_priv_validator.go#L43-L53
131,298
tendermint/tendermint
tools/tm-monitor/rpc.go
RPCStatus
func RPCStatus(m *monitor.Monitor) interface{} { return func() (networkAndNodes, error) { return networkAndNodes{m.Network, m.Nodes}, nil } }
go
func RPCStatus(m *monitor.Monitor) interface{} { return func() (networkAndNodes, error) { return networkAndNodes{m.Network, m.Nodes}, nil } }
[ "func", "RPCStatus", "(", "m", "*", "monitor", ".", "Monitor", ")", "interface", "{", "}", "{", "return", "func", "(", ")", "(", "networkAndNodes", ",", "error", ")", "{", "return", "networkAndNodes", "{", "m", ".", "Network", ",", "m", ".", "Nodes", ...
// RPCStatus returns common statistics for the network and statistics per node.
[ "RPCStatus", "returns", "common", "statistics", "for", "the", "network", "and", "statistics", "per", "node", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/rpc.go#L44-L48
131,299
tendermint/tendermint
tools/tm-monitor/rpc.go
RPCNetworkStatus
func RPCNetworkStatus(m *monitor.Monitor) interface{} { return func() (*monitor.Network, error) { return m.Network, nil } }
go
func RPCNetworkStatus(m *monitor.Monitor) interface{} { return func() (*monitor.Network, error) { return m.Network, nil } }
[ "func", "RPCNetworkStatus", "(", "m", "*", "monitor", ".", "Monitor", ")", "interface", "{", "}", "{", "return", "func", "(", ")", "(", "*", "monitor", ".", "Network", ",", "error", ")", "{", "return", "m", ".", "Network", ",", "nil", "\n", "}", "\...
// RPCNetworkStatus returns common statistics for the network.
[ "RPCNetworkStatus", "returns", "common", "statistics", "for", "the", "network", "." ]
4253e67c07c69be6d7f7263ab03944ce30a9fc90
https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/rpc.go#L51-L55