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,100 | tendermint/tendermint | libs/bech32/bech32.go | DecodeAndConvert | func DecodeAndConvert(bech string) (string, []byte, error) {
hrp, data, err := bech32.Decode(bech)
if err != nil {
return "", nil, errors.Wrap(err, "decoding bech32 failed")
}
converted, err := bech32.ConvertBits(data, 5, 8, false)
if err != nil {
return "", nil, errors.Wrap(err, "decoding bech32 failed")
}
... | go | func DecodeAndConvert(bech string) (string, []byte, error) {
hrp, data, err := bech32.Decode(bech)
if err != nil {
return "", nil, errors.Wrap(err, "decoding bech32 failed")
}
converted, err := bech32.ConvertBits(data, 5, 8, false)
if err != nil {
return "", nil, errors.Wrap(err, "decoding bech32 failed")
}
... | [
"func",
"DecodeAndConvert",
"(",
"bech",
"string",
")",
"(",
"string",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"hrp",
",",
"data",
",",
"err",
":=",
"bech32",
".",
"Decode",
"(",
"bech",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | //DecodeAndConvert decodes a bech32 encoded string and converts to base64 encoded bytes | [
"DecodeAndConvert",
"decodes",
"a",
"bech32",
"encoded",
"string",
"and",
"converts",
"to",
"base64",
"encoded",
"bytes"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/bech32/bech32.go#L19-L29 |
131,101 | tendermint/tendermint | types/tx.go | Hash | func (txs Txs) Hash() []byte {
// These allocations will be removed once Txs is switched to [][]byte,
// ref #2603. This is because golang does not allow type casting slices without unsafe
txBzs := make([][]byte, len(txs))
for i := 0; i < len(txs); i++ {
txBzs[i] = txs[i].Hash()
}
return merkle.SimpleHashFromBy... | go | func (txs Txs) Hash() []byte {
// These allocations will be removed once Txs is switched to [][]byte,
// ref #2603. This is because golang does not allow type casting slices without unsafe
txBzs := make([][]byte, len(txs))
for i := 0; i < len(txs); i++ {
txBzs[i] = txs[i].Hash()
}
return merkle.SimpleHashFromBy... | [
"func",
"(",
"txs",
"Txs",
")",
"Hash",
"(",
")",
"[",
"]",
"byte",
"{",
"// These allocations will be removed once Txs is switched to [][]byte,",
"// ref #2603. This is because golang does not allow type casting slices without unsafe",
"txBzs",
":=",
"make",
"(",
"[",
"]",
"... | // Hash returns the Merkle root hash of the transaction hashes.
// i.e. the leaves of the tree are the hashes of the txs. | [
"Hash",
"returns",
"the",
"Merkle",
"root",
"hash",
"of",
"the",
"transaction",
"hashes",
".",
"i",
".",
"e",
".",
"the",
"leaves",
"of",
"the",
"tree",
"are",
"the",
"hashes",
"of",
"the",
"txs",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/tx.go#L36-L44 |
131,102 | tendermint/tendermint | types/tx.go | Index | func (txs Txs) Index(tx Tx) int {
for i := range txs {
if bytes.Equal(txs[i], tx) {
return i
}
}
return -1
} | go | func (txs Txs) Index(tx Tx) int {
for i := range txs {
if bytes.Equal(txs[i], tx) {
return i
}
}
return -1
} | [
"func",
"(",
"txs",
"Txs",
")",
"Index",
"(",
"tx",
"Tx",
")",
"int",
"{",
"for",
"i",
":=",
"range",
"txs",
"{",
"if",
"bytes",
".",
"Equal",
"(",
"txs",
"[",
"i",
"]",
",",
"tx",
")",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"retur... | // Index returns the index of this transaction in the list, or -1 if not found | [
"Index",
"returns",
"the",
"index",
"of",
"this",
"transaction",
"in",
"the",
"list",
"or",
"-",
"1",
"if",
"not",
"found"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/tx.go#L47-L54 |
131,103 | tendermint/tendermint | types/tx.go | IndexByHash | func (txs Txs) IndexByHash(hash []byte) int {
for i := range txs {
if bytes.Equal(txs[i].Hash(), hash) {
return i
}
}
return -1
} | go | func (txs Txs) IndexByHash(hash []byte) int {
for i := range txs {
if bytes.Equal(txs[i].Hash(), hash) {
return i
}
}
return -1
} | [
"func",
"(",
"txs",
"Txs",
")",
"IndexByHash",
"(",
"hash",
"[",
"]",
"byte",
")",
"int",
"{",
"for",
"i",
":=",
"range",
"txs",
"{",
"if",
"bytes",
".",
"Equal",
"(",
"txs",
"[",
"i",
"]",
".",
"Hash",
"(",
")",
",",
"hash",
")",
"{",
"retur... | // IndexByHash returns the index of this transaction hash in the list, or -1 if not found | [
"IndexByHash",
"returns",
"the",
"index",
"of",
"this",
"transaction",
"hash",
"in",
"the",
"list",
"or",
"-",
"1",
"if",
"not",
"found"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/tx.go#L57-L64 |
131,104 | tendermint/tendermint | types/tx.go | Validate | func (tp TxProof) Validate(dataHash []byte) error {
if !bytes.Equal(dataHash, tp.RootHash) {
return errors.New("Proof matches different data hash")
}
if tp.Proof.Index < 0 {
return errors.New("Proof index cannot be negative")
}
if tp.Proof.Total <= 0 {
return errors.New("Proof total must be positive")
}
va... | go | func (tp TxProof) Validate(dataHash []byte) error {
if !bytes.Equal(dataHash, tp.RootHash) {
return errors.New("Proof matches different data hash")
}
if tp.Proof.Index < 0 {
return errors.New("Proof index cannot be negative")
}
if tp.Proof.Total <= 0 {
return errors.New("Proof total must be positive")
}
va... | [
"func",
"(",
"tp",
"TxProof",
")",
"Validate",
"(",
"dataHash",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"dataHash",
",",
"tp",
".",
"RootHash",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\... | // Validate verifies the proof. It returns nil if the RootHash matches the dataHash argument,
// and if the proof is internally consistent. Otherwise, it returns a sensible error. | [
"Validate",
"verifies",
"the",
"proof",
".",
"It",
"returns",
"nil",
"if",
"the",
"RootHash",
"matches",
"the",
"dataHash",
"argument",
"and",
"if",
"the",
"proof",
"is",
"internally",
"consistent",
".",
"Otherwise",
"it",
"returns",
"a",
"sensible",
"error",
... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/tx.go#L98-L113 |
131,105 | tendermint/tendermint | consensus/wal.go | NewWAL | func NewWAL(walFile string, groupOptions ...func(*auto.Group)) (*baseWAL, error) {
err := cmn.EnsureDir(filepath.Dir(walFile), 0700)
if err != nil {
return nil, errors.Wrap(err, "failed to ensure WAL directory is in place")
}
group, err := auto.OpenGroup(walFile, groupOptions...)
if err != nil {
return nil, e... | go | func NewWAL(walFile string, groupOptions ...func(*auto.Group)) (*baseWAL, error) {
err := cmn.EnsureDir(filepath.Dir(walFile), 0700)
if err != nil {
return nil, errors.Wrap(err, "failed to ensure WAL directory is in place")
}
group, err := auto.OpenGroup(walFile, groupOptions...)
if err != nil {
return nil, e... | [
"func",
"NewWAL",
"(",
"walFile",
"string",
",",
"groupOptions",
"...",
"func",
"(",
"*",
"auto",
".",
"Group",
")",
")",
"(",
"*",
"baseWAL",
",",
"error",
")",
"{",
"err",
":=",
"cmn",
".",
"EnsureDir",
"(",
"filepath",
".",
"Dir",
"(",
"walFile",
... | // NewWAL returns a new write-ahead logger based on `baseWAL`, which implements
// WAL. It's flushed and synced to disk every 2s and once when stopped. | [
"NewWAL",
"returns",
"a",
"new",
"write",
"-",
"ahead",
"logger",
"based",
"on",
"baseWAL",
"which",
"implements",
"WAL",
".",
"It",
"s",
"flushed",
"and",
"synced",
"to",
"disk",
"every",
"2s",
"and",
"once",
"when",
"stopped",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/consensus/wal.go#L90-L107 |
131,106 | tendermint/tendermint | consensus/wal.go | Encode | func (enc *WALEncoder) Encode(v *TimedWALMessage) error {
data := cdc.MustMarshalBinaryBare(v)
crc := crc32.Checksum(data, crc32c)
length := uint32(len(data))
if length > maxMsgSizeBytes {
return fmt.Errorf("Msg is too big: %d bytes, max: %d bytes", length, maxMsgSizeBytes)
}
totalLength := 8 + int(length)
m... | go | func (enc *WALEncoder) Encode(v *TimedWALMessage) error {
data := cdc.MustMarshalBinaryBare(v)
crc := crc32.Checksum(data, crc32c)
length := uint32(len(data))
if length > maxMsgSizeBytes {
return fmt.Errorf("Msg is too big: %d bytes, max: %d bytes", length, maxMsgSizeBytes)
}
totalLength := 8 + int(length)
m... | [
"func",
"(",
"enc",
"*",
"WALEncoder",
")",
"Encode",
"(",
"v",
"*",
"TimedWALMessage",
")",
"error",
"{",
"data",
":=",
"cdc",
".",
"MustMarshalBinaryBare",
"(",
"v",
")",
"\n\n",
"crc",
":=",
"crc32",
".",
"Checksum",
"(",
"data",
",",
"crc32c",
")",... | // Encode writes the custom encoding of v to the stream. It returns an error if
// the amino-encoded size of v is greater than 1MB. Any error encountered
// during the write is also returned. | [
"Encode",
"writes",
"the",
"custom",
"encoding",
"of",
"v",
"to",
"the",
"stream",
".",
"It",
"returns",
"an",
"error",
"if",
"the",
"amino",
"-",
"encoded",
"size",
"of",
"v",
"is",
"greater",
"than",
"1MB",
".",
"Any",
"error",
"encountered",
"during",... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/consensus/wal.go#L282-L300 |
131,107 | tendermint/tendermint | consensus/wal.go | Decode | func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
b := make([]byte, 4)
_, err := dec.rd.Read(b)
if err == io.EOF {
return nil, err
}
if err != nil {
return nil, DataCorruptionError{fmt.Errorf("failed to read checksum: %v", err)}
}
crc := binary.BigEndian.Uint32(b)
b = make([]byte, 4)
_, err = d... | go | func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
b := make([]byte, 4)
_, err := dec.rd.Read(b)
if err == io.EOF {
return nil, err
}
if err != nil {
return nil, DataCorruptionError{fmt.Errorf("failed to read checksum: %v", err)}
}
crc := binary.BigEndian.Uint32(b)
b = make([]byte, 4)
_, err = d... | [
"func",
"(",
"dec",
"*",
"WALDecoder",
")",
"Decode",
"(",
")",
"(",
"*",
"TimedWALMessage",
",",
"error",
")",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n\n",
"_",
",",
"err",
":=",
"dec",
".",
"rd",
".",
"Read",
"(",
"... | // Decode reads the next custom-encoded value from its reader and returns it. | [
"Decode",
"reads",
"the",
"next",
"custom",
"-",
"encoded",
"value",
"from",
"its",
"reader",
"and",
"returns",
"it",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/consensus/wal.go#L338-L380 |
131,108 | tendermint/tendermint | libs/common/int.go | IntInSlice | func IntInSlice(a int, list []int) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
} | go | func IntInSlice(a int, list []int) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
} | [
"func",
"IntInSlice",
"(",
"a",
"int",
",",
"list",
"[",
"]",
"int",
")",
"bool",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"list",
"{",
"if",
"b",
"==",
"a",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IntInSlice returns true if a is found in the list. | [
"IntInSlice",
"returns",
"true",
"if",
"a",
"is",
"found",
"in",
"the",
"list",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/common/int.go#L4-L11 |
131,109 | tendermint/tendermint | crypto/merkle/simple_map.go | KVPairs | func (sm *simpleMap) KVPairs() cmn.KVPairs {
sm.Sort()
kvs := make(cmn.KVPairs, len(sm.kvs))
copy(kvs, sm.kvs)
return kvs
} | go | func (sm *simpleMap) KVPairs() cmn.KVPairs {
sm.Sort()
kvs := make(cmn.KVPairs, len(sm.kvs))
copy(kvs, sm.kvs)
return kvs
} | [
"func",
"(",
"sm",
"*",
"simpleMap",
")",
"KVPairs",
"(",
")",
"cmn",
".",
"KVPairs",
"{",
"sm",
".",
"Sort",
"(",
")",
"\n",
"kvs",
":=",
"make",
"(",
"cmn",
".",
"KVPairs",
",",
"len",
"(",
"sm",
".",
"kvs",
")",
")",
"\n",
"copy",
"(",
"kv... | // Returns a copy of sorted KVPairs.
// NOTE these contain the hashed key and value. | [
"Returns",
"a",
"copy",
"of",
"sorted",
"KVPairs",
".",
"NOTE",
"these",
"contain",
"the",
"hashed",
"key",
"and",
"value",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/merkle/simple_map.go#L59-L64 |
131,110 | tendermint/tendermint | crypto/merkle/simple_map.go | Bytes | func (kv KVPair) Bytes() []byte {
var b bytes.Buffer
err := amino.EncodeByteSlice(&b, kv.Key)
if err != nil {
panic(err)
}
err = amino.EncodeByteSlice(&b, kv.Value)
if err != nil {
panic(err)
}
return b.Bytes()
} | go | func (kv KVPair) Bytes() []byte {
var b bytes.Buffer
err := amino.EncodeByteSlice(&b, kv.Key)
if err != nil {
panic(err)
}
err = amino.EncodeByteSlice(&b, kv.Value)
if err != nil {
panic(err)
}
return b.Bytes()
} | [
"func",
"(",
"kv",
"KVPair",
")",
"Bytes",
"(",
")",
"[",
"]",
"byte",
"{",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"err",
":=",
"amino",
".",
"EncodeByteSlice",
"(",
"&",
"b",
",",
"kv",
".",
"Key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Bytes returns key || value, with both the
// key and value length prefixed. | [
"Bytes",
"returns",
"key",
"||",
"value",
"with",
"both",
"the",
"key",
"and",
"value",
"length",
"prefixed",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/merkle/simple_map.go#L75-L86 |
131,111 | tendermint/tendermint | consensus/replay_file.go | ReplayFile | func (cs *ConsensusState) ReplayFile(file string, console bool) error {
if cs.IsRunning() {
return errors.New("cs is already running, cannot replay")
}
if cs.wal != nil {
return errors.New("cs wal is open, cannot replay")
}
cs.startForReplay()
// ensure all new step events are regenerated as expected
ctx... | go | func (cs *ConsensusState) ReplayFile(file string, console bool) error {
if cs.IsRunning() {
return errors.New("cs is already running, cannot replay")
}
if cs.wal != nil {
return errors.New("cs wal is open, cannot replay")
}
cs.startForReplay()
// ensure all new step events are regenerated as expected
ctx... | [
"func",
"(",
"cs",
"*",
"ConsensusState",
")",
"ReplayFile",
"(",
"file",
"string",
",",
"console",
"bool",
")",
"error",
"{",
"if",
"cs",
".",
"IsRunning",
"(",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",... | // Replay msgs in file or start the console | [
"Replay",
"msgs",
"in",
"file",
"or",
"start",
"the",
"console"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/consensus/replay_file.go#L42-L94 |
131,112 | tendermint/tendermint | consensus/replay_file.go | replayConsoleLoop | func (pb *playback) replayConsoleLoop() int {
for {
fmt.Printf("> ")
bufReader := bufio.NewReader(os.Stdin)
line, more, err := bufReader.ReadLine()
if more {
cmn.Exit("input is too long")
} else if err != nil {
cmn.Exit(err.Error())
}
tokens := strings.Split(string(line), " ")
if len(tokens) == ... | go | func (pb *playback) replayConsoleLoop() int {
for {
fmt.Printf("> ")
bufReader := bufio.NewReader(os.Stdin)
line, more, err := bufReader.ReadLine()
if more {
cmn.Exit("input is too long")
} else if err != nil {
cmn.Exit(err.Error())
}
tokens := strings.Split(string(line), " ")
if len(tokens) == ... | [
"func",
"(",
"pb",
"*",
"playback",
")",
"replayConsoleLoop",
"(",
")",
"int",
"{",
"for",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"bufReader",
":=",
"bufio",
".",
"NewReader",
"(",
"os",
".",
"Stdin",
")",
"\n",
"line",
",",
"more",... | // console function for parsing input and running commands | [
"console",
"function",
"for",
"parsing",
"input",
"and",
"running",
"commands"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/consensus/replay_file.go#L176-L273 |
131,113 | tendermint/tendermint | lite/base_verifier.go | NewBaseVerifier | func NewBaseVerifier(chainID string, height int64, valset *types.ValidatorSet) *BaseVerifier {
if valset.IsNilOrEmpty() {
panic("NewBaseVerifier requires a valid valset")
}
return &BaseVerifier{
chainID: chainID,
height: height,
valset: valset,
}
} | go | func NewBaseVerifier(chainID string, height int64, valset *types.ValidatorSet) *BaseVerifier {
if valset.IsNilOrEmpty() {
panic("NewBaseVerifier requires a valid valset")
}
return &BaseVerifier{
chainID: chainID,
height: height,
valset: valset,
}
} | [
"func",
"NewBaseVerifier",
"(",
"chainID",
"string",
",",
"height",
"int64",
",",
"valset",
"*",
"types",
".",
"ValidatorSet",
")",
"*",
"BaseVerifier",
"{",
"if",
"valset",
".",
"IsNilOrEmpty",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
... | // NewBaseVerifier returns a new Verifier initialized with a validator set at
// some height. | [
"NewBaseVerifier",
"returns",
"a",
"new",
"Verifier",
"initialized",
"with",
"a",
"validator",
"set",
"at",
"some",
"height",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/base_verifier.go#L26-L35 |
131,114 | tendermint/tendermint | lite/base_verifier.go | Verify | func (bv *BaseVerifier) Verify(signedHeader types.SignedHeader) error {
// We can't verify commits for a different chain.
if signedHeader.ChainID != bv.chainID {
return cmn.NewError("BaseVerifier chainID is %v, cannot verify chainID %v",
bv.chainID, signedHeader.ChainID)
}
// We can't verify commits older th... | go | func (bv *BaseVerifier) Verify(signedHeader types.SignedHeader) error {
// We can't verify commits for a different chain.
if signedHeader.ChainID != bv.chainID {
return cmn.NewError("BaseVerifier chainID is %v, cannot verify chainID %v",
bv.chainID, signedHeader.ChainID)
}
// We can't verify commits older th... | [
"func",
"(",
"bv",
"*",
"BaseVerifier",
")",
"Verify",
"(",
"signedHeader",
"types",
".",
"SignedHeader",
")",
"error",
"{",
"// We can't verify commits for a different chain.",
"if",
"signedHeader",
".",
"ChainID",
"!=",
"bv",
".",
"chainID",
"{",
"return",
"cmn"... | // Implements Verifier. | [
"Implements",
"Verifier",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/base_verifier.go#L43-L78 |
131,115 | tendermint/tendermint | evidence/pool.go | PendingEvidence | func (evpool *EvidencePool) PendingEvidence(maxNum int64) []types.Evidence {
return evpool.evidenceStore.PendingEvidence(maxNum)
} | go | func (evpool *EvidencePool) PendingEvidence(maxNum int64) []types.Evidence {
return evpool.evidenceStore.PendingEvidence(maxNum)
} | [
"func",
"(",
"evpool",
"*",
"EvidencePool",
")",
"PendingEvidence",
"(",
"maxNum",
"int64",
")",
"[",
"]",
"types",
".",
"Evidence",
"{",
"return",
"evpool",
".",
"evidenceStore",
".",
"PendingEvidence",
"(",
"maxNum",
")",
"\n",
"}"
] | // PendingEvidence returns up to maxNum uncommitted evidence.
// If maxNum is -1, all evidence is returned. | [
"PendingEvidence",
"returns",
"up",
"to",
"maxNum",
"uncommitted",
"evidence",
".",
"If",
"maxNum",
"is",
"-",
"1",
"all",
"evidence",
"is",
"returned",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/pool.go#L63-L65 |
131,116 | tendermint/tendermint | evidence/pool.go | State | func (evpool *EvidencePool) State() sm.State {
evpool.mtx.Lock()
defer evpool.mtx.Unlock()
return evpool.state
} | go | func (evpool *EvidencePool) State() sm.State {
evpool.mtx.Lock()
defer evpool.mtx.Unlock()
return evpool.state
} | [
"func",
"(",
"evpool",
"*",
"EvidencePool",
")",
"State",
"(",
")",
"sm",
".",
"State",
"{",
"evpool",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"evpool",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"return",
"evpool",
".",
"state",
"\n",
... | // State returns the current state of the evpool. | [
"State",
"returns",
"the",
"current",
"state",
"of",
"the",
"evpool",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/pool.go#L68-L72 |
131,117 | tendermint/tendermint | evidence/pool.go | Update | func (evpool *EvidencePool) Update(block *types.Block, state sm.State) {
// sanity check
if state.LastBlockHeight != block.Height {
panic(fmt.Sprintf("Failed EvidencePool.Update sanity check: got state.Height=%d with block.Height=%d", state.LastBlockHeight, block.Height))
}
// update the state
evpool.mtx.Lock(... | go | func (evpool *EvidencePool) Update(block *types.Block, state sm.State) {
// sanity check
if state.LastBlockHeight != block.Height {
panic(fmt.Sprintf("Failed EvidencePool.Update sanity check: got state.Height=%d with block.Height=%d", state.LastBlockHeight, block.Height))
}
// update the state
evpool.mtx.Lock(... | [
"func",
"(",
"evpool",
"*",
"EvidencePool",
")",
"Update",
"(",
"block",
"*",
"types",
".",
"Block",
",",
"state",
"sm",
".",
"State",
")",
"{",
"// sanity check",
"if",
"state",
".",
"LastBlockHeight",
"!=",
"block",
".",
"Height",
"{",
"panic",
"(",
... | // Update loads the latest | [
"Update",
"loads",
"the",
"latest"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/pool.go#L75-L89 |
131,118 | tendermint/tendermint | evidence/pool.go | AddEvidence | func (evpool *EvidencePool) AddEvidence(evidence types.Evidence) (err error) {
// TODO: check if we already have evidence for this
// validator at this height so we dont get spammed
if err := sm.VerifyEvidence(evpool.stateDB, evpool.State(), evidence); err != nil {
return err
}
// fetch the validator and retu... | go | func (evpool *EvidencePool) AddEvidence(evidence types.Evidence) (err error) {
// TODO: check if we already have evidence for this
// validator at this height so we dont get spammed
if err := sm.VerifyEvidence(evpool.stateDB, evpool.State(), evidence); err != nil {
return err
}
// fetch the validator and retu... | [
"func",
"(",
"evpool",
"*",
"EvidencePool",
")",
"AddEvidence",
"(",
"evidence",
"types",
".",
"Evidence",
")",
"(",
"err",
"error",
")",
"{",
"// TODO: check if we already have evidence for this",
"// validator at this height so we dont get spammed",
"if",
"err",
":=",
... | // AddEvidence checks the evidence is valid and adds it to the pool. | [
"AddEvidence",
"checks",
"the",
"evidence",
"is",
"valid",
"and",
"adds",
"it",
"to",
"the",
"pool",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/pool.go#L92-L119 |
131,119 | tendermint/tendermint | evidence/pool.go | MarkEvidenceAsCommitted | func (evpool *EvidencePool) MarkEvidenceAsCommitted(height int64, evidence []types.Evidence) {
// make a map of committed evidence to remove from the clist
blockEvidenceMap := make(map[string]struct{})
for _, ev := range evidence {
evpool.evidenceStore.MarkEvidenceAsCommitted(ev)
blockEvidenceMap[evMapKey(ev)] =... | go | func (evpool *EvidencePool) MarkEvidenceAsCommitted(height int64, evidence []types.Evidence) {
// make a map of committed evidence to remove from the clist
blockEvidenceMap := make(map[string]struct{})
for _, ev := range evidence {
evpool.evidenceStore.MarkEvidenceAsCommitted(ev)
blockEvidenceMap[evMapKey(ev)] =... | [
"func",
"(",
"evpool",
"*",
"EvidencePool",
")",
"MarkEvidenceAsCommitted",
"(",
"height",
"int64",
",",
"evidence",
"[",
"]",
"types",
".",
"Evidence",
")",
"{",
"// make a map of committed evidence to remove from the clist",
"blockEvidenceMap",
":=",
"make",
"(",
"m... | // MarkEvidenceAsCommitted marks all the evidence as committed and removes it from the queue. | [
"MarkEvidenceAsCommitted",
"marks",
"all",
"the",
"evidence",
"as",
"committed",
"and",
"removes",
"it",
"from",
"the",
"queue",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/pool.go#L122-L134 |
131,120 | tendermint/tendermint | evidence/pool.go | IsCommitted | func (evpool *EvidencePool) IsCommitted(evidence types.Evidence) bool {
ei := evpool.evidenceStore.getEvidenceInfo(evidence)
return ei.Evidence != nil && ei.Committed
} | go | func (evpool *EvidencePool) IsCommitted(evidence types.Evidence) bool {
ei := evpool.evidenceStore.getEvidenceInfo(evidence)
return ei.Evidence != nil && ei.Committed
} | [
"func",
"(",
"evpool",
"*",
"EvidencePool",
")",
"IsCommitted",
"(",
"evidence",
"types",
".",
"Evidence",
")",
"bool",
"{",
"ei",
":=",
"evpool",
".",
"evidenceStore",
".",
"getEvidenceInfo",
"(",
"evidence",
")",
"\n",
"return",
"ei",
".",
"Evidence",
"!... | // IsCommitted returns true if we have already seen this exact evidence and it is already marked as committed. | [
"IsCommitted",
"returns",
"true",
"if",
"we",
"have",
"already",
"seen",
"this",
"exact",
"evidence",
"and",
"it",
"is",
"already",
"marked",
"as",
"committed",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/pool.go#L137-L140 |
131,121 | tendermint/tendermint | crypto/internal/benchmarking/bench.go | BenchmarkKeyGeneration | func BenchmarkKeyGeneration(b *testing.B, GenerateKey func(reader io.Reader) crypto.PrivKey) {
var zero zeroReader
for i := 0; i < b.N; i++ {
GenerateKey(zero)
}
} | go | func BenchmarkKeyGeneration(b *testing.B, GenerateKey func(reader io.Reader) crypto.PrivKey) {
var zero zeroReader
for i := 0; i < b.N; i++ {
GenerateKey(zero)
}
} | [
"func",
"BenchmarkKeyGeneration",
"(",
"b",
"*",
"testing",
".",
"B",
",",
"GenerateKey",
"func",
"(",
"reader",
"io",
".",
"Reader",
")",
"crypto",
".",
"PrivKey",
")",
"{",
"var",
"zero",
"zeroReader",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"b... | // BenchmarkKeyGeneration benchmarks the given key generation algorithm using
// a dummy reader. | [
"BenchmarkKeyGeneration",
"benchmarks",
"the",
"given",
"key",
"generation",
"algorithm",
"using",
"a",
"dummy",
"reader",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/internal/benchmarking/bench.go#L27-L32 |
131,122 | tendermint/tendermint | crypto/internal/benchmarking/bench.go | BenchmarkSigning | func BenchmarkSigning(b *testing.B, priv crypto.PrivKey) {
message := []byte("Hello, world!")
b.ResetTimer()
for i := 0; i < b.N; i++ {
priv.Sign(message)
}
} | go | func BenchmarkSigning(b *testing.B, priv crypto.PrivKey) {
message := []byte("Hello, world!")
b.ResetTimer()
for i := 0; i < b.N; i++ {
priv.Sign(message)
}
} | [
"func",
"BenchmarkSigning",
"(",
"b",
"*",
"testing",
".",
"B",
",",
"priv",
"crypto",
".",
"PrivKey",
")",
"{",
"message",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
"\n",
"b",
".",
"ResetTimer",
"(",
")",
"\n",
"for",
"i",
":=",
"0",
";",
... | // BenchmarkSigning benchmarks the given signing algorithm using
// the provided privkey. | [
"BenchmarkSigning",
"benchmarks",
"the",
"given",
"signing",
"algorithm",
"using",
"the",
"provided",
"privkey",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/internal/benchmarking/bench.go#L36-L42 |
131,123 | tendermint/tendermint | crypto/internal/benchmarking/bench.go | BenchmarkVerification | func BenchmarkVerification(b *testing.B, priv crypto.PrivKey) {
pub := priv.PubKey()
// use a short message, so this time doesn't get dominated by hashing.
message := []byte("Hello, world!")
signature, err := priv.Sign(message)
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
pub.Ver... | go | func BenchmarkVerification(b *testing.B, priv crypto.PrivKey) {
pub := priv.PubKey()
// use a short message, so this time doesn't get dominated by hashing.
message := []byte("Hello, world!")
signature, err := priv.Sign(message)
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
pub.Ver... | [
"func",
"BenchmarkVerification",
"(",
"b",
"*",
"testing",
".",
"B",
",",
"priv",
"crypto",
".",
"PrivKey",
")",
"{",
"pub",
":=",
"priv",
".",
"PubKey",
"(",
")",
"\n",
"// use a short message, so this time doesn't get dominated by hashing.",
"message",
":=",
"["... | // BenchmarkVerification benchmarks the given verification algorithm using
// the provided privkey on a constant message. | [
"BenchmarkVerification",
"benchmarks",
"the",
"given",
"verification",
"algorithm",
"using",
"the",
"provided",
"privkey",
"on",
"a",
"constant",
"message",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/internal/benchmarking/bench.go#L46-L58 |
131,124 | tendermint/tendermint | tools/tm-signer-harness/internal/utils.go | ExpandPath | func ExpandPath(path string) string {
usr, err := user.Current()
if err != nil {
return path
}
if path == "~" {
return usr.HomeDir
} else if strings.HasPrefix(path, "~/") {
return filepath.Join(usr.HomeDir, path[2:])
}
return path
} | go | func ExpandPath(path string) string {
usr, err := user.Current()
if err != nil {
return path
}
if path == "~" {
return usr.HomeDir
} else if strings.HasPrefix(path, "~/") {
return filepath.Join(usr.HomeDir, path[2:])
}
return path
} | [
"func",
"ExpandPath",
"(",
"path",
"string",
")",
"string",
"{",
"usr",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"path",
"\n",
"}",
"\n\n",
"if",
"path",
"==",
"\"",
"\"",
"{",
"return",
"... | // ExpandPath will check if the given path begins with a "~" symbol, and if so,
// will expand it to become the user's home directory. If it fails to expand the
// path it will automatically return the original path itself. | [
"ExpandPath",
"will",
"check",
"if",
"the",
"given",
"path",
"begins",
"with",
"a",
"~",
"symbol",
"and",
"if",
"so",
"will",
"expand",
"it",
"to",
"become",
"the",
"user",
"s",
"home",
"directory",
".",
"If",
"it",
"fails",
"to",
"expand",
"the",
"pat... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-signer-harness/internal/utils.go#L12-L25 |
131,125 | tendermint/tendermint | p2p/key.go | LoadOrGenNodeKey | func LoadOrGenNodeKey(filePath string) (*NodeKey, error) {
if cmn.FileExists(filePath) {
nodeKey, err := LoadNodeKey(filePath)
if err != nil {
return nil, err
}
return nodeKey, nil
}
return genNodeKey(filePath)
} | go | func LoadOrGenNodeKey(filePath string) (*NodeKey, error) {
if cmn.FileExists(filePath) {
nodeKey, err := LoadNodeKey(filePath)
if err != nil {
return nil, err
}
return nodeKey, nil
}
return genNodeKey(filePath)
} | [
"func",
"LoadOrGenNodeKey",
"(",
"filePath",
"string",
")",
"(",
"*",
"NodeKey",
",",
"error",
")",
"{",
"if",
"cmn",
".",
"FileExists",
"(",
"filePath",
")",
"{",
"nodeKey",
",",
"err",
":=",
"LoadNodeKey",
"(",
"filePath",
")",
"\n",
"if",
"err",
"!=... | // LoadOrGenNodeKey attempts to load the NodeKey from the given filePath.
// If the file does not exist, it generates and saves a new NodeKey. | [
"LoadOrGenNodeKey",
"attempts",
"to",
"load",
"the",
"NodeKey",
"from",
"the",
"given",
"filePath",
".",
"If",
"the",
"file",
"does",
"not",
"exist",
"it",
"generates",
"and",
"saves",
"a",
"new",
"NodeKey",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/key.go#L49-L58 |
131,126 | tendermint/tendermint | privval/socket_dialers.go | DialTCPFn | func DialTCPFn(addr string, timeoutReadWrite time.Duration, privKey ed25519.PrivKeyEd25519) SocketDialer {
return func() (net.Conn, error) {
conn, err := cmn.Connect(addr)
if err == nil {
deadline := time.Now().Add(timeoutReadWrite)
err = conn.SetDeadline(deadline)
}
if err == nil {
conn, err = p2pcon... | go | func DialTCPFn(addr string, timeoutReadWrite time.Duration, privKey ed25519.PrivKeyEd25519) SocketDialer {
return func() (net.Conn, error) {
conn, err := cmn.Connect(addr)
if err == nil {
deadline := time.Now().Add(timeoutReadWrite)
err = conn.SetDeadline(deadline)
}
if err == nil {
conn, err = p2pcon... | [
"func",
"DialTCPFn",
"(",
"addr",
"string",
",",
"timeoutReadWrite",
"time",
".",
"Duration",
",",
"privKey",
"ed25519",
".",
"PrivKeyEd25519",
")",
"SocketDialer",
"{",
"return",
"func",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"conn",
... | // DialTCPFn dials the given tcp addr, using the given timeoutReadWrite and
// privKey for the authenticated encryption handshake. | [
"DialTCPFn",
"dials",
"the",
"given",
"tcp",
"addr",
"using",
"the",
"given",
"timeoutReadWrite",
"and",
"privKey",
"for",
"the",
"authenticated",
"encryption",
"handshake",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_dialers.go#L23-L35 |
131,127 | tendermint/tendermint | privval/socket_dialers.go | DialUnixFn | func DialUnixFn(addr string) SocketDialer {
return func() (net.Conn, error) {
unixAddr := &net.UnixAddr{Name: addr, Net: "unix"}
return net.DialUnix("unix", nil, unixAddr)
}
} | go | func DialUnixFn(addr string) SocketDialer {
return func() (net.Conn, error) {
unixAddr := &net.UnixAddr{Name: addr, Net: "unix"}
return net.DialUnix("unix", nil, unixAddr)
}
} | [
"func",
"DialUnixFn",
"(",
"addr",
"string",
")",
"SocketDialer",
"{",
"return",
"func",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"unixAddr",
":=",
"&",
"net",
".",
"UnixAddr",
"{",
"Name",
":",
"addr",
",",
"Net",
":",
"\"",
"\""... | // DialUnixFn dials the given unix socket. | [
"DialUnixFn",
"dials",
"the",
"given",
"unix",
"socket",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_dialers.go#L38-L43 |
131,128 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | RecalculateNetworkUptimeEvery | func RecalculateNetworkUptimeEvery(d time.Duration) func(m *Monitor) {
return func(m *Monitor) {
m.recalculateNetworkUptimeEvery = d
}
} | go | func RecalculateNetworkUptimeEvery(d time.Duration) func(m *Monitor) {
return func(m *Monitor) {
m.recalculateNetworkUptimeEvery = d
}
} | [
"func",
"RecalculateNetworkUptimeEvery",
"(",
"d",
"time",
".",
"Duration",
")",
"func",
"(",
"m",
"*",
"Monitor",
")",
"{",
"return",
"func",
"(",
"m",
"*",
"Monitor",
")",
"{",
"m",
".",
"recalculateNetworkUptimeEvery",
"=",
"d",
"\n",
"}",
"\n",
"}"
] | // RecalculateNetworkUptimeEvery lets you change network uptime update interval. | [
"RecalculateNetworkUptimeEvery",
"lets",
"you",
"change",
"network",
"uptime",
"update",
"interval",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L60-L64 |
131,129 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | SetNumValidatorsUpdateInterval | func SetNumValidatorsUpdateInterval(d time.Duration) func(m *Monitor) {
return func(m *Monitor) {
m.numValidatorsUpdateInterval = d
}
} | go | func SetNumValidatorsUpdateInterval(d time.Duration) func(m *Monitor) {
return func(m *Monitor) {
m.numValidatorsUpdateInterval = d
}
} | [
"func",
"SetNumValidatorsUpdateInterval",
"(",
"d",
"time",
".",
"Duration",
")",
"func",
"(",
"m",
"*",
"Monitor",
")",
"{",
"return",
"func",
"(",
"m",
"*",
"Monitor",
")",
"{",
"m",
".",
"numValidatorsUpdateInterval",
"=",
"d",
"\n",
"}",
"\n",
"}"
] | // SetNumValidatorsUpdateInterval lets you change num validators update interval. | [
"SetNumValidatorsUpdateInterval",
"lets",
"you",
"change",
"num",
"validators",
"update",
"interval",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L67-L71 |
131,130 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | Monitor | func (m *Monitor) Monitor(n *Node) error {
m.mtx.Lock()
m.Nodes = append(m.Nodes, n)
m.mtx.Unlock()
blockCh := make(chan tmtypes.Header, 10)
n.SendBlocksTo(blockCh)
blockLatencyCh := make(chan float64, 10)
n.SendBlockLatenciesTo(blockLatencyCh)
disconnectCh := make(chan bool, 10)
n.NotifyAboutDisconnects(disc... | go | func (m *Monitor) Monitor(n *Node) error {
m.mtx.Lock()
m.Nodes = append(m.Nodes, n)
m.mtx.Unlock()
blockCh := make(chan tmtypes.Header, 10)
n.SendBlocksTo(blockCh)
blockLatencyCh := make(chan float64, 10)
n.SendBlockLatenciesTo(blockLatencyCh)
disconnectCh := make(chan bool, 10)
n.NotifyAboutDisconnects(disc... | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"Monitor",
"(",
"n",
"*",
"Node",
")",
"error",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"m",
".",
"Nodes",
"=",
"append",
"(",
"m",
".",
"Nodes",
",",
"n",
")",
"\n",
"m",
".",
"mtx",
".",
... | // Monitor begins to monitor the node `n`. The node will be started and added
// to the monitor. | [
"Monitor",
"begins",
"to",
"monitor",
"the",
"node",
"n",
".",
"The",
"node",
"will",
"be",
"started",
"and",
"added",
"to",
"the",
"monitor",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L80-L102 |
131,131 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | Unmonitor | func (m *Monitor) Unmonitor(n *Node) {
m.Network.NodeDeleted(n.Name)
n.Stop()
close(m.nodeQuit[n.Name])
delete(m.nodeQuit, n.Name)
i, _ := m.NodeByName(n.Name)
m.mtx.Lock()
m.Nodes[i] = m.Nodes[len(m.Nodes)-1]
m.Nodes = m.Nodes[:len(m.Nodes)-1]
m.mtx.Unlock()
} | go | func (m *Monitor) Unmonitor(n *Node) {
m.Network.NodeDeleted(n.Name)
n.Stop()
close(m.nodeQuit[n.Name])
delete(m.nodeQuit, n.Name)
i, _ := m.NodeByName(n.Name)
m.mtx.Lock()
m.Nodes[i] = m.Nodes[len(m.Nodes)-1]
m.Nodes = m.Nodes[:len(m.Nodes)-1]
m.mtx.Unlock()
} | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"Unmonitor",
"(",
"n",
"*",
"Node",
")",
"{",
"m",
".",
"Network",
".",
"NodeDeleted",
"(",
"n",
".",
"Name",
")",
"\n\n",
"n",
".",
"Stop",
"(",
")",
"\n",
"close",
"(",
"m",
".",
"nodeQuit",
"[",
"n",
... | // Unmonitor stops monitoring node `n`. The node will be stopped and removed
// from the monitor. | [
"Unmonitor",
"stops",
"monitoring",
"node",
"n",
".",
"The",
"node",
"will",
"be",
"stopped",
"and",
"removed",
"from",
"the",
"monitor",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L106-L118 |
131,132 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | NodeByName | func (m *Monitor) NodeByName(name string) (index int, node *Node) {
m.mtx.Lock()
defer m.mtx.Unlock()
for i, n := range m.Nodes {
if name == n.Name {
return i, n
}
}
return -1, nil
} | go | func (m *Monitor) NodeByName(name string) (index int, node *Node) {
m.mtx.Lock()
defer m.mtx.Unlock()
for i, n := range m.Nodes {
if name == n.Name {
return i, n
}
}
return -1, nil
} | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"NodeByName",
"(",
"name",
"string",
")",
"(",
"index",
"int",
",",
"node",
"*",
"Node",
")",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
... | // NodeByName returns the node and its index if such node exists within the
// monitor. Otherwise, -1 and nil are returned. | [
"NodeByName",
"returns",
"the",
"node",
"and",
"its",
"index",
"if",
"such",
"node",
"exists",
"within",
"the",
"monitor",
".",
"Otherwise",
"-",
"1",
"and",
"nil",
"are",
"returned",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L122-L132 |
131,133 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | Stop | func (m *Monitor) Stop() {
close(m.monitorQuit)
for _, n := range m.Nodes {
m.Unmonitor(n)
}
} | go | func (m *Monitor) Stop() {
close(m.monitorQuit)
for _, n := range m.Nodes {
m.Unmonitor(n)
}
} | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"Stop",
"(",
")",
"{",
"close",
"(",
"m",
".",
"monitorQuit",
")",
"\n\n",
"for",
"_",
",",
"n",
":=",
"range",
"m",
".",
"Nodes",
"{",
"m",
".",
"Unmonitor",
"(",
"n",
")",
"\n",
"}",
"\n",
"}"
] | // Stop stops the monitor's routines. | [
"Stop",
"stops",
"the",
"monitor",
"s",
"routines",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L159-L165 |
131,134 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | listen | func (m *Monitor) listen(nodeName string, blockCh <-chan tmtypes.Header, blockLatencyCh <-chan float64, disconnectCh <-chan bool, quit <-chan struct{}) {
logger := m.logger.With("node", nodeName)
for {
select {
case <-quit:
return
case b := <-blockCh:
m.Network.NewBlock(b)
m.Network.NodeIsOnline(nodeN... | go | func (m *Monitor) listen(nodeName string, blockCh <-chan tmtypes.Header, blockLatencyCh <-chan float64, disconnectCh <-chan bool, quit <-chan struct{}) {
logger := m.logger.With("node", nodeName)
for {
select {
case <-quit:
return
case b := <-blockCh:
m.Network.NewBlock(b)
m.Network.NodeIsOnline(nodeN... | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"listen",
"(",
"nodeName",
"string",
",",
"blockCh",
"<-",
"chan",
"tmtypes",
".",
"Header",
",",
"blockLatencyCh",
"<-",
"chan",
"float64",
",",
"disconnectCh",
"<-",
"chan",
"bool",
",",
"quit",
"<-",
"chan",
"str... | // main loop where we listen for events from the node | [
"main",
"loop",
"where",
"we",
"listen",
"for",
"events",
"from",
"the",
"node"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L168-L195 |
131,135 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | recalculateNetworkUptimeLoop | func (m *Monitor) recalculateNetworkUptimeLoop() {
for {
select {
case <-m.monitorQuit:
return
case <-time.After(m.recalculateNetworkUptimeEvery):
m.Network.RecalculateUptime()
}
}
} | go | func (m *Monitor) recalculateNetworkUptimeLoop() {
for {
select {
case <-m.monitorQuit:
return
case <-time.After(m.recalculateNetworkUptimeEvery):
m.Network.RecalculateUptime()
}
}
} | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"recalculateNetworkUptimeLoop",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"m",
".",
"monitorQuit",
":",
"return",
"\n",
"case",
"<-",
"time",
".",
"After",
"(",
"m",
".",
"recalculateNetworkUptimeEvery",... | // recalculateNetworkUptimeLoop every N seconds. | [
"recalculateNetworkUptimeLoop",
"every",
"N",
"seconds",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L198-L207 |
131,136 | tendermint/tendermint | tools/tm-monitor/monitor/monitor.go | updateNumValidatorLoop | func (m *Monitor) updateNumValidatorLoop() {
rand.Seed(time.Now().Unix())
var height int64
var num int
var err error
for {
m.mtx.Lock()
nodesCount := len(m.Nodes)
m.mtx.Unlock()
if 0 == nodesCount {
time.Sleep(m.numValidatorsUpdateInterval)
continue
}
randomNodeIndex := rand.Intn(nodesCount)
... | go | func (m *Monitor) updateNumValidatorLoop() {
rand.Seed(time.Now().Unix())
var height int64
var num int
var err error
for {
m.mtx.Lock()
nodesCount := len(m.Nodes)
m.mtx.Unlock()
if 0 == nodesCount {
time.Sleep(m.numValidatorsUpdateInterval)
continue
}
randomNodeIndex := rand.Intn(nodesCount)
... | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"updateNumValidatorLoop",
"(",
")",
"{",
"rand",
".",
"Seed",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
")",
"\n\n",
"var",
"height",
"int64",
"\n",
"var",
"num",
"int",
"\n",
"var",
"err",
"... | // updateNumValidatorLoop sends a request to a random node once every N seconds,
// which in turn makes an RPC call to get the latest validators. | [
"updateNumValidatorLoop",
"sends",
"a",
"request",
"to",
"a",
"random",
"node",
"once",
"every",
"N",
"seconds",
"which",
"in",
"turn",
"makes",
"an",
"RPC",
"call",
"to",
"get",
"the",
"latest",
"validators",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/monitor.go#L211-L251 |
131,137 | tendermint/tendermint | evidence/reactor.go | NewEvidenceReactor | func NewEvidenceReactor(evpool *EvidencePool) *EvidenceReactor {
evR := &EvidenceReactor{
evpool: evpool,
}
evR.BaseReactor = *p2p.NewBaseReactor("EvidenceReactor", evR)
return evR
} | go | func NewEvidenceReactor(evpool *EvidencePool) *EvidenceReactor {
evR := &EvidenceReactor{
evpool: evpool,
}
evR.BaseReactor = *p2p.NewBaseReactor("EvidenceReactor", evR)
return evR
} | [
"func",
"NewEvidenceReactor",
"(",
"evpool",
"*",
"EvidencePool",
")",
"*",
"EvidenceReactor",
"{",
"evR",
":=",
"&",
"EvidenceReactor",
"{",
"evpool",
":",
"evpool",
",",
"}",
"\n",
"evR",
".",
"BaseReactor",
"=",
"*",
"p2p",
".",
"NewBaseReactor",
"(",
"... | // NewEvidenceReactor returns a new EvidenceReactor with the given config and evpool. | [
"NewEvidenceReactor",
"returns",
"a",
"new",
"EvidenceReactor",
"with",
"the",
"given",
"config",
"and",
"evpool",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/reactor.go#L33-L39 |
131,138 | tendermint/tendermint | evidence/reactor.go | SetLogger | func (evR *EvidenceReactor) SetLogger(l log.Logger) {
evR.Logger = l
evR.evpool.SetLogger(l)
} | go | func (evR *EvidenceReactor) SetLogger(l log.Logger) {
evR.Logger = l
evR.evpool.SetLogger(l)
} | [
"func",
"(",
"evR",
"*",
"EvidenceReactor",
")",
"SetLogger",
"(",
"l",
"log",
".",
"Logger",
")",
"{",
"evR",
".",
"Logger",
"=",
"l",
"\n",
"evR",
".",
"evpool",
".",
"SetLogger",
"(",
"l",
")",
"\n",
"}"
] | // SetLogger sets the Logger on the reactor and the underlying Evidence. | [
"SetLogger",
"sets",
"the",
"Logger",
"on",
"the",
"reactor",
"and",
"the",
"underlying",
"Evidence",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/reactor.go#L42-L45 |
131,139 | tendermint/tendermint | evidence/reactor.go | Receive | func (evR *EvidenceReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := decodeMsg(msgBytes)
if err != nil {
evR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
evR.Switch.StopPeerForError(src, err)
return
}
if err = msg.ValidateB... | go | func (evR *EvidenceReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := decodeMsg(msgBytes)
if err != nil {
evR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
evR.Switch.StopPeerForError(src, err)
return
}
if err = msg.ValidateB... | [
"func",
"(",
"evR",
"*",
"EvidenceReactor",
")",
"Receive",
"(",
"chID",
"byte",
",",
"src",
"p2p",
".",
"Peer",
",",
"msgBytes",
"[",
"]",
"byte",
")",
"{",
"msg",
",",
"err",
":=",
"decodeMsg",
"(",
"msgBytes",
")",
"\n",
"if",
"err",
"!=",
"nil"... | // Receive implements Reactor.
// It adds any received evidence to the evpool. | [
"Receive",
"implements",
"Reactor",
".",
"It",
"adds",
"any",
"received",
"evidence",
"to",
"the",
"evpool",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/reactor.go#L70-L99 |
131,140 | tendermint/tendermint | evidence/reactor.go | broadcastEvidenceRoutine | func (evR *EvidenceReactor) broadcastEvidenceRoutine(peer p2p.Peer) {
var next *clist.CElement
for {
// This happens because the CElement we were looking at got garbage
// collected (removed). That is, .NextWait() returned nil. Go ahead and
// start from the beginning.
if next == nil {
select {
case <-e... | go | func (evR *EvidenceReactor) broadcastEvidenceRoutine(peer p2p.Peer) {
var next *clist.CElement
for {
// This happens because the CElement we were looking at got garbage
// collected (removed). That is, .NextWait() returned nil. Go ahead and
// start from the beginning.
if next == nil {
select {
case <-e... | [
"func",
"(",
"evR",
"*",
"EvidenceReactor",
")",
"broadcastEvidenceRoutine",
"(",
"peer",
"p2p",
".",
"Peer",
")",
"{",
"var",
"next",
"*",
"clist",
".",
"CElement",
"\n",
"for",
"{",
"// This happens because the CElement we were looking at got garbage",
"// collected... | // Modeled after the mempool routine.
// - Evidence accumulates in a clist.
// - Each peer has a routien that iterates through the clist,
// sending available evidence to the peer.
// - If we're waiting for new evidence and the list is not empty,
// start iterating from the beginning again. | [
"Modeled",
"after",
"the",
"mempool",
"routine",
".",
"-",
"Evidence",
"accumulates",
"in",
"a",
"clist",
".",
"-",
"Each",
"peer",
"has",
"a",
"routien",
"that",
"iterates",
"through",
"the",
"clist",
"sending",
"available",
"evidence",
"to",
"the",
"peer",... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/reactor.go#L112-L158 |
131,141 | tendermint/tendermint | evidence/reactor.go | checkSendEvidenceMessage | func (evR EvidenceReactor) checkSendEvidenceMessage(peer p2p.Peer, ev types.Evidence) (msg EvidenceMessage, retry bool) {
// make sure the peer is up to date
evHeight := ev.Height()
peerState, ok := peer.Get(types.PeerStateKey).(PeerState)
if !ok {
// Peer does not have a state yet. We set it in the consensus rea... | go | func (evR EvidenceReactor) checkSendEvidenceMessage(peer p2p.Peer, ev types.Evidence) (msg EvidenceMessage, retry bool) {
// make sure the peer is up to date
evHeight := ev.Height()
peerState, ok := peer.Get(types.PeerStateKey).(PeerState)
if !ok {
// Peer does not have a state yet. We set it in the consensus rea... | [
"func",
"(",
"evR",
"EvidenceReactor",
")",
"checkSendEvidenceMessage",
"(",
"peer",
"p2p",
".",
"Peer",
",",
"ev",
"types",
".",
"Evidence",
")",
"(",
"msg",
"EvidenceMessage",
",",
"retry",
"bool",
")",
"{",
"// make sure the peer is up to date",
"evHeight",
"... | // Returns the message to send the peer, or nil if the evidence is invalid for the peer.
// If message is nil, return true if we should sleep and try again. | [
"Returns",
"the",
"message",
"to",
"send",
"the",
"peer",
"or",
"nil",
"if",
"the",
"evidence",
"is",
"invalid",
"for",
"the",
"peer",
".",
"If",
"message",
"is",
"nil",
"return",
"true",
"if",
"we",
"should",
"sleep",
"and",
"try",
"again",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/evidence/reactor.go#L162-L193 |
131,142 | tendermint/tendermint | lite/proxy/wrapper.go | SecureClient | func SecureClient(c rpcclient.Client, cert *lite.DynamicVerifier) Wrapper {
prt := defaultProofRuntime()
wrap := Wrapper{c, cert, prt}
// TODO: no longer possible as no more such interface exposed....
// if we wrap http client, then we can swap out the event switch to filter
// if hc, ok := c.(*rpcclient.HTTP); ok... | go | func SecureClient(c rpcclient.Client, cert *lite.DynamicVerifier) Wrapper {
prt := defaultProofRuntime()
wrap := Wrapper{c, cert, prt}
// TODO: no longer possible as no more such interface exposed....
// if we wrap http client, then we can swap out the event switch to filter
// if hc, ok := c.(*rpcclient.HTTP); ok... | [
"func",
"SecureClient",
"(",
"c",
"rpcclient",
".",
"Client",
",",
"cert",
"*",
"lite",
".",
"DynamicVerifier",
")",
"Wrapper",
"{",
"prt",
":=",
"defaultProofRuntime",
"(",
")",
"\n",
"wrap",
":=",
"Wrapper",
"{",
"c",
",",
"cert",
",",
"prt",
"}",
"\... | // SecureClient uses a given Verifier to wrap an connection to an untrusted
// host and return a cryptographically secure rpc client.
//
// If it is wrapping an HTTP rpcclient, it will also wrap the websocket interface | [
"SecureClient",
"uses",
"a",
"given",
"Verifier",
"to",
"wrap",
"an",
"connection",
"to",
"an",
"untrusted",
"host",
"and",
"return",
"a",
"cryptographically",
"secure",
"rpc",
"client",
".",
"If",
"it",
"is",
"wrapping",
"an",
"HTTP",
"rpcclient",
"it",
"wi... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L30-L40 |
131,143 | tendermint/tendermint | lite/proxy/wrapper.go | ABCIQueryWithOptions | func (w Wrapper) ABCIQueryWithOptions(path string, data cmn.HexBytes,
opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
res, err := GetWithProofOptions(w.prt, path, data, opts, w.Client, w.cert)
return res, err
} | go | func (w Wrapper) ABCIQueryWithOptions(path string, data cmn.HexBytes,
opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
res, err := GetWithProofOptions(w.prt, path, data, opts, w.Client, w.cert)
return res, err
} | [
"func",
"(",
"w",
"Wrapper",
")",
"ABCIQueryWithOptions",
"(",
"path",
"string",
",",
"data",
"cmn",
".",
"HexBytes",
",",
"opts",
"rpcclient",
".",
"ABCIQueryOptions",
")",
"(",
"*",
"ctypes",
".",
"ResultABCIQuery",
",",
"error",
")",
"{",
"res",
",",
... | // ABCIQueryWithOptions exposes all options for the ABCI query and verifies the returned proof | [
"ABCIQueryWithOptions",
"exposes",
"all",
"options",
"for",
"the",
"ABCI",
"query",
"and",
"verifies",
"the",
"returned",
"proof"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L43-L48 |
131,144 | tendermint/tendermint | lite/proxy/wrapper.go | ABCIQuery | func (w Wrapper) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
return w.ABCIQueryWithOptions(path, data, rpcclient.DefaultABCIQueryOptions)
} | go | func (w Wrapper) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
return w.ABCIQueryWithOptions(path, data, rpcclient.DefaultABCIQueryOptions)
} | [
"func",
"(",
"w",
"Wrapper",
")",
"ABCIQuery",
"(",
"path",
"string",
",",
"data",
"cmn",
".",
"HexBytes",
")",
"(",
"*",
"ctypes",
".",
"ResultABCIQuery",
",",
"error",
")",
"{",
"return",
"w",
".",
"ABCIQueryWithOptions",
"(",
"path",
",",
"data",
",... | // ABCIQuery uses default options for the ABCI query and verifies the returned proof | [
"ABCIQuery",
"uses",
"default",
"options",
"for",
"the",
"ABCI",
"query",
"and",
"verifies",
"the",
"returned",
"proof"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L51-L53 |
131,145 | tendermint/tendermint | lite/proxy/wrapper.go | Tx | func (w Wrapper) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
res, err := w.Client.Tx(hash, prove)
if !prove || err != nil {
return res, err
}
h := int64(res.Height)
sh, err := GetCertifiedCommit(h, w.Client, w.cert)
if err != nil {
return res, err
}
err = res.Proof.Validate(sh.DataHash)
return ... | go | func (w Wrapper) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
res, err := w.Client.Tx(hash, prove)
if !prove || err != nil {
return res, err
}
h := int64(res.Height)
sh, err := GetCertifiedCommit(h, w.Client, w.cert)
if err != nil {
return res, err
}
err = res.Proof.Validate(sh.DataHash)
return ... | [
"func",
"(",
"w",
"Wrapper",
")",
"Tx",
"(",
"hash",
"[",
"]",
"byte",
",",
"prove",
"bool",
")",
"(",
"*",
"ctypes",
".",
"ResultTx",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"w",
".",
"Client",
".",
"Tx",
"(",
"hash",
",",
"prove",
... | // Tx queries for a given tx and verifies the proof if it was requested | [
"Tx",
"queries",
"for",
"a",
"given",
"tx",
"and",
"verifies",
"the",
"proof",
"if",
"it",
"was",
"requested"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L56-L68 |
131,146 | tendermint/tendermint | lite/proxy/wrapper.go | Block | func (w Wrapper) Block(height *int64) (*ctypes.ResultBlock, error) {
resBlock, err := w.Client.Block(height)
if err != nil {
return nil, err
}
// get a checkpoint to verify from
resCommit, err := w.Commit(height)
if err != nil {
return nil, err
}
sh := resCommit.SignedHeader
// now verify
err = ValidateB... | go | func (w Wrapper) Block(height *int64) (*ctypes.ResultBlock, error) {
resBlock, err := w.Client.Block(height)
if err != nil {
return nil, err
}
// get a checkpoint to verify from
resCommit, err := w.Commit(height)
if err != nil {
return nil, err
}
sh := resCommit.SignedHeader
// now verify
err = ValidateB... | [
"func",
"(",
"w",
"Wrapper",
")",
"Block",
"(",
"height",
"*",
"int64",
")",
"(",
"*",
"ctypes",
".",
"ResultBlock",
",",
"error",
")",
"{",
"resBlock",
",",
"err",
":=",
"w",
".",
"Client",
".",
"Block",
"(",
"height",
")",
"\n",
"if",
"err",
"!... | // Block returns an entire block and verifies all signatures | [
"Block",
"returns",
"an",
"entire",
"block",
"and",
"verifies",
"all",
"signatures"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L98-L120 |
131,147 | tendermint/tendermint | lite/proxy/wrapper.go | Commit | func (w Wrapper) Commit(height *int64) (*ctypes.ResultCommit, error) {
if height == nil {
resStatus, err := w.Client.Status()
if err != nil {
return nil, err
}
// NOTE: If resStatus.CatchingUp, there is a race
// condition where the validator set for the next height
// isn't available until some time af... | go | func (w Wrapper) Commit(height *int64) (*ctypes.ResultCommit, error) {
if height == nil {
resStatus, err := w.Client.Status()
if err != nil {
return nil, err
}
// NOTE: If resStatus.CatchingUp, there is a race
// condition where the validator set for the next height
// isn't available until some time af... | [
"func",
"(",
"w",
"Wrapper",
")",
"Commit",
"(",
"height",
"*",
"int64",
")",
"(",
"*",
"ctypes",
".",
"ResultCommit",
",",
"error",
")",
"{",
"if",
"height",
"==",
"nil",
"{",
"resStatus",
",",
"err",
":=",
"w",
".",
"Client",
".",
"Status",
"(",
... | // Commit downloads the Commit and certifies it with the lite.
//
// This is the foundation for all other verification in this module | [
"Commit",
"downloads",
"the",
"Commit",
"and",
"certifies",
"it",
"with",
"the",
"lite",
".",
"This",
"is",
"the",
"foundation",
"for",
"all",
"other",
"verification",
"in",
"this",
"module"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L125-L150 |
131,148 | tendermint/tendermint | lite/proxy/wrapper.go | UnsubscribeWS | func (w Wrapper) UnsubscribeWS(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error) {
err := w.Client.Unsubscribe(context.Background(), ctx.RemoteAddr(), query)
if err != nil {
return nil, err
}
return &ctypes.ResultUnsubscribe{}, nil
} | go | func (w Wrapper) UnsubscribeWS(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error) {
err := w.Client.Unsubscribe(context.Background(), ctx.RemoteAddr(), query)
if err != nil {
return nil, err
}
return &ctypes.ResultUnsubscribe{}, nil
} | [
"func",
"(",
"w",
"Wrapper",
")",
"UnsubscribeWS",
"(",
"ctx",
"*",
"rpctypes",
".",
"Context",
",",
"query",
"string",
")",
"(",
"*",
"ctypes",
".",
"ResultUnsubscribe",
",",
"error",
")",
"{",
"err",
":=",
"w",
".",
"Client",
".",
"Unsubscribe",
"(",... | // UnsubscribeWS calls original client's Unsubscribe using remote address as a
// subscriber. | [
"UnsubscribeWS",
"calls",
"original",
"client",
"s",
"Unsubscribe",
"using",
"remote",
"address",
"as",
"a",
"subscriber",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L187-L193 |
131,149 | tendermint/tendermint | lite/proxy/wrapper.go | UnsubscribeAllWS | func (w Wrapper) UnsubscribeAllWS(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error) {
err := w.Client.UnsubscribeAll(context.Background(), ctx.RemoteAddr())
if err != nil {
return nil, err
}
return &ctypes.ResultUnsubscribe{}, nil
} | go | func (w Wrapper) UnsubscribeAllWS(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error) {
err := w.Client.UnsubscribeAll(context.Background(), ctx.RemoteAddr())
if err != nil {
return nil, err
}
return &ctypes.ResultUnsubscribe{}, nil
} | [
"func",
"(",
"w",
"Wrapper",
")",
"UnsubscribeAllWS",
"(",
"ctx",
"*",
"rpctypes",
".",
"Context",
")",
"(",
"*",
"ctypes",
".",
"ResultUnsubscribe",
",",
"error",
")",
"{",
"err",
":=",
"w",
".",
"Client",
".",
"UnsubscribeAll",
"(",
"context",
".",
"... | // UnsubscribeAllWS calls original client's UnsubscribeAll using remote address
// as a subscriber. | [
"UnsubscribeAllWS",
"calls",
"original",
"client",
"s",
"UnsubscribeAll",
"using",
"remote",
"address",
"as",
"a",
"subscriber",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/lite/proxy/wrapper.go#L197-L203 |
131,150 | tendermint/tendermint | libs/common/service.go | NewBaseService | func NewBaseService(logger log.Logger, name string, impl Service) *BaseService {
if logger == nil {
logger = log.NewNopLogger()
}
return &BaseService{
Logger: logger,
name: name,
quit: make(chan struct{}),
impl: impl,
}
} | go | func NewBaseService(logger log.Logger, name string, impl Service) *BaseService {
if logger == nil {
logger = log.NewNopLogger()
}
return &BaseService{
Logger: logger,
name: name,
quit: make(chan struct{}),
impl: impl,
}
} | [
"func",
"NewBaseService",
"(",
"logger",
"log",
".",
"Logger",
",",
"name",
"string",
",",
"impl",
"Service",
")",
"*",
"BaseService",
"{",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n\n",
"retur... | // NewBaseService creates a new BaseService. | [
"NewBaseService",
"creates",
"a",
"new",
"BaseService",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/common/service.go#L109-L120 |
131,151 | tendermint/tendermint | libs/common/service.go | IsRunning | func (bs *BaseService) IsRunning() bool {
return atomic.LoadUint32(&bs.started) == 1 && atomic.LoadUint32(&bs.stopped) == 0
} | go | func (bs *BaseService) IsRunning() bool {
return atomic.LoadUint32(&bs.started) == 1 && atomic.LoadUint32(&bs.stopped) == 0
} | [
"func",
"(",
"bs",
"*",
"BaseService",
")",
"IsRunning",
"(",
")",
"bool",
"{",
"return",
"atomic",
".",
"LoadUint32",
"(",
"&",
"bs",
".",
"started",
")",
"==",
"1",
"&&",
"atomic",
".",
"LoadUint32",
"(",
"&",
"bs",
".",
"stopped",
")",
"==",
"0"... | // IsRunning implements Service by returning true or false depending on the
// service's state. | [
"IsRunning",
"implements",
"Service",
"by",
"returning",
"true",
"or",
"false",
"depending",
"on",
"the",
"service",
"s",
"state",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/libs/common/service.go#L203-L205 |
131,152 | tendermint/tendermint | blockchain/reactor.go | NewBlockchainReactor | func NewBlockchainReactor(state sm.State, blockExec *sm.BlockExecutor, store *BlockStore,
fastSync bool) *BlockchainReactor {
if state.LastBlockHeight != store.Height() {
panic(fmt.Sprintf("state (%v) and store (%v) height mismatch", state.LastBlockHeight,
store.Height()))
}
requestsCh := make(chan BlockRequ... | go | func NewBlockchainReactor(state sm.State, blockExec *sm.BlockExecutor, store *BlockStore,
fastSync bool) *BlockchainReactor {
if state.LastBlockHeight != store.Height() {
panic(fmt.Sprintf("state (%v) and store (%v) height mismatch", state.LastBlockHeight,
store.Height()))
}
requestsCh := make(chan BlockRequ... | [
"func",
"NewBlockchainReactor",
"(",
"state",
"sm",
".",
"State",
",",
"blockExec",
"*",
"sm",
".",
"BlockExecutor",
",",
"store",
"*",
"BlockStore",
",",
"fastSync",
"bool",
")",
"*",
"BlockchainReactor",
"{",
"if",
"state",
".",
"LastBlockHeight",
"!=",
"s... | // NewBlockchainReactor returns new reactor instance. | [
"NewBlockchainReactor",
"returns",
"new",
"reactor",
"instance",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/blockchain/reactor.go#L72-L102 |
131,153 | tendermint/tendermint | blockchain/reactor.go | SetLogger | func (bcR *BlockchainReactor) SetLogger(l log.Logger) {
bcR.BaseService.Logger = l
bcR.pool.Logger = l
} | go | func (bcR *BlockchainReactor) SetLogger(l log.Logger) {
bcR.BaseService.Logger = l
bcR.pool.Logger = l
} | [
"func",
"(",
"bcR",
"*",
"BlockchainReactor",
")",
"SetLogger",
"(",
"l",
"log",
".",
"Logger",
")",
"{",
"bcR",
".",
"BaseService",
".",
"Logger",
"=",
"l",
"\n",
"bcR",
".",
"pool",
".",
"Logger",
"=",
"l",
"\n",
"}"
] | // SetLogger implements cmn.Service by setting the logger on reactor and pool. | [
"SetLogger",
"implements",
"cmn",
".",
"Service",
"by",
"setting",
"the",
"logger",
"on",
"reactor",
"and",
"pool",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/blockchain/reactor.go#L105-L108 |
131,154 | tendermint/tendermint | blockchain/reactor.go | AddPeer | func (bcR *BlockchainReactor) AddPeer(peer p2p.Peer) {
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusResponseMessage{bcR.store.Height()})
if !peer.Send(BlockchainChannel, msgBytes) {
// doing nothing, will try later in `poolRoutine`
}
// peer is added to the pool once we receive the first
// bcStatusResponseMes... | go | func (bcR *BlockchainReactor) AddPeer(peer p2p.Peer) {
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusResponseMessage{bcR.store.Height()})
if !peer.Send(BlockchainChannel, msgBytes) {
// doing nothing, will try later in `poolRoutine`
}
// peer is added to the pool once we receive the first
// bcStatusResponseMes... | [
"func",
"(",
"bcR",
"*",
"BlockchainReactor",
")",
"AddPeer",
"(",
"peer",
"p2p",
".",
"Peer",
")",
"{",
"msgBytes",
":=",
"cdc",
".",
"MustMarshalBinaryBare",
"(",
"&",
"bcStatusResponseMessage",
"{",
"bcR",
".",
"store",
".",
"Height",
"(",
")",
"}",
"... | // AddPeer implements Reactor by sending our state to peer. | [
"AddPeer",
"implements",
"Reactor",
"by",
"sending",
"our",
"state",
"to",
"peer",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/blockchain/reactor.go#L141-L148 |
131,155 | tendermint/tendermint | blockchain/reactor.go | RemovePeer | func (bcR *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{}) {
bcR.pool.RemovePeer(peer.ID())
} | go | func (bcR *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{}) {
bcR.pool.RemovePeer(peer.ID())
} | [
"func",
"(",
"bcR",
"*",
"BlockchainReactor",
")",
"RemovePeer",
"(",
"peer",
"p2p",
".",
"Peer",
",",
"reason",
"interface",
"{",
"}",
")",
"{",
"bcR",
".",
"pool",
".",
"RemovePeer",
"(",
"peer",
".",
"ID",
"(",
")",
")",
"\n",
"}"
] | // RemovePeer implements Reactor by removing peer from the pool. | [
"RemovePeer",
"implements",
"Reactor",
"by",
"removing",
"peer",
"from",
"the",
"pool",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/blockchain/reactor.go#L151-L153 |
131,156 | tendermint/tendermint | blockchain/reactor.go | respondToPeer | func (bcR *BlockchainReactor) respondToPeer(msg *bcBlockRequestMessage,
src p2p.Peer) (queued bool) {
block := bcR.store.LoadBlock(msg.Height)
if block != nil {
msgBytes := cdc.MustMarshalBinaryBare(&bcBlockResponseMessage{Block: block})
return src.TrySend(BlockchainChannel, msgBytes)
}
bcR.Logger.Info("Peer... | go | func (bcR *BlockchainReactor) respondToPeer(msg *bcBlockRequestMessage,
src p2p.Peer) (queued bool) {
block := bcR.store.LoadBlock(msg.Height)
if block != nil {
msgBytes := cdc.MustMarshalBinaryBare(&bcBlockResponseMessage{Block: block})
return src.TrySend(BlockchainChannel, msgBytes)
}
bcR.Logger.Info("Peer... | [
"func",
"(",
"bcR",
"*",
"BlockchainReactor",
")",
"respondToPeer",
"(",
"msg",
"*",
"bcBlockRequestMessage",
",",
"src",
"p2p",
".",
"Peer",
")",
"(",
"queued",
"bool",
")",
"{",
"block",
":=",
"bcR",
".",
"store",
".",
"LoadBlock",
"(",
"msg",
".",
"... | // respondToPeer loads a block and sends it to the requesting peer,
// if we have it. Otherwise, we'll respond saying we don't have it.
// According to the Tendermint spec, if all nodes are honest,
// no node should be requesting for a block that's non-existent. | [
"respondToPeer",
"loads",
"a",
"block",
"and",
"sends",
"it",
"to",
"the",
"requesting",
"peer",
"if",
"we",
"have",
"it",
".",
"Otherwise",
"we",
"ll",
"respond",
"saying",
"we",
"don",
"t",
"have",
"it",
".",
"According",
"to",
"the",
"Tendermint",
"sp... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/blockchain/reactor.go#L159-L172 |
131,157 | tendermint/tendermint | blockchain/reactor.go | BroadcastStatusRequest | func (bcR *BlockchainReactor) BroadcastStatusRequest() error {
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusRequestMessage{bcR.store.Height()})
bcR.Switch.Broadcast(BlockchainChannel, msgBytes)
return nil
} | go | func (bcR *BlockchainReactor) BroadcastStatusRequest() error {
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusRequestMessage{bcR.store.Height()})
bcR.Switch.Broadcast(BlockchainChannel, msgBytes)
return nil
} | [
"func",
"(",
"bcR",
"*",
"BlockchainReactor",
")",
"BroadcastStatusRequest",
"(",
")",
"error",
"{",
"msgBytes",
":=",
"cdc",
".",
"MustMarshalBinaryBare",
"(",
"&",
"bcStatusRequestMessage",
"{",
"bcR",
".",
"store",
".",
"Height",
"(",
")",
"}",
")",
"\n",... | // BroadcastStatusRequest broadcasts `BlockStore` height. | [
"BroadcastStatusRequest",
"broadcasts",
"BlockStore",
"height",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/blockchain/reactor.go#L367-L371 |
131,158 | tendermint/tendermint | crypto/secp256k1/secp256k1.go | PubKey | func (privKey PrivKeySecp256k1) PubKey() crypto.PubKey {
_, pubkeyObject := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey[:])
var pubkeyBytes PubKeySecp256k1
copy(pubkeyBytes[:], pubkeyObject.SerializeCompressed())
return pubkeyBytes
} | go | func (privKey PrivKeySecp256k1) PubKey() crypto.PubKey {
_, pubkeyObject := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey[:])
var pubkeyBytes PubKeySecp256k1
copy(pubkeyBytes[:], pubkeyObject.SerializeCompressed())
return pubkeyBytes
} | [
"func",
"(",
"privKey",
"PrivKeySecp256k1",
")",
"PubKey",
"(",
")",
"crypto",
".",
"PubKey",
"{",
"_",
",",
"pubkeyObject",
":=",
"secp256k1",
".",
"PrivKeyFromBytes",
"(",
"secp256k1",
".",
"S256",
"(",
")",
",",
"privKey",
"[",
":",
"]",
")",
"\n",
... | // PubKey performs the point-scalar multiplication from the privKey on the
// generator point to get the pubkey. | [
"PubKey",
"performs",
"the",
"point",
"-",
"scalar",
"multiplication",
"from",
"the",
"privKey",
"on",
"the",
"generator",
"point",
"to",
"get",
"the",
"pubkey",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/secp256k1/secp256k1.go#L52-L57 |
131,159 | tendermint/tendermint | crypto/secp256k1/secp256k1.go | Equals | func (privKey PrivKeySecp256k1) Equals(other crypto.PrivKey) bool {
if otherSecp, ok := other.(PrivKeySecp256k1); ok {
return subtle.ConstantTimeCompare(privKey[:], otherSecp[:]) == 1
}
return false
} | go | func (privKey PrivKeySecp256k1) Equals(other crypto.PrivKey) bool {
if otherSecp, ok := other.(PrivKeySecp256k1); ok {
return subtle.ConstantTimeCompare(privKey[:], otherSecp[:]) == 1
}
return false
} | [
"func",
"(",
"privKey",
"PrivKeySecp256k1",
")",
"Equals",
"(",
"other",
"crypto",
".",
"PrivKey",
")",
"bool",
"{",
"if",
"otherSecp",
",",
"ok",
":=",
"other",
".",
"(",
"PrivKeySecp256k1",
")",
";",
"ok",
"{",
"return",
"subtle",
".",
"ConstantTimeCompa... | // Equals - you probably don't need to use this.
// Runs in constant time based on length of the keys. | [
"Equals",
"-",
"you",
"probably",
"don",
"t",
"need",
"to",
"use",
"this",
".",
"Runs",
"in",
"constant",
"time",
"based",
"on",
"length",
"of",
"the",
"keys",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/secp256k1/secp256k1.go#L61-L66 |
131,160 | tendermint/tendermint | crypto/secp256k1/secp256k1.go | genPrivKey | func genPrivKey(rand io.Reader) PrivKeySecp256k1 {
var privKeyBytes [32]byte
d := new(big.Int)
for {
privKeyBytes = [32]byte{}
_, err := io.ReadFull(rand, privKeyBytes[:])
if err != nil {
panic(err)
}
d.SetBytes(privKeyBytes[:])
// break if we found a valid point (i.e. > 0 and < N == curverOrder)
i... | go | func genPrivKey(rand io.Reader) PrivKeySecp256k1 {
var privKeyBytes [32]byte
d := new(big.Int)
for {
privKeyBytes = [32]byte{}
_, err := io.ReadFull(rand, privKeyBytes[:])
if err != nil {
panic(err)
}
d.SetBytes(privKeyBytes[:])
// break if we found a valid point (i.e. > 0 and < N == curverOrder)
i... | [
"func",
"genPrivKey",
"(",
"rand",
"io",
".",
"Reader",
")",
"PrivKeySecp256k1",
"{",
"var",
"privKeyBytes",
"[",
"32",
"]",
"byte",
"\n",
"d",
":=",
"new",
"(",
"big",
".",
"Int",
")",
"\n",
"for",
"{",
"privKeyBytes",
"=",
"[",
"32",
"]",
"byte",
... | // genPrivKey generates a new secp256k1 private key using the provided reader. | [
"genPrivKey",
"generates",
"a",
"new",
"secp256k1",
"private",
"key",
"using",
"the",
"provided",
"reader",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/secp256k1/secp256k1.go#L75-L94 |
131,161 | tendermint/tendermint | types/evidence.go | String | func (dve *DuplicateVoteEvidence) String() string {
return fmt.Sprintf("VoteA: %v; VoteB: %v", dve.VoteA, dve.VoteB)
} | go | func (dve *DuplicateVoteEvidence) String() string {
return fmt.Sprintf("VoteA: %v; VoteB: %v", dve.VoteA, dve.VoteB)
} | [
"func",
"(",
"dve",
"*",
"DuplicateVoteEvidence",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"dve",
".",
"VoteA",
",",
"dve",
".",
"VoteB",
")",
"\n\n",
"}"
] | // String returns a string representation of the evidence. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"evidence",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/evidence.go#L107-L110 |
131,162 | tendermint/tendermint | types/evidence.go | Equal | func (dve *DuplicateVoteEvidence) Equal(ev Evidence) bool {
if _, ok := ev.(*DuplicateVoteEvidence); !ok {
return false
}
// just check their hashes
dveHash := tmhash.Sum(cdcEncode(dve))
evHash := tmhash.Sum(cdcEncode(ev))
return bytes.Equal(dveHash, evHash)
} | go | func (dve *DuplicateVoteEvidence) Equal(ev Evidence) bool {
if _, ok := ev.(*DuplicateVoteEvidence); !ok {
return false
}
// just check their hashes
dveHash := tmhash.Sum(cdcEncode(dve))
evHash := tmhash.Sum(cdcEncode(ev))
return bytes.Equal(dveHash, evHash)
} | [
"func",
"(",
"dve",
"*",
"DuplicateVoteEvidence",
")",
"Equal",
"(",
"ev",
"Evidence",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"ev",
".",
"(",
"*",
"DuplicateVoteEvidence",
")",
";",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// jus... | // Equal checks if two pieces of evidence are equal. | [
"Equal",
"checks",
"if",
"two",
"pieces",
"of",
"evidence",
"are",
"equal",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/evidence.go#L176-L185 |
131,163 | tendermint/tendermint | types/evidence.go | Hash | func (evl EvidenceList) Hash() []byte {
// These allocations are required because Evidence is not of type Bytes, and
// golang slices can't be typed cast. This shouldn't be a performance problem since
// the Evidence size is capped.
evidenceBzs := make([][]byte, len(evl))
for i := 0; i < len(evl); i++ {
evidence... | go | func (evl EvidenceList) Hash() []byte {
// These allocations are required because Evidence is not of type Bytes, and
// golang slices can't be typed cast. This shouldn't be a performance problem since
// the Evidence size is capped.
evidenceBzs := make([][]byte, len(evl))
for i := 0; i < len(evl); i++ {
evidence... | [
"func",
"(",
"evl",
"EvidenceList",
")",
"Hash",
"(",
")",
"[",
"]",
"byte",
"{",
"// These allocations are required because Evidence is not of type Bytes, and",
"// golang slices can't be typed cast. This shouldn't be a performance problem since",
"// the Evidence size is capped.",
"e... | // Hash returns the simple merkle root hash of the EvidenceList. | [
"Hash",
"returns",
"the",
"simple",
"merkle",
"root",
"hash",
"of",
"the",
"EvidenceList",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/evidence.go#L281-L290 |
131,164 | tendermint/tendermint | types/evidence.go | Has | func (evl EvidenceList) Has(evidence Evidence) bool {
for _, ev := range evl {
if ev.Equal(evidence) {
return true
}
}
return false
} | go | func (evl EvidenceList) Has(evidence Evidence) bool {
for _, ev := range evl {
if ev.Equal(evidence) {
return true
}
}
return false
} | [
"func",
"(",
"evl",
"EvidenceList",
")",
"Has",
"(",
"evidence",
"Evidence",
")",
"bool",
"{",
"for",
"_",
",",
"ev",
":=",
"range",
"evl",
"{",
"if",
"ev",
".",
"Equal",
"(",
"evidence",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"r... | // Has returns true if the evidence is in the EvidenceList. | [
"Has",
"returns",
"true",
"if",
"the",
"evidence",
"is",
"in",
"the",
"EvidenceList",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/types/evidence.go#L301-L308 |
131,165 | tendermint/tendermint | privval/socket_listeners.go | TCPListenerTimeoutAccept | func TCPListenerTimeoutAccept(timeout time.Duration) TCPListenerOption {
return func(tl *tcpListener) { tl.timeoutAccept = timeout }
} | go | func TCPListenerTimeoutAccept(timeout time.Duration) TCPListenerOption {
return func(tl *tcpListener) { tl.timeoutAccept = timeout }
} | [
"func",
"TCPListenerTimeoutAccept",
"(",
"timeout",
"time",
".",
"Duration",
")",
"TCPListenerOption",
"{",
"return",
"func",
"(",
"tl",
"*",
"tcpListener",
")",
"{",
"tl",
".",
"timeoutAccept",
"=",
"timeout",
"}",
"\n",
"}"
] | // TCPListenerTimeoutAccept sets the timeout for the listener.
// A zero time value disables the timeout. | [
"TCPListenerTimeoutAccept",
"sets",
"the",
"timeout",
"for",
"the",
"listener",
".",
"A",
"zero",
"time",
"value",
"disables",
"the",
"timeout",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_listeners.go#L30-L32 |
131,166 | tendermint/tendermint | privval/socket_listeners.go | TCPListenerTimeoutReadWrite | func TCPListenerTimeoutReadWrite(timeout time.Duration) TCPListenerOption {
return func(tl *tcpListener) { tl.timeoutReadWrite = timeout }
} | go | func TCPListenerTimeoutReadWrite(timeout time.Duration) TCPListenerOption {
return func(tl *tcpListener) { tl.timeoutReadWrite = timeout }
} | [
"func",
"TCPListenerTimeoutReadWrite",
"(",
"timeout",
"time",
".",
"Duration",
")",
"TCPListenerOption",
"{",
"return",
"func",
"(",
"tl",
"*",
"tcpListener",
")",
"{",
"tl",
".",
"timeoutReadWrite",
"=",
"timeout",
"}",
"\n",
"}"
] | // TCPListenerTimeoutReadWrite sets the read and write timeout for connections
// from external signing processes. | [
"TCPListenerTimeoutReadWrite",
"sets",
"the",
"read",
"and",
"write",
"timeout",
"for",
"connections",
"from",
"external",
"signing",
"processes",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_listeners.go#L36-L38 |
131,167 | tendermint/tendermint | privval/socket_listeners.go | NewTCPListener | func NewTCPListener(ln net.Listener, secretConnKey ed25519.PrivKeyEd25519) *tcpListener {
return &tcpListener{
TCPListener: ln.(*net.TCPListener),
secretConnKey: secretConnKey,
timeoutAccept: time.Second * defaultTimeoutAcceptSeconds,
timeoutReadWrite: time.Second * defaultTimeoutReadWriteSeconds,
... | go | func NewTCPListener(ln net.Listener, secretConnKey ed25519.PrivKeyEd25519) *tcpListener {
return &tcpListener{
TCPListener: ln.(*net.TCPListener),
secretConnKey: secretConnKey,
timeoutAccept: time.Second * defaultTimeoutAcceptSeconds,
timeoutReadWrite: time.Second * defaultTimeoutReadWriteSeconds,
... | [
"func",
"NewTCPListener",
"(",
"ln",
"net",
".",
"Listener",
",",
"secretConnKey",
"ed25519",
".",
"PrivKeyEd25519",
")",
"*",
"tcpListener",
"{",
"return",
"&",
"tcpListener",
"{",
"TCPListener",
":",
"ln",
".",
"(",
"*",
"net",
".",
"TCPListener",
")",
"... | // NewTCPListener returns a listener that accepts authenticated encrypted connections
// using the given secretConnKey and the default timeout values. | [
"NewTCPListener",
"returns",
"a",
"listener",
"that",
"accepts",
"authenticated",
"encrypted",
"connections",
"using",
"the",
"given",
"secretConnKey",
"and",
"the",
"default",
"timeout",
"values",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_listeners.go#L56-L63 |
131,168 | tendermint/tendermint | privval/socket_listeners.go | UnixListenerTimeoutAccept | func UnixListenerTimeoutAccept(timeout time.Duration) UnixListenerOption {
return func(ul *unixListener) { ul.timeoutAccept = timeout }
} | go | func UnixListenerTimeoutAccept(timeout time.Duration) UnixListenerOption {
return func(ul *unixListener) { ul.timeoutAccept = timeout }
} | [
"func",
"UnixListenerTimeoutAccept",
"(",
"timeout",
"time",
".",
"Duration",
")",
"UnixListenerOption",
"{",
"return",
"func",
"(",
"ul",
"*",
"unixListener",
")",
"{",
"ul",
".",
"timeoutAccept",
"=",
"timeout",
"}",
"\n",
"}"
] | // UnixListenerTimeoutAccept sets the timeout for the listener.
// A zero time value disables the timeout. | [
"UnixListenerTimeoutAccept",
"sets",
"the",
"timeout",
"for",
"the",
"listener",
".",
"A",
"zero",
"time",
"value",
"disables",
"the",
"timeout",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_listeners.go#L98-L100 |
131,169 | tendermint/tendermint | privval/socket_listeners.go | UnixListenerTimeoutReadWrite | func UnixListenerTimeoutReadWrite(timeout time.Duration) UnixListenerOption {
return func(ul *unixListener) { ul.timeoutReadWrite = timeout }
} | go | func UnixListenerTimeoutReadWrite(timeout time.Duration) UnixListenerOption {
return func(ul *unixListener) { ul.timeoutReadWrite = timeout }
} | [
"func",
"UnixListenerTimeoutReadWrite",
"(",
"timeout",
"time",
".",
"Duration",
")",
"UnixListenerOption",
"{",
"return",
"func",
"(",
"ul",
"*",
"unixListener",
")",
"{",
"ul",
".",
"timeoutReadWrite",
"=",
"timeout",
"}",
"\n",
"}"
] | // UnixListenerTimeoutReadWrite sets the read and write timeout for connections
// from external signing processes. | [
"UnixListenerTimeoutReadWrite",
"sets",
"the",
"read",
"and",
"write",
"timeout",
"for",
"connections",
"from",
"external",
"signing",
"processes",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_listeners.go#L104-L106 |
131,170 | tendermint/tendermint | privval/socket_listeners.go | NewUnixListener | func NewUnixListener(ln net.Listener) *unixListener {
return &unixListener{
UnixListener: ln.(*net.UnixListener),
timeoutAccept: time.Second * defaultTimeoutAcceptSeconds,
timeoutReadWrite: time.Second * defaultTimeoutReadWriteSeconds,
}
} | go | func NewUnixListener(ln net.Listener) *unixListener {
return &unixListener{
UnixListener: ln.(*net.UnixListener),
timeoutAccept: time.Second * defaultTimeoutAcceptSeconds,
timeoutReadWrite: time.Second * defaultTimeoutReadWriteSeconds,
}
} | [
"func",
"NewUnixListener",
"(",
"ln",
"net",
".",
"Listener",
")",
"*",
"unixListener",
"{",
"return",
"&",
"unixListener",
"{",
"UnixListener",
":",
"ln",
".",
"(",
"*",
"net",
".",
"UnixListener",
")",
",",
"timeoutAccept",
":",
"time",
".",
"Second",
... | // NewUnixListener returns a listener that accepts unencrypted connections
// using the default timeout values. | [
"NewUnixListener",
"returns",
"a",
"listener",
"that",
"accepts",
"unencrypted",
"connections",
"using",
"the",
"default",
"timeout",
"values",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/socket_listeners.go#L119-L125 |
131,171 | tendermint/tendermint | privval/signer_remote.go | NewSignerRemote | func NewSignerRemote(conn net.Conn) (*SignerRemote, error) {
// retrieve and memoize the consensus public key once.
pubKey, err := getPubKey(conn)
if err != nil {
return nil, cmn.ErrorWrap(err, "error while retrieving public key for remote signer")
}
return &SignerRemote{
conn: conn,
consensusPub... | go | func NewSignerRemote(conn net.Conn) (*SignerRemote, error) {
// retrieve and memoize the consensus public key once.
pubKey, err := getPubKey(conn)
if err != nil {
return nil, cmn.ErrorWrap(err, "error while retrieving public key for remote signer")
}
return &SignerRemote{
conn: conn,
consensusPub... | [
"func",
"NewSignerRemote",
"(",
"conn",
"net",
".",
"Conn",
")",
"(",
"*",
"SignerRemote",
",",
"error",
")",
"{",
"// retrieve and memoize the consensus public key once.",
"pubKey",
",",
"err",
":=",
"getPubKey",
"(",
"conn",
")",
"\n",
"if",
"err",
"!=",
"ni... | // NewSignerRemote returns an instance of SignerRemote. | [
"NewSignerRemote",
"returns",
"an",
"instance",
"of",
"SignerRemote",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/signer_remote.go#L28-L39 |
131,172 | tendermint/tendermint | privval/signer_remote.go | Ping | func (sc *SignerRemote) Ping() error {
err := writeMsg(sc.conn, &PingRequest{})
if err != nil {
return err
}
res, err := readMsg(sc.conn)
if err != nil {
return err
}
_, ok := res.(*PingResponse)
if !ok {
return ErrUnexpectedResponse
}
return nil
} | go | func (sc *SignerRemote) Ping() error {
err := writeMsg(sc.conn, &PingRequest{})
if err != nil {
return err
}
res, err := readMsg(sc.conn)
if err != nil {
return err
}
_, ok := res.(*PingResponse)
if !ok {
return ErrUnexpectedResponse
}
return nil
} | [
"func",
"(",
"sc",
"*",
"SignerRemote",
")",
"Ping",
"(",
")",
"error",
"{",
"err",
":=",
"writeMsg",
"(",
"sc",
".",
"conn",
",",
"&",
"PingRequest",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"res",
... | // Ping is used to check connection health. | [
"Ping",
"is",
"used",
"to",
"check",
"connection",
"health",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/privval/signer_remote.go#L123-L139 |
131,173 | tendermint/tendermint | p2p/conn/secret_connection.go | computeDHSecret | func computeDHSecret(remPubKey, locPrivKey *[32]byte) (shrKey *[32]byte, err error) {
shrKey = new([32]byte)
curve25519.ScalarMult(shrKey, locPrivKey, remPubKey)
// reject if the returned shared secret is all zeroes
// related to: https://github.com/tendermint/tendermint/issues/3010
zero := new([32]byte)
if subt... | go | func computeDHSecret(remPubKey, locPrivKey *[32]byte) (shrKey *[32]byte, err error) {
shrKey = new([32]byte)
curve25519.ScalarMult(shrKey, locPrivKey, remPubKey)
// reject if the returned shared secret is all zeroes
// related to: https://github.com/tendermint/tendermint/issues/3010
zero := new([32]byte)
if subt... | [
"func",
"computeDHSecret",
"(",
"remPubKey",
",",
"locPrivKey",
"*",
"[",
"32",
"]",
"byte",
")",
"(",
"shrKey",
"*",
"[",
"32",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"shrKey",
"=",
"new",
"(",
"[",
"32",
"]",
"byte",
")",
"\n",
"curve25519",... | // computeDHSecret computes a Diffie-Hellman shared secret key
// from our own local private key and the other's public key.
//
// It returns an error if the computed shared secret is all zeroes. | [
"computeDHSecret",
"computes",
"a",
"Diffie",
"-",
"Hellman",
"shared",
"secret",
"key",
"from",
"our",
"own",
"local",
"private",
"key",
"and",
"the",
"other",
"s",
"public",
"key",
".",
"It",
"returns",
"an",
"error",
"if",
"the",
"computed",
"shared",
"... | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/p2p/conn/secret_connection.go#L365-L376 |
131,174 | tendermint/tendermint | state/txindex/kv/kv.go | NewTxIndex | func NewTxIndex(store dbm.DB, options ...func(*TxIndex)) *TxIndex {
txi := &TxIndex{store: store, tagsToIndex: make([]string, 0), indexAllTags: false}
for _, o := range options {
o(txi)
}
return txi
} | go | func NewTxIndex(store dbm.DB, options ...func(*TxIndex)) *TxIndex {
txi := &TxIndex{store: store, tagsToIndex: make([]string, 0), indexAllTags: false}
for _, o := range options {
o(txi)
}
return txi
} | [
"func",
"NewTxIndex",
"(",
"store",
"dbm",
".",
"DB",
",",
"options",
"...",
"func",
"(",
"*",
"TxIndex",
")",
")",
"*",
"TxIndex",
"{",
"txi",
":=",
"&",
"TxIndex",
"{",
"store",
":",
"store",
",",
"tagsToIndex",
":",
"make",
"(",
"[",
"]",
"strin... | // NewTxIndex creates new KV indexer. | [
"NewTxIndex",
"creates",
"new",
"KV",
"indexer",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/txindex/kv/kv.go#L35-L41 |
131,175 | tendermint/tendermint | state/txindex/kv/kv.go | Get | func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) {
if len(hash) == 0 {
return nil, txindex.ErrorEmptyHash
}
rawBytes := txi.store.Get(hash)
if rawBytes == nil {
return nil, nil
}
txResult := new(types.TxResult)
err := cdc.UnmarshalBinaryBare(rawBytes, &txResult)
if err != nil {
return nil, ... | go | func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) {
if len(hash) == 0 {
return nil, txindex.ErrorEmptyHash
}
rawBytes := txi.store.Get(hash)
if rawBytes == nil {
return nil, nil
}
txResult := new(types.TxResult)
err := cdc.UnmarshalBinaryBare(rawBytes, &txResult)
if err != nil {
return nil, ... | [
"func",
"(",
"txi",
"*",
"TxIndex",
")",
"Get",
"(",
"hash",
"[",
"]",
"byte",
")",
"(",
"*",
"types",
".",
"TxResult",
",",
"error",
")",
"{",
"if",
"len",
"(",
"hash",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"txindex",
".",
"ErrorEmptyHash",... | // Get gets transaction from the TxIndex storage and returns it or nil if the
// transaction is not found. | [
"Get",
"gets",
"transaction",
"from",
"the",
"TxIndex",
"storage",
"and",
"returns",
"it",
"or",
"nil",
"if",
"the",
"transaction",
"is",
"not",
"found",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/txindex/kv/kv.go#L59-L76 |
131,176 | tendermint/tendermint | state/txindex/kv/kv.go | AddBatch | func (txi *TxIndex) AddBatch(b *txindex.Batch) error {
storeBatch := txi.store.NewBatch()
defer storeBatch.Close()
for _, result := range b.Ops {
hash := result.Tx.Hash()
// index tx by tags
for _, tag := range result.Result.Tags {
if txi.indexAllTags || cmn.StringInSlice(string(tag.Key), txi.tagsToIndex)... | go | func (txi *TxIndex) AddBatch(b *txindex.Batch) error {
storeBatch := txi.store.NewBatch()
defer storeBatch.Close()
for _, result := range b.Ops {
hash := result.Tx.Hash()
// index tx by tags
for _, tag := range result.Result.Tags {
if txi.indexAllTags || cmn.StringInSlice(string(tag.Key), txi.tagsToIndex)... | [
"func",
"(",
"txi",
"*",
"TxIndex",
")",
"AddBatch",
"(",
"b",
"*",
"txindex",
".",
"Batch",
")",
"error",
"{",
"storeBatch",
":=",
"txi",
".",
"store",
".",
"NewBatch",
"(",
")",
"\n",
"defer",
"storeBatch",
".",
"Close",
"(",
")",
"\n\n",
"for",
... | // AddBatch indexes a batch of transactions using the given list of tags. | [
"AddBatch",
"indexes",
"a",
"batch",
"of",
"transactions",
"using",
"the",
"given",
"list",
"of",
"tags",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/txindex/kv/kv.go#L79-L108 |
131,177 | tendermint/tendermint | state/txindex/kv/kv.go | lookForHeight | func lookForHeight(conditions []query.Condition) (height int64) {
for _, c := range conditions {
if c.Tag == types.TxHeightKey && c.Op == query.OpEqual {
return c.Operand.(int64)
}
}
return 0
} | go | func lookForHeight(conditions []query.Condition) (height int64) {
for _, c := range conditions {
if c.Tag == types.TxHeightKey && c.Op == query.OpEqual {
return c.Operand.(int64)
}
}
return 0
} | [
"func",
"lookForHeight",
"(",
"conditions",
"[",
"]",
"query",
".",
"Condition",
")",
"(",
"height",
"int64",
")",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"conditions",
"{",
"if",
"c",
".",
"Tag",
"==",
"types",
".",
"TxHeightKey",
"&&",
"c",
".",
... | // lookForHeight returns a height if there is an "height=X" condition. | [
"lookForHeight",
"returns",
"a",
"height",
"if",
"there",
"is",
"an",
"height",
"=",
"X",
"condition",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/state/txindex/kv/kv.go#L234-L241 |
131,178 | tendermint/tendermint | crypto/multisig/threshold_pubkey.go | Equals | func (pk PubKeyMultisigThreshold) Equals(other crypto.PubKey) bool {
otherKey, sameType := other.(PubKeyMultisigThreshold)
if !sameType {
return false
}
if pk.K != otherKey.K || len(pk.PubKeys) != len(otherKey.PubKeys) {
return false
}
for i := 0; i < len(pk.PubKeys); i++ {
if !pk.PubKeys[i].Equals(otherKey... | go | func (pk PubKeyMultisigThreshold) Equals(other crypto.PubKey) bool {
otherKey, sameType := other.(PubKeyMultisigThreshold)
if !sameType {
return false
}
if pk.K != otherKey.K || len(pk.PubKeys) != len(otherKey.PubKeys) {
return false
}
for i := 0; i < len(pk.PubKeys); i++ {
if !pk.PubKeys[i].Equals(otherKey... | [
"func",
"(",
"pk",
"PubKeyMultisigThreshold",
")",
"Equals",
"(",
"other",
"crypto",
".",
"PubKey",
")",
"bool",
"{",
"otherKey",
",",
"sameType",
":=",
"other",
".",
"(",
"PubKeyMultisigThreshold",
")",
"\n",
"if",
"!",
"sameType",
"{",
"return",
"false",
... | // Equals returns true iff pk and other both have the same number of keys, and
// all constituent keys are the same, and in the same order. | [
"Equals",
"returns",
"true",
"iff",
"pk",
"and",
"other",
"both",
"have",
"the",
"same",
"number",
"of",
"keys",
"and",
"all",
"constituent",
"keys",
"are",
"the",
"same",
"and",
"in",
"the",
"same",
"order",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/multisig/threshold_pubkey.go#L77-L91 |
131,179 | tendermint/tendermint | crypto/merkle/simple_tree.go | SimpleHashFromByteSlices | func SimpleHashFromByteSlices(items [][]byte) []byte {
switch len(items) {
case 0:
return nil
case 1:
return leafHash(items[0])
default:
k := getSplitPoint(len(items))
left := SimpleHashFromByteSlices(items[:k])
right := SimpleHashFromByteSlices(items[k:])
return innerHash(left, right)
}
} | go | func SimpleHashFromByteSlices(items [][]byte) []byte {
switch len(items) {
case 0:
return nil
case 1:
return leafHash(items[0])
default:
k := getSplitPoint(len(items))
left := SimpleHashFromByteSlices(items[:k])
right := SimpleHashFromByteSlices(items[k:])
return innerHash(left, right)
}
} | [
"func",
"SimpleHashFromByteSlices",
"(",
"items",
"[",
"]",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"switch",
"len",
"(",
"items",
")",
"{",
"case",
"0",
":",
"return",
"nil",
"\n",
"case",
"1",
":",
"return",
"leafHash",
"(",
"items",
"[",
"... | // SimpleHashFromByteSlices computes a Merkle tree where the leaves are the byte slice,
// in the provided order. | [
"SimpleHashFromByteSlices",
"computes",
"a",
"Merkle",
"tree",
"where",
"the",
"leaves",
"are",
"the",
"byte",
"slice",
"in",
"the",
"provided",
"order",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/merkle/simple_tree.go#L9-L21 |
131,180 | tendermint/tendermint | crypto/merkle/simple_tree.go | getSplitPoint | func getSplitPoint(length int) int {
if length < 1 {
panic("Trying to split a tree with size < 1")
}
uLength := uint(length)
bitlen := bits.Len(uLength)
k := 1 << uint(bitlen-1)
if k == length {
k >>= 1
}
return k
} | go | func getSplitPoint(length int) int {
if length < 1 {
panic("Trying to split a tree with size < 1")
}
uLength := uint(length)
bitlen := bits.Len(uLength)
k := 1 << uint(bitlen-1)
if k == length {
k >>= 1
}
return k
} | [
"func",
"getSplitPoint",
"(",
"length",
"int",
")",
"int",
"{",
"if",
"length",
"<",
"1",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"uLength",
":=",
"uint",
"(",
"length",
")",
"\n",
"bitlen",
":=",
"bits",
".",
"Len",
"(",
"uLength",
... | // getSplitPoint returns the largest power of 2 less than length | [
"getSplitPoint",
"returns",
"the",
"largest",
"power",
"of",
"2",
"less",
"than",
"length"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/crypto/merkle/simple_tree.go#L36-L47 |
131,181 | tendermint/tendermint | tools/tm-monitor/monitor/network.go | RecalculateUptime | func (n *Network) RecalculateUptime() {
n.mu.Lock()
defer n.mu.Unlock()
since := time.Since(n.UptimeData.StartTime)
uptime := since - n.UptimeData.totalDownTime
if n.Health != FullHealth {
uptime -= time.Since(n.UptimeData.wentDown)
}
n.UptimeData.Uptime = (float64(uptime) / float64(since)) * 100.0
} | go | func (n *Network) RecalculateUptime() {
n.mu.Lock()
defer n.mu.Unlock()
since := time.Since(n.UptimeData.StartTime)
uptime := since - n.UptimeData.totalDownTime
if n.Health != FullHealth {
uptime -= time.Since(n.UptimeData.wentDown)
}
n.UptimeData.Uptime = (float64(uptime) / float64(since)) * 100.0
} | [
"func",
"(",
"n",
"*",
"Network",
")",
"RecalculateUptime",
"(",
")",
"{",
"n",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"n",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"since",
":=",
"time",
".",
"Since",
"(",
"n",
".",
"UptimeData",
... | // RecalculateUptime calculates uptime on demand. | [
"RecalculateUptime",
"calculates",
"uptime",
"on",
"demand",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/network.go#L101-L111 |
131,182 | tendermint/tendermint | tools/tm-monitor/monitor/network.go | NodeIsDown | func (n *Network) NodeIsDown(name string) {
n.mu.Lock()
defer n.mu.Unlock()
if online, ok := n.nodeStatusMap[name]; !ok || online {
n.nodeStatusMap[name] = false
n.NumNodesMonitoredOnline--
n.UptimeData.wentDown = time.Now()
n.updateHealth()
}
} | go | func (n *Network) NodeIsDown(name string) {
n.mu.Lock()
defer n.mu.Unlock()
if online, ok := n.nodeStatusMap[name]; !ok || online {
n.nodeStatusMap[name] = false
n.NumNodesMonitoredOnline--
n.UptimeData.wentDown = time.Now()
n.updateHealth()
}
} | [
"func",
"(",
"n",
"*",
"Network",
")",
"NodeIsDown",
"(",
"name",
"string",
")",
"{",
"n",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"n",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"online",
",",
"ok",
":=",
"n",
".",
"nodeStatusM... | // NodeIsDown is called when the node disconnects for whatever reason.
// Must be safe to call multiple times. | [
"NodeIsDown",
"is",
"called",
"when",
"the",
"node",
"disconnects",
"for",
"whatever",
"reason",
".",
"Must",
"be",
"safe",
"to",
"call",
"multiple",
"times",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/network.go#L115-L125 |
131,183 | tendermint/tendermint | tools/tm-monitor/monitor/network.go | NewNode | func (n *Network) NewNode(name string) {
n.mu.Lock()
defer n.mu.Unlock()
n.NumNodesMonitored++
n.NumNodesMonitoredOnline++
n.updateHealth()
} | go | func (n *Network) NewNode(name string) {
n.mu.Lock()
defer n.mu.Unlock()
n.NumNodesMonitored++
n.NumNodesMonitoredOnline++
n.updateHealth()
} | [
"func",
"(",
"n",
"*",
"Network",
")",
"NewNode",
"(",
"name",
"string",
")",
"{",
"n",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"n",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"n",
".",
"NumNodesMonitored",
"++",
"\n",
"n",
".",
"NumN... | // NewNode is called when the new node is added to the monitor. | [
"NewNode",
"is",
"called",
"when",
"the",
"new",
"node",
"is",
"added",
"to",
"the",
"monitor",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/network.go#L142-L149 |
131,184 | tendermint/tendermint | tools/tm-monitor/monitor/network.go | Uptime | func (n *Network) Uptime() float64 {
n.mu.Lock()
defer n.mu.Unlock()
return n.UptimeData.Uptime
} | go | func (n *Network) Uptime() float64 {
n.mu.Lock()
defer n.mu.Unlock()
return n.UptimeData.Uptime
} | [
"func",
"(",
"n",
"*",
"Network",
")",
"Uptime",
"(",
")",
"float64",
"{",
"n",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"n",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"n",
".",
"UptimeData",
".",
"Uptime",
"\n",
"}"
] | // Uptime returns network's uptime in percentages. | [
"Uptime",
"returns",
"network",
"s",
"uptime",
"in",
"percentages",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/monitor/network.go#L198-L202 |
131,185 | tendermint/tendermint | abci/example/kvstore/persistent_kvstore.go | InitChain | func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain {
for _, v := range req.Validators {
r := app.updateValidator(v)
if r.IsErr() {
app.logger.Error("Error updating validators", "r", r)
}
}
return types.ResponseInitChain{}
} | go | func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain {
for _, v := range req.Validators {
r := app.updateValidator(v)
if r.IsErr() {
app.logger.Error("Error updating validators", "r", r)
}
}
return types.ResponseInitChain{}
} | [
"func",
"(",
"app",
"*",
"PersistentKVStoreApplication",
")",
"InitChain",
"(",
"req",
"types",
".",
"RequestInitChain",
")",
"types",
".",
"ResponseInitChain",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"req",
".",
"Validators",
"{",
"r",
":=",
"app",
".",... | // Save the validators in the merkle tree | [
"Save",
"the",
"validators",
"in",
"the",
"merkle",
"tree"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/example/kvstore/persistent_kvstore.go#L91-L99 |
131,186 | tendermint/tendermint | abci/example/kvstore/persistent_kvstore.go | BeginBlock | func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
// reset valset changes
app.ValUpdates = make([]types.ValidatorUpdate, 0)
return types.ResponseBeginBlock{}
} | go | func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
// reset valset changes
app.ValUpdates = make([]types.ValidatorUpdate, 0)
return types.ResponseBeginBlock{}
} | [
"func",
"(",
"app",
"*",
"PersistentKVStoreApplication",
")",
"BeginBlock",
"(",
"req",
"types",
".",
"RequestBeginBlock",
")",
"types",
".",
"ResponseBeginBlock",
"{",
"// reset valset changes",
"app",
".",
"ValUpdates",
"=",
"make",
"(",
"[",
"]",
"types",
"."... | // Track the block hash and header information | [
"Track",
"the",
"block",
"hash",
"and",
"header",
"information"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/example/kvstore/persistent_kvstore.go#L102-L106 |
131,187 | tendermint/tendermint | abci/example/kvstore/persistent_kvstore.go | EndBlock | func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
return types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}
} | go | func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
return types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}
} | [
"func",
"(",
"app",
"*",
"PersistentKVStoreApplication",
")",
"EndBlock",
"(",
"req",
"types",
".",
"RequestEndBlock",
")",
"types",
".",
"ResponseEndBlock",
"{",
"return",
"types",
".",
"ResponseEndBlock",
"{",
"ValidatorUpdates",
":",
"app",
".",
"ValUpdates",
... | // Update the validator set | [
"Update",
"the",
"validator",
"set"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/abci/example/kvstore/persistent_kvstore.go#L109-L111 |
131,188 | tendermint/tendermint | config/config.go | DefaultConfig | func DefaultConfig() *Config {
return &Config{
BaseConfig: DefaultBaseConfig(),
RPC: DefaultRPCConfig(),
P2P: DefaultP2PConfig(),
Mempool: DefaultMempoolConfig(),
Consensus: DefaultConsensusConfig(),
TxIndex: DefaultTxIndexConfig(),
Instrumentation: Defa... | go | func DefaultConfig() *Config {
return &Config{
BaseConfig: DefaultBaseConfig(),
RPC: DefaultRPCConfig(),
P2P: DefaultP2PConfig(),
Mempool: DefaultMempoolConfig(),
Consensus: DefaultConsensusConfig(),
TxIndex: DefaultTxIndexConfig(),
Instrumentation: Defa... | [
"func",
"DefaultConfig",
"(",
")",
"*",
"Config",
"{",
"return",
"&",
"Config",
"{",
"BaseConfig",
":",
"DefaultBaseConfig",
"(",
")",
",",
"RPC",
":",
"DefaultRPCConfig",
"(",
")",
",",
"P2P",
":",
"DefaultP2PConfig",
"(",
")",
",",
"Mempool",
":",
"Def... | // DefaultConfig returns a default configuration for a Tendermint node | [
"DefaultConfig",
"returns",
"a",
"default",
"configuration",
"for",
"a",
"Tendermint",
"node"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L73-L83 |
131,189 | tendermint/tendermint | config/config.go | SetRoot | func (cfg *Config) SetRoot(root string) *Config {
cfg.BaseConfig.RootDir = root
cfg.RPC.RootDir = root
cfg.P2P.RootDir = root
cfg.Mempool.RootDir = root
cfg.Consensus.RootDir = root
return cfg
} | go | func (cfg *Config) SetRoot(root string) *Config {
cfg.BaseConfig.RootDir = root
cfg.RPC.RootDir = root
cfg.P2P.RootDir = root
cfg.Mempool.RootDir = root
cfg.Consensus.RootDir = root
return cfg
} | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"SetRoot",
"(",
"root",
"string",
")",
"*",
"Config",
"{",
"cfg",
".",
"BaseConfig",
".",
"RootDir",
"=",
"root",
"\n",
"cfg",
".",
"RPC",
".",
"RootDir",
"=",
"root",
"\n",
"cfg",
".",
"P2P",
".",
"RootDir",... | // SetRoot sets the RootDir for all Config structs | [
"SetRoot",
"sets",
"the",
"RootDir",
"for",
"all",
"Config",
"structs"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L99-L106 |
131,190 | tendermint/tendermint | config/config.go | DefaultBaseConfig | func DefaultBaseConfig() BaseConfig {
return BaseConfig{
Genesis: defaultGenesisJSONPath,
PrivValidatorKey: defaultPrivValKeyPath,
PrivValidatorState: defaultPrivValStatePath,
NodeKey: defaultNodeKeyPath,
Moniker: defaultMoniker,
ProxyApp: "tcp://127.0.0.1:26658... | go | func DefaultBaseConfig() BaseConfig {
return BaseConfig{
Genesis: defaultGenesisJSONPath,
PrivValidatorKey: defaultPrivValKeyPath,
PrivValidatorState: defaultPrivValStatePath,
NodeKey: defaultNodeKeyPath,
Moniker: defaultMoniker,
ProxyApp: "tcp://127.0.0.1:26658... | [
"func",
"DefaultBaseConfig",
"(",
")",
"BaseConfig",
"{",
"return",
"BaseConfig",
"{",
"Genesis",
":",
"defaultGenesisJSONPath",
",",
"PrivValidatorKey",
":",
"defaultPrivValKeyPath",
",",
"PrivValidatorState",
":",
"defaultPrivValStatePath",
",",
"NodeKey",
":",
"defau... | // DefaultBaseConfig returns a default base configuration for a Tendermint node | [
"DefaultBaseConfig",
"returns",
"a",
"default",
"base",
"configuration",
"for",
"a",
"Tendermint",
"node"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L196-L213 |
131,191 | tendermint/tendermint | config/config.go | DefaultRPCConfig | func DefaultRPCConfig() *RPCConfig {
return &RPCConfig{
ListenAddress: "tcp://0.0.0.0:26657",
CORSAllowedOrigins: []string{},
CORSAllowedMethods: []string{"HEAD", "GET", "POST"},
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},
GRPCLi... | go | func DefaultRPCConfig() *RPCConfig {
return &RPCConfig{
ListenAddress: "tcp://0.0.0.0:26657",
CORSAllowedOrigins: []string{},
CORSAllowedMethods: []string{"HEAD", "GET", "POST"},
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},
GRPCLi... | [
"func",
"DefaultRPCConfig",
"(",
")",
"*",
"RPCConfig",
"{",
"return",
"&",
"RPCConfig",
"{",
"ListenAddress",
":",
"\"",
"\"",
",",
"CORSAllowedOrigins",
":",
"[",
"]",
"string",
"{",
"}",
",",
"CORSAllowedMethods",
":",
"[",
"]",
"string",
"{",
"\"",
"... | // DefaultRPCConfig returns a default configuration for the RPC server | [
"DefaultRPCConfig",
"returns",
"a",
"default",
"configuration",
"for",
"the",
"RPC",
"server"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L359-L378 |
131,192 | tendermint/tendermint | config/config.go | DefaultP2PConfig | func DefaultP2PConfig() *P2PConfig {
return &P2PConfig{
ListenAddress: "tcp://0.0.0.0:26656",
ExternalAddress: "",
UPNP: false,
AddrBook: defaultAddrBookPath,
AddrBookStrict: true,
MaxNumInboundPeers: 40,
MaxNumOutboundPeers: 10,
Flu... | go | func DefaultP2PConfig() *P2PConfig {
return &P2PConfig{
ListenAddress: "tcp://0.0.0.0:26656",
ExternalAddress: "",
UPNP: false,
AddrBook: defaultAddrBookPath,
AddrBookStrict: true,
MaxNumInboundPeers: 40,
MaxNumOutboundPeers: 10,
Flu... | [
"func",
"DefaultP2PConfig",
"(",
")",
"*",
"P2PConfig",
"{",
"return",
"&",
"P2PConfig",
"{",
"ListenAddress",
":",
"\"",
"\"",
",",
"ExternalAddress",
":",
"\"",
"\"",
",",
"UPNP",
":",
"false",
",",
"AddrBook",
":",
"defaultAddrBookPath",
",",
"AddrBookStr... | // DefaultP2PConfig returns a default configuration for the peer-to-peer layer | [
"DefaultP2PConfig",
"returns",
"a",
"default",
"configuration",
"for",
"the",
"peer",
"-",
"to",
"-",
"peer",
"layer"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L504-L526 |
131,193 | tendermint/tendermint | config/config.go | DefaultFuzzConnConfig | func DefaultFuzzConnConfig() *FuzzConnConfig {
return &FuzzConnConfig{
Mode: FuzzModeDrop,
MaxDelay: 3 * time.Second,
ProbDropRW: 0.2,
ProbDropConn: 0.00,
ProbSleep: 0.00,
}
} | go | func DefaultFuzzConnConfig() *FuzzConnConfig {
return &FuzzConnConfig{
Mode: FuzzModeDrop,
MaxDelay: 3 * time.Second,
ProbDropRW: 0.2,
ProbDropConn: 0.00,
ProbSleep: 0.00,
}
} | [
"func",
"DefaultFuzzConnConfig",
"(",
")",
"*",
"FuzzConnConfig",
"{",
"return",
"&",
"FuzzConnConfig",
"{",
"Mode",
":",
"FuzzModeDrop",
",",
"MaxDelay",
":",
"3",
"*",
"time",
".",
"Second",
",",
"ProbDropRW",
":",
"0.2",
",",
"ProbDropConn",
":",
"0.00",
... | // DefaultFuzzConnConfig returns the default config. | [
"DefaultFuzzConnConfig",
"returns",
"the",
"default",
"config",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L576-L584 |
131,194 | tendermint/tendermint | config/config.go | DefaultMempoolConfig | func DefaultMempoolConfig() *MempoolConfig {
return &MempoolConfig{
Recheck: true,
Broadcast: true,
WalPath: "",
// Each signature verification takes .5ms, Size reduced until we implement
// ABCI Recheck
Size: 5000,
MaxTxsBytes: 1024 * 1024 * 1024, // 1GB
CacheSize: 10000,
}
} | go | func DefaultMempoolConfig() *MempoolConfig {
return &MempoolConfig{
Recheck: true,
Broadcast: true,
WalPath: "",
// Each signature verification takes .5ms, Size reduced until we implement
// ABCI Recheck
Size: 5000,
MaxTxsBytes: 1024 * 1024 * 1024, // 1GB
CacheSize: 10000,
}
} | [
"func",
"DefaultMempoolConfig",
"(",
")",
"*",
"MempoolConfig",
"{",
"return",
"&",
"MempoolConfig",
"{",
"Recheck",
":",
"true",
",",
"Broadcast",
":",
"true",
",",
"WalPath",
":",
"\"",
"\"",
",",
"// Each signature verification takes .5ms, Size reduced until we imp... | // DefaultMempoolConfig returns a default configuration for the Tendermint mempool | [
"DefaultMempoolConfig",
"returns",
"a",
"default",
"configuration",
"for",
"the",
"Tendermint",
"mempool"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L601-L612 |
131,195 | tendermint/tendermint | config/config.go | DefaultConsensusConfig | func DefaultConsensusConfig() *ConsensusConfig {
return &ConsensusConfig{
WalPath: filepath.Join(defaultDataDir, "cs.wal", "wal"),
TimeoutPropose: 3000 * time.Millisecond,
TimeoutProposeDelta: 500 * time.Millisecond,
TimeoutPrevote: 1000 * time.Millisecond,... | go | func DefaultConsensusConfig() *ConsensusConfig {
return &ConsensusConfig{
WalPath: filepath.Join(defaultDataDir, "cs.wal", "wal"),
TimeoutPropose: 3000 * time.Millisecond,
TimeoutProposeDelta: 500 * time.Millisecond,
TimeoutPrevote: 1000 * time.Millisecond,... | [
"func",
"DefaultConsensusConfig",
"(",
")",
"*",
"ConsensusConfig",
"{",
"return",
"&",
"ConsensusConfig",
"{",
"WalPath",
":",
"filepath",
".",
"Join",
"(",
"defaultDataDir",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"TimeoutPropose",
":",
"3000",
"*",
... | // DefaultConsensusConfig returns a default configuration for the consensus service | [
"DefaultConsensusConfig",
"returns",
"a",
"default",
"configuration",
"for",
"the",
"consensus",
"service"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L677-L693 |
131,196 | tendermint/tendermint | config/config.go | Propose | func (cfg *ConsensusConfig) Propose(round int) time.Duration {
return time.Duration(
cfg.TimeoutPropose.Nanoseconds()+cfg.TimeoutProposeDelta.Nanoseconds()*int64(round),
) * time.Nanosecond
} | go | func (cfg *ConsensusConfig) Propose(round int) time.Duration {
return time.Duration(
cfg.TimeoutPropose.Nanoseconds()+cfg.TimeoutProposeDelta.Nanoseconds()*int64(round),
) * time.Nanosecond
} | [
"func",
"(",
"cfg",
"*",
"ConsensusConfig",
")",
"Propose",
"(",
"round",
"int",
")",
"time",
".",
"Duration",
"{",
"return",
"time",
".",
"Duration",
"(",
"cfg",
".",
"TimeoutPropose",
".",
"Nanoseconds",
"(",
")",
"+",
"cfg",
".",
"TimeoutProposeDelta",
... | // Propose returns the amount of time to wait for a proposal | [
"Propose",
"returns",
"the",
"amount",
"of",
"time",
"to",
"wait",
"for",
"a",
"proposal"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L717-L721 |
131,197 | tendermint/tendermint | config/config.go | WalFile | func (cfg *ConsensusConfig) WalFile() string {
if cfg.walFile != "" {
return cfg.walFile
}
return rootify(cfg.WalPath, cfg.RootDir)
} | go | func (cfg *ConsensusConfig) WalFile() string {
if cfg.walFile != "" {
return cfg.walFile
}
return rootify(cfg.WalPath, cfg.RootDir)
} | [
"func",
"(",
"cfg",
"*",
"ConsensusConfig",
")",
"WalFile",
"(",
")",
"string",
"{",
"if",
"cfg",
".",
"walFile",
"!=",
"\"",
"\"",
"{",
"return",
"cfg",
".",
"walFile",
"\n",
"}",
"\n",
"return",
"rootify",
"(",
"cfg",
".",
"WalPath",
",",
"cfg",
... | // WalFile returns the full path to the write-ahead log file | [
"WalFile",
"returns",
"the",
"full",
"path",
"to",
"the",
"write",
"-",
"ahead",
"log",
"file"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L743-L748 |
131,198 | tendermint/tendermint | config/config.go | getDefaultMoniker | func getDefaultMoniker() string {
moniker, err := os.Hostname()
if err != nil {
moniker = "anonymous"
}
return moniker
} | go | func getDefaultMoniker() string {
moniker, err := os.Hostname()
if err != nil {
moniker = "anonymous"
}
return moniker
} | [
"func",
"getDefaultMoniker",
"(",
")",
"string",
"{",
"moniker",
",",
"err",
":=",
"os",
".",
"Hostname",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"moniker",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"moniker",
"\n",
"}"
] | // getDefaultMoniker returns a default moniker, which is the host name. If runtime
// fails to get the host name, "anonymous" will be returned. | [
"getDefaultMoniker",
"returns",
"a",
"default",
"moniker",
"which",
"is",
"the",
"host",
"name",
".",
"If",
"runtime",
"fails",
"to",
"get",
"the",
"host",
"name",
"anonymous",
"will",
"be",
"returned",
"."
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/config/config.go#L903-L909 |
131,199 | tendermint/tendermint | tools/tm-monitor/ton.go | refresher | func (o *Ton) refresher() {
for {
select {
case <-o.quit:
return
case <-time.After(o.RefreshRate):
o.Print()
}
}
} | go | func (o *Ton) refresher() {
for {
select {
case <-o.quit:
return
case <-time.After(o.RefreshRate):
o.Print()
}
}
} | [
"func",
"(",
"o",
"*",
"Ton",
")",
"refresher",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"o",
".",
"quit",
":",
"return",
"\n",
"case",
"<-",
"time",
".",
"After",
"(",
"o",
".",
"RefreshRate",
")",
":",
"o",
".",
"Print",
"(",
... | // Internal loop for refreshing | [
"Internal",
"loop",
"for",
"refreshing"
] | 4253e67c07c69be6d7f7263ab03944ce30a9fc90 | https://github.com/tendermint/tendermint/blob/4253e67c07c69be6d7f7263ab03944ce30a9fc90/tools/tm-monitor/ton.go#L83-L92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.