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
19,800
decred/dcrdata
explorer/types/explorertypes.go
VotesOnBlock
func (vi *VoteInfo) VotesOnBlock(blockHash string) bool { return vi.Validation.ForBlock(blockHash) }
go
func (vi *VoteInfo) VotesOnBlock(blockHash string) bool { return vi.Validation.ForBlock(blockHash) }
[ "func", "(", "vi", "*", "VoteInfo", ")", "VotesOnBlock", "(", "blockHash", "string", ")", "bool", "{", "return", "vi", ".", "Validation", ".", "ForBlock", "(", "blockHash", ")", "\n", "}" ]
// VotesOnBlock indicates if the vote is voting on the validity of block // specified by the given hash.
[ "VotesOnBlock", "indicates", "if", "the", "vote", "is", "voting", "on", "the", "validity", "of", "block", "specified", "by", "the", "given", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L318-L320
19,801
decred/dcrdata
explorer/types/explorertypes.go
ForBlock
func (v *BlockValidation) ForBlock(blockHash string) bool { return blockHash != "" && blockHash == v.Hash }
go
func (v *BlockValidation) ForBlock(blockHash string) bool { return blockHash != "" && blockHash == v.Hash }
[ "func", "(", "v", "*", "BlockValidation", ")", "ForBlock", "(", "blockHash", "string", ")", "bool", "{", "return", "blockHash", "!=", "\"", "\"", "&&", "blockHash", "==", "v", ".", "Hash", "\n", "}" ]
// ForBlock indicates if the validation choice is for the specified block.
[ "ForBlock", "indicates", "if", "the", "validation", "choice", "is", "for", "the", "specified", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L323-L325
19,802
decred/dcrdata
explorer/types/explorertypes.go
DeepCopy
func (mpi *MempoolInfo) DeepCopy() *MempoolInfo { if mpi == nil { return nil } mpi.RLock() defer mpi.RUnlock() out := new(MempoolInfo) out.Transactions = CopyMempoolTxSlice(mpi.Transactions) out.Tickets = CopyMempoolTxSlice(mpi.Tickets) out.Votes = CopyMempoolTxSlice(mpi.Votes) out.Revocations = CopyMempoo...
go
func (mpi *MempoolInfo) DeepCopy() *MempoolInfo { if mpi == nil { return nil } mpi.RLock() defer mpi.RUnlock() out := new(MempoolInfo) out.Transactions = CopyMempoolTxSlice(mpi.Transactions) out.Tickets = CopyMempoolTxSlice(mpi.Tickets) out.Votes = CopyMempoolTxSlice(mpi.Votes) out.Revocations = CopyMempoo...
[ "func", "(", "mpi", "*", "MempoolInfo", ")", "DeepCopy", "(", ")", "*", "MempoolInfo", "{", "if", "mpi", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "mpi", ".", "RLock", "(", ")", "\n", "defer", "mpi", ".", "RUnlock", "(", ")", "\n\n", ...
// DeepCopy makes a deep copy of MempoolInfo, where all the slice and map data // are copied over.
[ "DeepCopy", "makes", "a", "deep", "copy", "of", "MempoolInfo", "where", "all", "the", "slice", "and", "map", "data", "are", "copied", "over", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L449-L467
19,803
decred/dcrdata
explorer/types/explorertypes.go
Trim
func (mpi *MempoolInfo) Trim() *TrimmedMempoolInfo { mpi.RLock() mempoolRegularTxs := TrimMempoolTx(mpi.Transactions) mempoolVotes := TrimMempoolTx(mpi.Votes) data := &TrimmedMempoolInfo{ Transactions: FilterRegularTx(mempoolRegularTxs), Tickets: TrimMempoolTx(mpi.Tickets), Votes: FilterUniqueLa...
go
func (mpi *MempoolInfo) Trim() *TrimmedMempoolInfo { mpi.RLock() mempoolRegularTxs := TrimMempoolTx(mpi.Transactions) mempoolVotes := TrimMempoolTx(mpi.Votes) data := &TrimmedMempoolInfo{ Transactions: FilterRegularTx(mempoolRegularTxs), Tickets: TrimMempoolTx(mpi.Tickets), Votes: FilterUniqueLa...
[ "func", "(", "mpi", "*", "MempoolInfo", ")", "Trim", "(", ")", "*", "TrimmedMempoolInfo", "{", "mpi", ".", "RLock", "(", ")", "\n\n", "mempoolRegularTxs", ":=", "TrimMempoolTx", "(", "mpi", ".", "Transactions", ")", "\n", "mempoolVotes", ":=", "TrimMempoolTx...
// Trim converts the MempoolInfo to TrimmedMempoolInfo.
[ "Trim", "converts", "the", "MempoolInfo", "to", "TrimmedMempoolInfo", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L470-L501
19,804
decred/dcrdata
explorer/types/explorertypes.go
getTxFromList
func getTxFromList(txid string, txns []MempoolTx) (MempoolTx, bool) { for idx := range txns { if txns[idx].TxID == txid { return txns[idx], true } } return MempoolTx{}, false }
go
func getTxFromList(txid string, txns []MempoolTx) (MempoolTx, bool) { for idx := range txns { if txns[idx].TxID == txid { return txns[idx], true } } return MempoolTx{}, false }
[ "func", "getTxFromList", "(", "txid", "string", ",", "txns", "[", "]", "MempoolTx", ")", "(", "MempoolTx", ",", "bool", ")", "{", "for", "idx", ":=", "range", "txns", "{", "if", "txns", "[", "idx", "]", ".", "TxID", "==", "txid", "{", "return", "tx...
// getTxFromList is a helper function for searching the MempoolInfo tx lists.
[ "getTxFromList", "is", "a", "helper", "function", "for", "searching", "the", "MempoolInfo", "tx", "lists", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L504-L511
19,805
decred/dcrdata
explorer/types/explorertypes.go
Tx
func (mpi *MempoolInfo) Tx(txid string) (MempoolTx, bool) { mpi.RLock() defer mpi.RUnlock() _, found := mpi.InvRegular[txid] if found { return getTxFromList(txid, mpi.Transactions) } _, found = mpi.InvStake[txid] if found { tx, found := getTxFromList(txid, mpi.Tickets) if found { return tx, true } t...
go
func (mpi *MempoolInfo) Tx(txid string) (MempoolTx, bool) { mpi.RLock() defer mpi.RUnlock() _, found := mpi.InvRegular[txid] if found { return getTxFromList(txid, mpi.Transactions) } _, found = mpi.InvStake[txid] if found { tx, found := getTxFromList(txid, mpi.Tickets) if found { return tx, true } t...
[ "func", "(", "mpi", "*", "MempoolInfo", ")", "Tx", "(", "txid", "string", ")", "(", "MempoolTx", ",", "bool", ")", "{", "mpi", ".", "RLock", "(", ")", "\n", "defer", "mpi", ".", "RUnlock", "(", ")", "\n", "_", ",", "found", ":=", "mpi", ".", "I...
// Tx checks the inventory and searches the appropriate lists for a // transaction matching the provided transaction ID.
[ "Tx", "checks", "the", "inventory", "and", "searches", "the", "appropriate", "lists", "for", "a", "transaction", "matching", "the", "provided", "transaction", "ID", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L515-L535
19,806
decred/dcrdata
explorer/types/explorertypes.go
ID
func (mpi *MempoolInfo) ID() uint64 { mpi.RLock() defer mpi.RUnlock() return mpi.Ident }
go
func (mpi *MempoolInfo) ID() uint64 { mpi.RLock() defer mpi.RUnlock() return mpi.Ident }
[ "func", "(", "mpi", "*", "MempoolInfo", ")", "ID", "(", ")", "uint64", "{", "mpi", ".", "RLock", "(", ")", "\n", "defer", "mpi", ".", "RUnlock", "(", ")", "\n", "return", "mpi", ".", "Ident", "\n", "}" ]
// ID can be used to track state changes.
[ "ID", "can", "be", "used", "to", "track", "state", "changes", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L538-L542
19,807
decred/dcrdata
explorer/types/explorertypes.go
FilterUniqueLastBlockVotes
func FilterUniqueLastBlockVotes(txs []*TrimmedTxInfo) (votes []*TrimmedTxInfo) { seenVotes := make(map[string]struct{}) for _, tx := range txs { if tx.VoteInfo != nil && tx.VoteInfo.ForLastBlock { // Do not append duplicates. if _, seen := seenVotes[tx.TxID]; seen { continue } votes = append(votes, ...
go
func FilterUniqueLastBlockVotes(txs []*TrimmedTxInfo) (votes []*TrimmedTxInfo) { seenVotes := make(map[string]struct{}) for _, tx := range txs { if tx.VoteInfo != nil && tx.VoteInfo.ForLastBlock { // Do not append duplicates. if _, seen := seenVotes[tx.TxID]; seen { continue } votes = append(votes, ...
[ "func", "FilterUniqueLastBlockVotes", "(", "txs", "[", "]", "*", "TrimmedTxInfo", ")", "(", "votes", "[", "]", "*", "TrimmedTxInfo", ")", "{", "seenVotes", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "for", "_", ",", ...
// FilterUniqueLastBlockVotes returns a slice of all the vote transactions from // the input slice that are flagged as voting on the previous block.
[ "FilterUniqueLastBlockVotes", "returns", "a", "slice", "of", "all", "the", "vote", "transactions", "from", "the", "input", "slice", "that", "are", "flagged", "as", "voting", "on", "the", "previous", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L594-L607
19,808
decred/dcrdata
explorer/types/explorertypes.go
NewVotingInfo
func NewVotingInfo(votesPerBlock uint16) VotingInfo { return VotingInfo{ MaxVotesPerBlock: votesPerBlock, VotedTickets: make(map[string]bool), VoteTallys: make(map[string]*VoteTally), } }
go
func NewVotingInfo(votesPerBlock uint16) VotingInfo { return VotingInfo{ MaxVotesPerBlock: votesPerBlock, VotedTickets: make(map[string]bool), VoteTallys: make(map[string]*VoteTally), } }
[ "func", "NewVotingInfo", "(", "votesPerBlock", "uint16", ")", "VotingInfo", "{", "return", "VotingInfo", "{", "MaxVotesPerBlock", ":", "votesPerBlock", ",", "VotedTickets", ":", "make", "(", "map", "[", "string", "]", "bool", ")", ",", "VoteTallys", ":", "make...
// NewVotingInfo initializes a VotingInfo.
[ "NewVotingInfo", "initializes", "a", "VotingInfo", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L726-L732
19,809
decred/dcrdata
explorer/types/explorertypes.go
Tally
func (vi *VotingInfo) Tally(vinfo *VoteInfo) { _, ok := vi.VoteTallys[vinfo.Validation.Hash] if ok { vi.VoteTallys[vinfo.Validation.Hash].Mark(vinfo.Validation.Validity) return } marks := make([]bool, 1, vi.MaxVotesPerBlock) marks[0] = vinfo.Validation.Validity vi.VoteTallys[vinfo.Validation.Hash] = &VoteTall...
go
func (vi *VotingInfo) Tally(vinfo *VoteInfo) { _, ok := vi.VoteTallys[vinfo.Validation.Hash] if ok { vi.VoteTallys[vinfo.Validation.Hash].Mark(vinfo.Validation.Validity) return } marks := make([]bool, 1, vi.MaxVotesPerBlock) marks[0] = vinfo.Validation.Validity vi.VoteTallys[vinfo.Validation.Hash] = &VoteTall...
[ "func", "(", "vi", "*", "VotingInfo", ")", "Tally", "(", "vinfo", "*", "VoteInfo", ")", "{", "_", ",", "ok", ":=", "vi", ".", "VoteTallys", "[", "vinfo", ".", "Validation", ".", "Hash", "]", "\n", "if", "ok", "{", "vi", ".", "VoteTallys", "[", "v...
// Tally adds the VoteInfo to the VotingInfo.VoteTally
[ "Tally", "adds", "the", "VoteInfo", "to", "the", "VotingInfo", ".", "VoteTally" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L735-L747
19,810
decred/dcrdata
explorer/types/explorertypes.go
BlockStatus
func (vi *VotingInfo) BlockStatus(hash string) ([]int, int) { tally, ok := vi.VoteTallys[hash] if ok { return tally.Status() } marks := make([]int, int(vi.MaxVotesPerBlock)) for i := range marks { marks[i] = VoteMissing } return marks, VoteMissing }
go
func (vi *VotingInfo) BlockStatus(hash string) ([]int, int) { tally, ok := vi.VoteTallys[hash] if ok { return tally.Status() } marks := make([]int, int(vi.MaxVotesPerBlock)) for i := range marks { marks[i] = VoteMissing } return marks, VoteMissing }
[ "func", "(", "vi", "*", "VotingInfo", ")", "BlockStatus", "(", "hash", "string", ")", "(", "[", "]", "int", ",", "int", ")", "{", "tally", ",", "ok", ":=", "vi", ".", "VoteTallys", "[", "hash", "]", "\n", "if", "ok", "{", "return", "tally", ".", ...
// BlockStatus fetches a list of votes in mempool, for the provided block hash. // If not found, a list of VoteMissing is returned.
[ "BlockStatus", "fetches", "a", "list", "of", "votes", "in", "mempool", "for", "the", "provided", "block", "hash", ".", "If", "not", "found", "a", "list", "of", "VoteMissing", "is", "returned", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L751-L761
19,811
decred/dcrdata
explorer/types/explorertypes.go
Mark
func (tally *VoteTally) Mark(vote bool) { tally.Marks = append(tally.Marks, vote) }
go
func (tally *VoteTally) Mark(vote bool) { tally.Marks = append(tally.Marks, vote) }
[ "func", "(", "tally", "*", "VoteTally", ")", "Mark", "(", "vote", "bool", ")", "{", "tally", ".", "Marks", "=", "append", "(", "tally", ".", "Marks", ",", "vote", ")", "\n", "}" ]
// Mark adds the vote to the VoteTally.
[ "Mark", "adds", "the", "vote", "to", "the", "VoteTally", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L770-L772
19,812
decred/dcrdata
explorer/types/explorertypes.go
Affirmations
func (tally *VoteTally) Affirmations() (c int) { for _, affirmed := range tally.Marks { if affirmed { c++ } } return c }
go
func (tally *VoteTally) Affirmations() (c int) { for _, affirmed := range tally.Marks { if affirmed { c++ } } return c }
[ "func", "(", "tally", "*", "VoteTally", ")", "Affirmations", "(", ")", "(", "c", "int", ")", "{", "for", "_", ",", "affirmed", ":=", "range", "tally", ".", "Marks", "{", "if", "affirmed", "{", "c", "++", "\n", "}", "\n", "}", "\n", "return", "c",...
// Affirmations counts the number of selected ticket holders who have voted // in favor of the block for the given hash.
[ "Affirmations", "counts", "the", "number", "of", "selected", "ticket", "holders", "who", "have", "voted", "in", "favor", "of", "the", "block", "for", "the", "given", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L803-L810
19,813
decred/dcrdata
explorer/types/explorertypes.go
AddressPrefixes
func AddressPrefixes(params *chaincfg.Params) []AddrPrefix { Descriptions := []string{"P2PK address", "P2PKH address prefix. Standard wallet address. 1 public key -> 1 private key", "Ed25519 P2PKH address prefix", "secp256k1 Schnorr P2PKH address prefix", "P2SH address prefix", "WIF private key prefix", "H...
go
func AddressPrefixes(params *chaincfg.Params) []AddrPrefix { Descriptions := []string{"P2PK address", "P2PKH address prefix. Standard wallet address. 1 public key -> 1 private key", "Ed25519 P2PKH address prefix", "secp256k1 Schnorr P2PKH address prefix", "P2SH address prefix", "WIF private key prefix", "H...
[ "func", "AddressPrefixes", "(", "params", "*", "chaincfg", ".", "Params", ")", "[", "]", "AddrPrefix", "{", "Descriptions", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ...
// AddressPrefixes generates an array AddrPrefix by using chaincfg.Params
[ "AddressPrefixes", "generates", "an", "array", "AddrPrefix", "by", "using", "chaincfg", ".", "Params" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L952-L997
19,814
decred/dcrdata
explorer/types/explorertypes.go
UnspentOutputIndices
func UnspentOutputIndices(vouts []Vout) (unspents []int) { for idx := range vouts { vout := vouts[idx] if vout.Amount == 0.0 || vout.Spent { continue } unspents = append(unspents, idx) } return }
go
func UnspentOutputIndices(vouts []Vout) (unspents []int) { for idx := range vouts { vout := vouts[idx] if vout.Amount == 0.0 || vout.Spent { continue } unspents = append(unspents, idx) } return }
[ "func", "UnspentOutputIndices", "(", "vouts", "[", "]", "Vout", ")", "(", "unspents", "[", "]", "int", ")", "{", "for", "idx", ":=", "range", "vouts", "{", "vout", ":=", "vouts", "[", "idx", "]", "\n", "if", "vout", ".", "Amount", "==", "0.0", "||"...
// UnspentOutputIndices finds the indices of the transaction outputs that appear // unspent. The indices returned are the index within the passed slice, not // within the transaction.
[ "UnspentOutputIndices", "finds", "the", "indices", "of", "the", "transaction", "outputs", "that", "appear", "unspent", ".", "The", "indices", "returned", "are", "the", "index", "within", "the", "passed", "slice", "not", "within", "the", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L1035-L1044
19,815
decred/dcrdata
explorer/types/explorertypes.go
MsgTxMempoolInputs
func MsgTxMempoolInputs(msgTx *wire.MsgTx) (inputs []MempoolInput) { for vindex := range msgTx.TxIn { outpoint := msgTx.TxIn[vindex].PreviousOutPoint outId := outpoint.Hash.String() inputs = append(inputs, MempoolInput{ TxId: outId, Index: uint32(vindex), Outdex: outpoint.Index, }) } return }
go
func MsgTxMempoolInputs(msgTx *wire.MsgTx) (inputs []MempoolInput) { for vindex := range msgTx.TxIn { outpoint := msgTx.TxIn[vindex].PreviousOutPoint outId := outpoint.Hash.String() inputs = append(inputs, MempoolInput{ TxId: outId, Index: uint32(vindex), Outdex: outpoint.Index, }) } return }
[ "func", "MsgTxMempoolInputs", "(", "msgTx", "*", "wire", ".", "MsgTx", ")", "(", "inputs", "[", "]", "MempoolInput", ")", "{", "for", "vindex", ":=", "range", "msgTx", ".", "TxIn", "{", "outpoint", ":=", "msgTx", ".", "TxIn", "[", "vindex", "]", ".", ...
// MsgTxMempoolInputs parses a MsgTx and creates a list of MempoolInput.
[ "MsgTxMempoolInputs", "parses", "a", "MsgTx", "and", "creates", "a", "list", "of", "MempoolInput", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L1047-L1058
19,816
decred/dcrdata
explorer/templates.go
execTemplateToString
func (t *templates) execTemplateToString(name string, data interface{}) (string, error) { temp, ok := t.templates[name] if !ok { return "", fmt.Errorf("Template %s not known", name) } var page bytes.Buffer err := temp.template.ExecuteTemplate(&page, name, data) return page.String(), err }
go
func (t *templates) execTemplateToString(name string, data interface{}) (string, error) { temp, ok := t.templates[name] if !ok { return "", fmt.Errorf("Template %s not known", name) } var page bytes.Buffer err := temp.template.ExecuteTemplate(&page, name, data) return page.String(), err }
[ "func", "(", "t", "*", "templates", ")", "execTemplateToString", "(", "name", "string", ",", "data", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "temp", ",", "ok", ":=", "t", ".", "templates", "[", "name", "]", "\n", "if", "!...
// execTemplateToString executes the associated input template using the // supplied data, and writes the result into a string. If the template fails to // execute or isn't found, a non-nil error will be returned. Check it before // writing to theclient, otherwise you might as well execute directly into // your respons...
[ "execTemplateToString", "executes", "the", "associated", "input", "template", "using", "the", "supplied", "data", "and", "writes", "the", "result", "into", "a", "string", ".", "If", "the", "template", "fails", "to", "execute", "or", "isn", "t", "found", "a", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/templates.go#L83-L92
19,817
decred/dcrdata
txhelpers/subsidy.go
UltimateSubsidy
func UltimateSubsidy(params *chaincfg.Params) int64 { // Check previously computed ultimate subsidies. totalSubsidy, ok := ultimateSubsidies[params] if ok { return totalSubsidy } subsidyCache := blockchain.NewSubsidyCache(0, params) totalSubsidy = params.BlockOneSubsidy() for i := int64(0); ; i++ { // Gene...
go
func UltimateSubsidy(params *chaincfg.Params) int64 { // Check previously computed ultimate subsidies. totalSubsidy, ok := ultimateSubsidies[params] if ok { return totalSubsidy } subsidyCache := blockchain.NewSubsidyCache(0, params) totalSubsidy = params.BlockOneSubsidy() for i := int64(0); ; i++ { // Gene...
[ "func", "UltimateSubsidy", "(", "params", "*", "chaincfg", ".", "Params", ")", "int64", "{", "// Check previously computed ultimate subsidies.", "totalSubsidy", ",", "ok", ":=", "ultimateSubsidies", "[", "params", "]", "\n", "if", "ok", "{", "return", "totalSubsidy"...
// UltimateSubsidy computes the total subsidy over the entire subsidy // distribution period of the network.
[ "UltimateSubsidy", "computes", "the", "total", "subsidy", "over", "the", "entire", "subsidy", "distribution", "period", "of", "the", "network", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/subsidy.go#L18-L66
19,818
decred/dcrdata
db/dcrsqlite/apisource.go
InitWiredDB
func InitWiredDB(dbInfo *DBInfo, stakeDB *stakedb.StakeDatabase, statusC chan uint32, cl *rpcclient.Client, p *chaincfg.Params, shutdown func()) (*WiredDB, error) { db, err := InitDB(dbInfo, shutdown) if err != nil { return nil, err } return newWiredDB(db, stakeDB, statusC, cl, p), nil }
go
func InitWiredDB(dbInfo *DBInfo, stakeDB *stakedb.StakeDatabase, statusC chan uint32, cl *rpcclient.Client, p *chaincfg.Params, shutdown func()) (*WiredDB, error) { db, err := InitDB(dbInfo, shutdown) if err != nil { return nil, err } return newWiredDB(db, stakeDB, statusC, cl, p), nil }
[ "func", "InitWiredDB", "(", "dbInfo", "*", "DBInfo", ",", "stakeDB", "*", "stakedb", ".", "StakeDatabase", ",", "statusC", "chan", "uint32", ",", "cl", "*", "rpcclient", ".", "Client", ",", "p", "*", "chaincfg", ".", "Params", ",", "shutdown", "func", "(...
// InitWiredDB creates a new WiredDB from a file containing the data for a // sql.DB. The other parameters are same as those for NewWiredDB.
[ "InitWiredDB", "creates", "a", "new", "WiredDB", "from", "a", "file", "containing", "the", "data", "for", "a", "sql", ".", "DB", ".", "The", "other", "parameters", "are", "same", "as", "those", "for", "NewWiredDB", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L78-L86
19,819
decred/dcrdata
db/dcrsqlite/apisource.go
ReportHeights
func (db *WiredDB) ReportHeights() error { // Check and report heights of the DBs. dbHeight is the lowest of the // heights, and may be -1 with an empty SQLite DB. dbHeight, summaryHeight, stakeInfoHeight, stakeDBHeight, err := db.DBHeights() if err != nil { return fmt.Errorf("DBHeights failed: %v", err) } if d...
go
func (db *WiredDB) ReportHeights() error { // Check and report heights of the DBs. dbHeight is the lowest of the // heights, and may be -1 with an empty SQLite DB. dbHeight, summaryHeight, stakeInfoHeight, stakeDBHeight, err := db.DBHeights() if err != nil { return fmt.Errorf("DBHeights failed: %v", err) } if d...
[ "func", "(", "db", "*", "WiredDB", ")", "ReportHeights", "(", ")", "error", "{", "// Check and report heights of the DBs. dbHeight is the lowest of the", "// heights, and may be -1 with an empty SQLite DB.", "dbHeight", ",", "summaryHeight", ",", "stakeInfoHeight", ",", "stakeD...
// ReportHeights logs the SQLite table heights, and the stake database height, // returning a non-nil error only when the SQLite tables are not at the same // height.
[ "ReportHeights", "logs", "the", "SQLite", "table", "heights", "and", "the", "stake", "database", "height", "returning", "a", "non", "-", "nil", "error", "only", "when", "the", "SQLite", "tables", "are", "not", "at", "the", "same", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L149-L168
19,820
decred/dcrdata
db/dcrsqlite/apisource.go
CheckConnectivity
func (db *WiredDB) CheckConnectivity() error { var err error if err = db.Ping(); err != nil { return err } if err = db.client.Ping(); err != nil { return err } return err }
go
func (db *WiredDB) CheckConnectivity() error { var err error if err = db.Ping(); err != nil { return err } if err = db.client.Ping(); err != nil { return err } return err }
[ "func", "(", "db", "*", "WiredDB", ")", "CheckConnectivity", "(", ")", "error", "{", "var", "err", "error", "\n", "if", "err", "=", "db", ".", "Ping", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "...
// CheckConnectivity ensures the db and RPC client are working.
[ "CheckConnectivity", "ensures", "the", "db", "and", "RPC", "client", "are", "working", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L171-L180
19,821
decred/dcrdata
db/dcrsqlite/apisource.go
PurgeBlocksAboveHeight
func (db *WiredDB) PurgeBlocksAboveHeight(height int64) (NSummaryRows, NStakeInfoRows int64, err error) { var summaryHeight, stakeInfoHeight int64 _, summaryHeight, stakeInfoHeight, _, err = db.DBHeights() if err != nil { return } if summaryHeight != stakeInfoHeight { log.Warnf("Tables are at different heights...
go
func (db *WiredDB) PurgeBlocksAboveHeight(height int64) (NSummaryRows, NStakeInfoRows int64, err error) { var summaryHeight, stakeInfoHeight int64 _, summaryHeight, stakeInfoHeight, _, err = db.DBHeights() if err != nil { return } if summaryHeight != stakeInfoHeight { log.Warnf("Tables are at different heights...
[ "func", "(", "db", "*", "WiredDB", ")", "PurgeBlocksAboveHeight", "(", "height", "int64", ")", "(", "NSummaryRows", ",", "NStakeInfoRows", "int64", ",", "err", "error", ")", "{", "var", "summaryHeight", ",", "stakeInfoHeight", "int64", "\n", "_", ",", "summa...
// PurgeBlocksAboveHeight deletes all data across all tables for the blocks // above the given height, including side chain blocks. The numbers of blocks // removed from the block summary table and stake info table are returned. // PurgeBlocksAboveHeight will not return sql.ErrNoRows, but it will return // without remo...
[ "PurgeBlocksAboveHeight", "deletes", "all", "data", "across", "all", "tables", "for", "the", "blocks", "above", "the", "given", "height", "including", "side", "chain", "blocks", ".", "The", "numbers", "of", "blocks", "removed", "from", "the", "block", "summary",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L257-L306
19,822
decred/dcrdata
db/dcrsqlite/apisource.go
PurgeBlock
func (db *WiredDB) PurgeBlock(hash string) (NSummaryRows, NStakeInfoRows int64, err error) { NSummaryRows, NStakeInfoRows, err = db.DeleteBlock(hash) // DeleteBlock should not return sql.ErrNoRows, but check anyway. if err == sql.ErrNoRows { err = nil } return }
go
func (db *WiredDB) PurgeBlock(hash string) (NSummaryRows, NStakeInfoRows int64, err error) { NSummaryRows, NStakeInfoRows, err = db.DeleteBlock(hash) // DeleteBlock should not return sql.ErrNoRows, but check anyway. if err == sql.ErrNoRows { err = nil } return }
[ "func", "(", "db", "*", "WiredDB", ")", "PurgeBlock", "(", "hash", "string", ")", "(", "NSummaryRows", ",", "NStakeInfoRows", "int64", ",", "err", "error", ")", "{", "NSummaryRows", ",", "NStakeInfoRows", ",", "err", "=", "db", ".", "DeleteBlock", "(", "...
// PurgeBlock deletes all data across all tables for the block with the // specified hash. The numbers of blocks removed from the block summary table // and stake info table are returned. PurgeBlock will not return sql.ErrNoRows, // but it may return without removing a block.
[ "PurgeBlock", "deletes", "all", "data", "across", "all", "tables", "for", "the", "block", "with", "the", "specified", "hash", ".", "The", "numbers", "of", "blocks", "removed", "from", "the", "block", "summary", "table", "and", "stake", "info", "table", "are"...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L312-L319
19,823
decred/dcrdata
db/dcrsqlite/apisource.go
PurgeBestBlock
func (db *WiredDB) PurgeBestBlock() (NSummaryRows, NStakeInfoRows, height int64, hash string, err error) { var summaryHeight, stakeInfoHeight int64 _, summaryHeight, stakeInfoHeight, _, err = db.DBHeights() if err != nil { return } if summaryHeight != stakeInfoHeight { err = fmt.Errorf("tables are at different...
go
func (db *WiredDB) PurgeBestBlock() (NSummaryRows, NStakeInfoRows, height int64, hash string, err error) { var summaryHeight, stakeInfoHeight int64 _, summaryHeight, stakeInfoHeight, _, err = db.DBHeights() if err != nil { return } if summaryHeight != stakeInfoHeight { err = fmt.Errorf("tables are at different...
[ "func", "(", "db", "*", "WiredDB", ")", "PurgeBestBlock", "(", ")", "(", "NSummaryRows", ",", "NStakeInfoRows", ",", "height", "int64", ",", "hash", "string", ",", "err", "error", ")", "{", "var", "summaryHeight", ",", "stakeInfoHeight", "int64", "\n", "_"...
// PurgeBestBlock deletes all data across all tables for the best block in the // block summary table. The numbers of blocks removed from the block summary // table and stake info table are returned. PurgeBestBlock will not return // sql.ErrNoRows, but it will return without removing a block if the tables are // empty....
[ "PurgeBestBlock", "deletes", "all", "data", "across", "all", "tables", "for", "the", "best", "block", "in", "the", "block", "summary", "table", ".", "The", "numbers", "of", "blocks", "removed", "from", "the", "block", "summary", "table", "and", "stake", "inf...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L327-L368
19,824
decred/dcrdata
db/dcrsqlite/apisource.go
PurgeBestBlocks
func (db *WiredDB) PurgeBestBlocks(N int64) (NSummaryRows, NStakeInfoRows, height int64, hash string, err error) { // If N is less than 1, get the current best block height and hash, then // return. if N < 1 { var h chainhash.Hash h, height, err = db.GetBestBlockHeightHash() if err == sql.ErrNoRows { err = ...
go
func (db *WiredDB) PurgeBestBlocks(N int64) (NSummaryRows, NStakeInfoRows, height int64, hash string, err error) { // If N is less than 1, get the current best block height and hash, then // return. if N < 1 { var h chainhash.Hash h, height, err = db.GetBestBlockHeightHash() if err == sql.ErrNoRows { err = ...
[ "func", "(", "db", "*", "WiredDB", ")", "PurgeBestBlocks", "(", "N", "int64", ")", "(", "NSummaryRows", ",", "NStakeInfoRows", ",", "height", "int64", ",", "hash", "string", ",", "err", "error", ")", "{", "// If N is less than 1, get the current best block height ...
// PurgeBestBlocks deletes all data across all tables for the N best blocks in // the block summary table. The number of blocks removed is returned. // PurgeBestBlocks will not return sql.ErrNoRows, but it will return without // removing the requested number of blocks if the tables are empty or become // empty. The ret...
[ "PurgeBestBlocks", "deletes", "all", "data", "across", "all", "tables", "for", "the", "N", "best", "blocks", "in", "the", "block", "summary", "table", ".", "The", "number", "of", "blocks", "removed", "is", "returned", ".", "PurgeBestBlocks", "will", "not", "...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L376-L424
19,825
decred/dcrdata
db/dcrsqlite/apisource.go
GetBestBlockHeightHash
func (db *WiredDB) GetBestBlockHeightHash() (chainhash.Hash, int64, error) { bestBlockSummary := db.GetBestBlockSummary() if bestBlockSummary == nil { return chainhash.Hash{}, -1, fmt.Errorf("unable to retrieve best block summary") } height := int64(bestBlockSummary.Height) hash, err := chainhash.NewHashFromStr(...
go
func (db *WiredDB) GetBestBlockHeightHash() (chainhash.Hash, int64, error) { bestBlockSummary := db.GetBestBlockSummary() if bestBlockSummary == nil { return chainhash.Hash{}, -1, fmt.Errorf("unable to retrieve best block summary") } height := int64(bestBlockSummary.Height) hash, err := chainhash.NewHashFromStr(...
[ "func", "(", "db", "*", "WiredDB", ")", "GetBestBlockHeightHash", "(", ")", "(", "chainhash", ".", "Hash", ",", "int64", ",", "error", ")", "{", "bestBlockSummary", ":=", "db", ".", "GetBestBlockSummary", "(", ")", "\n", "if", "bestBlockSummary", "==", "ni...
// GetBestBlockHeightHash retrieves the DB's best block hash and height.
[ "GetBestBlockHeightHash", "retrieves", "the", "DB", "s", "best", "block", "hash", "and", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L427-L435
19,826
decred/dcrdata
db/dcrsqlite/apisource.go
GetRawTransactionWithPrevOutAddresses
func (db *WiredDB) GetRawTransactionWithPrevOutAddresses(txid *chainhash.Hash) (*apitypes.Tx, [][]string) { tx, _ := db.getRawTransaction(txid) if tx == nil { return nil, nil } prevOutAddresses := make([][]string, len(tx.Vin)) for i := range tx.Vin { vin := &tx.Vin[i] // Skip inspecting previous outpoint f...
go
func (db *WiredDB) GetRawTransactionWithPrevOutAddresses(txid *chainhash.Hash) (*apitypes.Tx, [][]string) { tx, _ := db.getRawTransaction(txid) if tx == nil { return nil, nil } prevOutAddresses := make([][]string, len(tx.Vin)) for i := range tx.Vin { vin := &tx.Vin[i] // Skip inspecting previous outpoint f...
[ "func", "(", "db", "*", "WiredDB", ")", "GetRawTransactionWithPrevOutAddresses", "(", "txid", "*", "chainhash", ".", "Hash", ")", "(", "*", "apitypes", ".", "Tx", ",", "[", "]", "[", "]", "string", ")", "{", "tx", ",", "_", ":=", "db", ".", "getRawTr...
// GetRawTransactionWithPrevOutAddresses looks up the previous outpoints for a // transaction and extracts a slice of addresses encoded by the pkScript for // each previous outpoint consumed by the transaction.
[ "GetRawTransactionWithPrevOutAddresses", "looks", "up", "the", "previous", "outpoints", "for", "a", "transaction", "and", "extracts", "a", "slice", "of", "addresses", "encoded", "by", "the", "pkScript", "for", "each", "previous", "outpoint", "consumed", "by", "the",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L611-L635
19,827
decred/dcrdata
db/dcrsqlite/apisource.go
GetVoteVersionInfo
func (db *WiredDB) GetVoteVersionInfo(ver uint32) (*dcrjson.GetVoteInfoResult, error) { return db.client.GetVoteInfo(ver) }
go
func (db *WiredDB) GetVoteVersionInfo(ver uint32) (*dcrjson.GetVoteInfoResult, error) { return db.client.GetVoteInfo(ver) }
[ "func", "(", "db", "*", "WiredDB", ")", "GetVoteVersionInfo", "(", "ver", "uint32", ")", "(", "*", "dcrjson", ".", "GetVoteInfoResult", ",", "error", ")", "{", "return", "db", ".", "client", ".", "GetVoteInfo", "(", "ver", ")", "\n", "}" ]
// GetVoteVersionInfo requests stake version info from the dcrd RPC server
[ "GetVoteVersionInfo", "requests", "stake", "version", "info", "from", "the", "dcrd", "RPC", "server" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L700-L702
19,828
decred/dcrdata
db/dcrsqlite/apisource.go
GetStakeVersions
func (db *WiredDB) GetStakeVersions(blockHash string, count int32) (*dcrjson.GetStakeVersionsResult, error) { return db.client.GetStakeVersions(blockHash, count) }
go
func (db *WiredDB) GetStakeVersions(blockHash string, count int32) (*dcrjson.GetStakeVersionsResult, error) { return db.client.GetStakeVersions(blockHash, count) }
[ "func", "(", "db", "*", "WiredDB", ")", "GetStakeVersions", "(", "blockHash", "string", ",", "count", "int32", ")", "(", "*", "dcrjson", ".", "GetStakeVersionsResult", ",", "error", ")", "{", "return", "db", ".", "client", ".", "GetStakeVersions", "(", "bl...
// GetStakeVersions requests the output of the getstakeversions RPC, which gets // stake version information and individual vote version information starting at the // given block and for count-1 blocks prior.
[ "GetStakeVersions", "requests", "the", "output", "of", "the", "getstakeversions", "RPC", "which", "gets", "stake", "version", "information", "and", "individual", "vote", "version", "information", "starting", "at", "the", "given", "block", "and", "for", "count", "-...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L707-L709
19,829
decred/dcrdata
db/dcrsqlite/apisource.go
GetBlockSummaryTimeRange
func (db *WiredDB) GetBlockSummaryTimeRange(min, max int64, limit int) []apitypes.BlockDataBasic { blockSummary, err := db.RetrieveBlockSummaryByTimeRange(min, max, limit) if err != nil { log.Errorf("Unable to retrieve block summary using time %d: %v", min, err) } return blockSummary }
go
func (db *WiredDB) GetBlockSummaryTimeRange(min, max int64, limit int) []apitypes.BlockDataBasic { blockSummary, err := db.RetrieveBlockSummaryByTimeRange(min, max, limit) if err != nil { log.Errorf("Unable to retrieve block summary using time %d: %v", min, err) } return blockSummary }
[ "func", "(", "db", "*", "WiredDB", ")", "GetBlockSummaryTimeRange", "(", "min", ",", "max", "int64", ",", "limit", "int", ")", "[", "]", "apitypes", ".", "BlockDataBasic", "{", "blockSummary", ",", "err", ":=", "db", ".", "RetrieveBlockSummaryByTimeRange", "...
// GetBlockSummaryTimeRange returns the blocks created within a specified time // range min, max time
[ "GetBlockSummaryTimeRange", "returns", "the", "blocks", "created", "within", "a", "specified", "time", "range", "min", "max", "time" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L930-L936
19,830
decred/dcrdata
db/dcrsqlite/apisource.go
RetreiveDifficulty
func (db *WiredDB) RetreiveDifficulty(timestamp int64) float64 { sdiff, err := db.RetrieveDiff(timestamp) if err != nil { log.Errorf("Unable to retrieve difficulty: %v", err) return -1 } return sdiff }
go
func (db *WiredDB) RetreiveDifficulty(timestamp int64) float64 { sdiff, err := db.RetrieveDiff(timestamp) if err != nil { log.Errorf("Unable to retrieve difficulty: %v", err) return -1 } return sdiff }
[ "func", "(", "db", "*", "WiredDB", ")", "RetreiveDifficulty", "(", "timestamp", "int64", ")", "float64", "{", "sdiff", ",", "err", ":=", "db", ".", "RetrieveDiff", "(", "timestamp", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", ...
// RetreiveDifficulty fetches the difficulty value in the last 24hrs or // immediately after 24hrs.
[ "RetreiveDifficulty", "fetches", "the", "difficulty", "value", "in", "the", "last", "24hrs", "or", "immediately", "after", "24hrs", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L985-L992
19,831
decred/dcrdata
db/dcrsqlite/apisource.go
GetAddressTransactionsWithSkip
func (db *WiredDB) GetAddressTransactionsWithSkip(addr string, count, skip int) *apitypes.Address { address, err := dcrutil.DecodeAddress(addr) if err != nil { log.Infof("Invalid address %s: %v", addr, err) return nil } txs, err := db.client.SearchRawTransactionsVerbose(address, skip, count, false, true, nil) ...
go
func (db *WiredDB) GetAddressTransactionsWithSkip(addr string, count, skip int) *apitypes.Address { address, err := dcrutil.DecodeAddress(addr) if err != nil { log.Infof("Invalid address %s: %v", addr, err) return nil } txs, err := db.client.SearchRawTransactionsVerbose(address, skip, count, false, true, nil) ...
[ "func", "(", "db", "*", "WiredDB", ")", "GetAddressTransactionsWithSkip", "(", "addr", "string", ",", "count", ",", "skip", "int", ")", "*", "apitypes", ".", "Address", "{", "address", ",", "err", ":=", "dcrutil", ".", "DecodeAddress", "(", "addr", ")", ...
// GetAddressTransactionsWithSkip returns an apitypes.Address Object with at most the // last count transactions the address was in
[ "GetAddressTransactionsWithSkip", "returns", "an", "apitypes", ".", "Address", "Object", "with", "at", "most", "the", "last", "count", "transactions", "the", "address", "was", "in" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1040-L1073
19,832
decred/dcrdata
db/dcrsqlite/apisource.go
GetAddressTransactions
func (db *WiredDB) GetAddressTransactions(addr string, count int) *apitypes.Address { return db.GetAddressTransactionsWithSkip(addr, count, 0) }
go
func (db *WiredDB) GetAddressTransactions(addr string, count int) *apitypes.Address { return db.GetAddressTransactionsWithSkip(addr, count, 0) }
[ "func", "(", "db", "*", "WiredDB", ")", "GetAddressTransactions", "(", "addr", "string", ",", "count", "int", ")", "*", "apitypes", ".", "Address", "{", "return", "db", ".", "GetAddressTransactionsWithSkip", "(", "addr", ",", "count", ",", "0", ")", "\n", ...
// GetAddressTransactions returns an apitypes.Address Object with at most the // last count transactions the address was in
[ "GetAddressTransactions", "returns", "an", "apitypes", ".", "Address", "Object", "with", "at", "most", "the", "last", "count", "transactions", "the", "address", "was", "in" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1077-L1079
19,833
decred/dcrdata
db/dcrsqlite/apisource.go
GetAddressTransactionsRaw
func (db *WiredDB) GetAddressTransactionsRaw(addr string, count int) []*apitypes.AddressTxRaw { return db.GetAddressTransactionsRawWithSkip(addr, count, 0) }
go
func (db *WiredDB) GetAddressTransactionsRaw(addr string, count int) []*apitypes.AddressTxRaw { return db.GetAddressTransactionsRawWithSkip(addr, count, 0) }
[ "func", "(", "db", "*", "WiredDB", ")", "GetAddressTransactionsRaw", "(", "addr", "string", ",", "count", "int", ")", "[", "]", "*", "apitypes", ".", "AddressTxRaw", "{", "return", "db", ".", "GetAddressTransactionsRawWithSkip", "(", "addr", ",", "count", ",...
// GetAddressTransactionsRaw returns an array of apitypes.AddressTxRaw objects // representing the raw result of SearchRawTransactionsverbose
[ "GetAddressTransactionsRaw", "returns", "an", "array", "of", "apitypes", ".", "AddressTxRaw", "objects", "representing", "the", "raw", "result", "of", "SearchRawTransactionsverbose" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1083-L1085
19,834
decred/dcrdata
db/dcrsqlite/apisource.go
GetExplorerBlocks
func (db *WiredDB) GetExplorerBlocks(start int, end int) []*exptypes.BlockBasic { if start < end { return nil } summaries := make([]*exptypes.BlockBasic, 0, start-end) for i := start; i > end; i-- { data := db.GetBlockVerbose(i, true) block := new(exptypes.BlockBasic) if data != nil { block = makeExplore...
go
func (db *WiredDB) GetExplorerBlocks(start int, end int) []*exptypes.BlockBasic { if start < end { return nil } summaries := make([]*exptypes.BlockBasic, 0, start-end) for i := start; i > end; i-- { data := db.GetBlockVerbose(i, true) block := new(exptypes.BlockBasic) if data != nil { block = makeExplore...
[ "func", "(", "db", "*", "WiredDB", ")", "GetExplorerBlocks", "(", "start", "int", ",", "end", "int", ")", "[", "]", "*", "exptypes", ".", "BlockBasic", "{", "if", "start", "<", "end", "{", "return", "nil", "\n", "}", "\n", "summaries", ":=", "make", ...
// GetExplorerBlocks creates an slice of exptypes.BlockBasic beginning at start // and decreasing in block height to end, not including end.
[ "GetExplorerBlocks", "creates", "an", "slice", "of", "exptypes", ".", "BlockBasic", "beginning", "at", "start", "and", "decreasing", "in", "block", "height", "to", "end", "not", "including", "end", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1245-L1259
19,835
decred/dcrdata
db/dcrsqlite/apisource.go
GetMempool
func (db *WiredDB) GetMempool() []exptypes.MempoolTx { mempooltxs, err := db.client.GetRawMempoolVerbose(dcrjson.GRMAll) if err != nil { log.Errorf("GetRawMempoolVerbose failed: %v", err) return nil } txs := make([]exptypes.MempoolTx, 0, len(mempooltxs)) for hashStr, tx := range mempooltxs { hash, err := c...
go
func (db *WiredDB) GetMempool() []exptypes.MempoolTx { mempooltxs, err := db.client.GetRawMempoolVerbose(dcrjson.GRMAll) if err != nil { log.Errorf("GetRawMempoolVerbose failed: %v", err) return nil } txs := make([]exptypes.MempoolTx, 0, len(mempooltxs)) for hashStr, tx := range mempooltxs { hash, err := c...
[ "func", "(", "db", "*", "WiredDB", ")", "GetMempool", "(", ")", "[", "]", "exptypes", ".", "MempoolTx", "{", "mempooltxs", ",", "err", ":=", "db", ".", "client", ".", "GetRawMempoolVerbose", "(", "dcrjson", ".", "GRMAll", ")", "\n", "if", "err", "!=", ...
// GetMempool gets all transactions from the mempool for explorer and adds the // total out for all the txs and vote info for the votes. The returned slice // will be nil if the GetRawMempoolVerbose RPC fails. A zero-length non-nil // slice is returned if there are no transactions in mempool.
[ "GetMempool", "gets", "all", "transactions", "from", "the", "mempool", "for", "explorer", "and", "adds", "the", "total", "out", "for", "all", "the", "txs", "and", "vote", "info", "for", "the", "votes", ".", "The", "returned", "slice", "will", "be", "nil", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1706-L1766
19,836
decred/dcrdata
db/dcrsqlite/apisource.go
TxHeight
func (db *WiredDB) TxHeight(txid *chainhash.Hash) (height int64) { txraw, err := db.client.GetRawTransactionVerbose(txid) if err != nil { log.Errorf("GetRawTransactionVerbose failed for: %v", txid) return 0 } height = txraw.BlockHeight return }
go
func (db *WiredDB) TxHeight(txid *chainhash.Hash) (height int64) { txraw, err := db.client.GetRawTransactionVerbose(txid) if err != nil { log.Errorf("GetRawTransactionVerbose failed for: %v", txid) return 0 } height = txraw.BlockHeight return }
[ "func", "(", "db", "*", "WiredDB", ")", "TxHeight", "(", "txid", "*", "chainhash", ".", "Hash", ")", "(", "height", "int64", ")", "{", "txraw", ",", "err", ":=", "db", ".", "client", ".", "GetRawTransactionVerbose", "(", "txid", ")", "\n", "if", "err...
// TxHeight gives the block height of the transaction id specified
[ "TxHeight", "gives", "the", "block", "height", "of", "the", "transaction", "id", "specified" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1769-L1777
19,837
decred/dcrdata
db/dcrsqlite/apisource.go
Difficulty
func (db *WiredDB) Difficulty() (float64, error) { diff, err := db.client.GetDifficulty() if err != nil { log.Error("GetDifficulty failed") return diff, err } return diff, nil }
go
func (db *WiredDB) Difficulty() (float64, error) { diff, err := db.client.GetDifficulty() if err != nil { log.Error("GetDifficulty failed") return diff, err } return diff, nil }
[ "func", "(", "db", "*", "WiredDB", ")", "Difficulty", "(", ")", "(", "float64", ",", "error", ")", "{", "diff", ",", "err", ":=", "db", ".", "client", ".", "GetDifficulty", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Error", "(", ...
// Difficulty returns the difficulty.
[ "Difficulty", "returns", "the", "difficulty", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1780-L1787
19,838
decred/dcrdata
db/dcrsqlite/apisource.go
GetTip
func (db *WiredDB) GetTip() (*exptypes.WebBasicBlock, error) { tip, err := db.DB.getTip() if err != nil { return nil, err } blockdata := exptypes.WebBasicBlock{ Height: tip.Height, Size: tip.Size, Hash: tip.Hash, Difficulty: tip.Difficulty, StakeDiff: tip.StakeDiff, Time: ...
go
func (db *WiredDB) GetTip() (*exptypes.WebBasicBlock, error) { tip, err := db.DB.getTip() if err != nil { return nil, err } blockdata := exptypes.WebBasicBlock{ Height: tip.Height, Size: tip.Size, Hash: tip.Hash, Difficulty: tip.Difficulty, StakeDiff: tip.StakeDiff, Time: ...
[ "func", "(", "db", "*", "WiredDB", ")", "GetTip", "(", ")", "(", "*", "exptypes", ".", "WebBasicBlock", ",", "error", ")", "{", "tip", ",", "err", ":=", "db", ".", "DB", ".", "getTip", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "n...
// GetTip grabs the highest block stored in the database.
[ "GetTip", "grabs", "the", "highest", "block", "stored", "in", "the", "database", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/apisource.go#L1790-L1809
19,839
decred/dcrdata
api/types/apitypes.go
MarshalJSON
func (t *TimeAPI) MarshalJSON() ([]byte, error) { return json.Marshal(t.S.UNIX()) }
go
func (t *TimeAPI) MarshalJSON() ([]byte, error) { return json.Marshal(t.S.UNIX()) }
[ "func", "(", "t", "*", "TimeAPI", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "t", ".", "S", ".", "UNIX", "(", ")", ")", "\n", "}" ]
// MarshalJSON is set as the default marshalling function for TimeAPI struct.
[ "MarshalJSON", "is", "set", "as", "the", "default", "marshalling", "function", "for", "TimeAPI", "struct", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L37-L39
19,840
decred/dcrdata
api/types/apitypes.go
NewTimeAPI
func NewTimeAPI(t time.Time) TimeAPI { return TimeAPI{ S: dbtypes.NewTimeDef(t), } }
go
func NewTimeAPI(t time.Time) TimeAPI { return TimeAPI{ S: dbtypes.NewTimeDef(t), } }
[ "func", "NewTimeAPI", "(", "t", "time", ".", "Time", ")", "TimeAPI", "{", "return", "TimeAPI", "{", "S", ":", "dbtypes", ".", "NewTimeDef", "(", "t", ")", ",", "}", "\n", "}" ]
// NewTimeAPI constructs a TimeAPI from the given time.Time. It presets the // timezone for formatting to UTC.
[ "NewTimeAPI", "constructs", "a", "TimeAPI", "from", "the", "given", "time", ".", "Time", ".", "It", "presets", "the", "timezone", "for", "formatting", "to", "UTC", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L56-L60
19,841
decred/dcrdata
api/types/apitypes.go
String
func (sc ScriptClass) String() string { name, found := scriptClassToName[sc] if !found { return ScriptClassInvalid.String() // better be in scriptClassToName! } return name }
go
func (sc ScriptClass) String() string { name, found := scriptClassToName[sc] if !found { return ScriptClassInvalid.String() // better be in scriptClassToName! } return name }
[ "func", "(", "sc", "ScriptClass", ")", "String", "(", ")", "string", "{", "name", ",", "found", ":=", "scriptClassToName", "[", "sc", "]", "\n", "if", "!", "found", "{", "return", "ScriptClassInvalid", ".", "String", "(", ")", "// better be in scriptClassToN...
// String returns the name of the ScriptClass. If the ScriptClass is // unrecognized it is treated as ScriptClassInvalid.
[ "String", "returns", "the", "name", "of", "the", "ScriptClass", ".", "If", "the", "ScriptClass", "is", "unrecognized", "it", "is", "treated", "as", "ScriptClassInvalid", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L265-L271
19,842
decred/dcrdata
api/types/apitypes.go
NewStatus
func NewStatus(nodeHeight uint32, conns int64, apiVersion int, dcrdataVersion, netName string) *Status { return &Status{ height: nodeHeight, nodeConnections: conns, api: APIStatus{ APIVersion: apiVersion, DcrdataVersion: dcrdataVersion, NetworkName: netName, }, } }
go
func NewStatus(nodeHeight uint32, conns int64, apiVersion int, dcrdataVersion, netName string) *Status { return &Status{ height: nodeHeight, nodeConnections: conns, api: APIStatus{ APIVersion: apiVersion, DcrdataVersion: dcrdataVersion, NetworkName: netName, }, } }
[ "func", "NewStatus", "(", "nodeHeight", "uint32", ",", "conns", "int64", ",", "apiVersion", "int", ",", "dcrdataVersion", ",", "netName", "string", ")", "*", "Status", "{", "return", "&", "Status", "{", "height", ":", "nodeHeight", ",", "nodeConnections", ":...
// NewStatus is the constructor for a new Status.
[ "NewStatus", "is", "the", "constructor", "for", "a", "new", "Status", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L435-L445
19,843
decred/dcrdata
api/types/apitypes.go
API
func (s *Status) API() APIStatus { s.RLock() defer s.RUnlock() return APIStatus{ Ready: s.ready, DBHeight: s.dbHeight, DBLastBlockTime: s.dbLastBlockTime, Height: s.height, NodeConnections: s.nodeConnections, APIVersion: s.api.APIVersion, DcrdataVersion: s.api.DcrdataVer...
go
func (s *Status) API() APIStatus { s.RLock() defer s.RUnlock() return APIStatus{ Ready: s.ready, DBHeight: s.dbHeight, DBLastBlockTime: s.dbLastBlockTime, Height: s.height, NodeConnections: s.nodeConnections, APIVersion: s.api.APIVersion, DcrdataVersion: s.api.DcrdataVer...
[ "func", "(", "s", "*", "Status", ")", "API", "(", ")", "APIStatus", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "return", "APIStatus", "{", "Ready", ":", "s", ".", "ready", ",", "DBHeight", ":", "s", "....
// API is a method for creating an APIStatus from Status.
[ "API", "is", "a", "method", "for", "creating", "an", "APIStatus", "from", "Status", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L448-L461
19,844
decred/dcrdata
api/types/apitypes.go
Height
func (s *Status) Height() uint32 { s.RLock() defer s.RUnlock() return s.height }
go
func (s *Status) Height() uint32 { s.RLock() defer s.RUnlock() return s.height }
[ "func", "(", "s", "*", "Status", ")", "Height", "(", ")", "uint32", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "return", "s", ".", "height", "\n", "}" ]
// Height is the last known node height.
[ "Height", "is", "the", "last", "known", "node", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L464-L468
19,845
decred/dcrdata
api/types/apitypes.go
SetHeight
func (s *Status) SetHeight(height uint32) { s.Lock() defer s.Unlock() s.ready = height == s.dbHeight s.height = height }
go
func (s *Status) SetHeight(height uint32) { s.Lock() defer s.Unlock() s.ready = height == s.dbHeight s.height = height }
[ "func", "(", "s", "*", "Status", ")", "SetHeight", "(", "height", "uint32", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "s", ".", "ready", "=", "height", "==", "s", ".", "dbHeight", "\n", "s", ".", ...
// SetHeight stores the node height. Additionally, Status.ready is set to true // if Status.height is the same as Status.dbHeight.
[ "SetHeight", "stores", "the", "node", "height", ".", "Additionally", "Status", ".", "ready", "is", "set", "to", "true", "if", "Status", ".", "height", "is", "the", "same", "as", "Status", ".", "dbHeight", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L472-L477
19,846
decred/dcrdata
api/types/apitypes.go
SetHeightAndConnections
func (s *Status) SetHeightAndConnections(height uint32, conns int64) { s.Lock() defer s.Unlock() s.nodeConnections = conns s.ready = height == s.dbHeight s.height = height }
go
func (s *Status) SetHeightAndConnections(height uint32, conns int64) { s.Lock() defer s.Unlock() s.nodeConnections = conns s.ready = height == s.dbHeight s.height = height }
[ "func", "(", "s", "*", "Status", ")", "SetHeightAndConnections", "(", "height", "uint32", ",", "conns", "int64", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "s", ".", "nodeConnections", "=", "conns", "\n",...
// SetHeightAndConnections simultaneously sets the node height and node // connection count. Status.ready is set to true if the height and dbHeight are // the same.
[ "SetHeightAndConnections", "simultaneously", "sets", "the", "node", "height", "and", "node", "connection", "count", ".", "Status", ".", "ready", "is", "set", "to", "true", "if", "the", "height", "and", "dbHeight", "are", "the", "same", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L482-L488
19,847
decred/dcrdata
api/types/apitypes.go
SetReady
func (s *Status) SetReady(ready bool) { s.Lock() defer s.Unlock() s.ready = ready }
go
func (s *Status) SetReady(ready bool) { s.Lock() defer s.Unlock() s.ready = ready }
[ "func", "(", "s", "*", "Status", ")", "SetReady", "(", "ready", "bool", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "s", ".", "ready", "=", "ready", "\n", "}" ]
// SetReady sets the ready state.
[ "SetReady", "sets", "the", "ready", "state", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L491-L495
19,848
decred/dcrdata
api/types/apitypes.go
DBUpdate
func (s *Status) DBUpdate(height uint32, blockTime int64) { s.Lock() defer s.Unlock() s.dbHeight = height s.dbLastBlockTime = blockTime s.ready = s.dbHeight == height }
go
func (s *Status) DBUpdate(height uint32, blockTime int64) { s.Lock() defer s.Unlock() s.dbHeight = height s.dbLastBlockTime = blockTime s.ready = s.dbHeight == height }
[ "func", "(", "s", "*", "Status", ")", "DBUpdate", "(", "height", "uint32", ",", "blockTime", "int64", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "s", ".", "dbHeight", "=", "height", "\n", "s", ".", ...
// DBUpdate updates both the height and time of the best DB block. Status.ready // is set to true if Status.height is the same as Status.dbHeight.
[ "DBUpdate", "updates", "both", "the", "height", "and", "time", "of", "the", "best", "DB", "block", ".", "Status", ".", "ready", "is", "set", "to", "true", "if", "Status", ".", "height", "is", "the", "same", "as", "Status", ".", "dbHeight", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/types/apitypes.go#L499-L505
19,849
decred/dcrdata
db/dcrpg/upgrades.go
String
func (v DatabaseVersion) String() string { return fmt.Sprintf("%d.%d.%d", v.compat, v.schema, v.maint) }
go
func (v DatabaseVersion) String() string { return fmt.Sprintf("%d.%d.%d", v.compat, v.schema, v.maint) }
[ "func", "(", "v", "DatabaseVersion", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "compat", ",", "v", ".", "schema", ",", "v", ".", "maint", ")", "\n", "}" ]
// String implements Stringer for DatabaseVersion.
[ "String", "implements", "Stringer", "for", "DatabaseVersion", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades.go#L52-L54
19,850
decred/dcrdata
db/dcrpg/upgrades.go
NewDatabaseVersion
func NewDatabaseVersion(major, minor, patch uint32) DatabaseVersion { return DatabaseVersion{major, minor, patch} }
go
func NewDatabaseVersion(major, minor, patch uint32) DatabaseVersion { return DatabaseVersion{major, minor, patch} }
[ "func", "NewDatabaseVersion", "(", "major", ",", "minor", ",", "patch", "uint32", ")", "DatabaseVersion", "{", "return", "DatabaseVersion", "{", "major", ",", "minor", ",", "patch", "}", "\n", "}" ]
// NewDatabaseVersion returns a new DatabaseVersion with the version major.minor.patch
[ "NewDatabaseVersion", "returns", "a", "new", "DatabaseVersion", "with", "the", "version", "major", ".", "minor", ".", "patch" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades.go#L57-L59
19,851
decred/dcrdata
db/dcrpg/upgrades.go
NeededToReach
func (v *DatabaseVersion) NeededToReach(other *DatabaseVersion) CompatAction { switch { case v.compat < other.compat: return Rebuild case v.compat < other.compat: return TimeTravel case v.schema < other.schema: return Upgrade case v.schema > other.schema: return TimeTravel case v.maint < other.maint: re...
go
func (v *DatabaseVersion) NeededToReach(other *DatabaseVersion) CompatAction { switch { case v.compat < other.compat: return Rebuild case v.compat < other.compat: return TimeTravel case v.schema < other.schema: return Upgrade case v.schema > other.schema: return TimeTravel case v.maint < other.maint: re...
[ "func", "(", "v", "*", "DatabaseVersion", ")", "NeededToReach", "(", "other", "*", "DatabaseVersion", ")", "CompatAction", "{", "switch", "{", "case", "v", ".", "compat", "<", "other", ".", "compat", ":", "return", "Rebuild", "\n", "case", "v", ".", "com...
// NeededToReach describes what action is required for the DatabaseVersion to // reach another version provided in the input argument.
[ "NeededToReach", "describes", "what", "action", "is", "required", "for", "the", "DatabaseVersion", "to", "reach", "another", "version", "provided", "in", "the", "input", "argument", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades.go#L83-L100
19,852
decred/dcrdata
db/dcrpg/upgrades.go
String
func (v CompatAction) String() string { actions := map[CompatAction]string{ Rebuild: "rebuild", Upgrade: "upgrade", Maintenance: "maintenance", TimeTravel: "time travel", OK: "ok", } if actionStr, ok := actions[v]; ok { return actionStr } return "unknown" }
go
func (v CompatAction) String() string { actions := map[CompatAction]string{ Rebuild: "rebuild", Upgrade: "upgrade", Maintenance: "maintenance", TimeTravel: "time travel", OK: "ok", } if actionStr, ok := actions[v]; ok { return actionStr } return "unknown" }
[ "func", "(", "v", "CompatAction", ")", "String", "(", ")", "string", "{", "actions", ":=", "map", "[", "CompatAction", "]", "string", "{", "Rebuild", ":", "\"", "\"", ",", "Upgrade", ":", "\"", "\"", ",", "Maintenance", ":", "\"", "\"", ",", "TimeTra...
// String implements Stringer for CompatAction.
[ "String", "implements", "Stringer", "for", "CompatAction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades.go#L103-L115
19,853
decred/dcrdata
dcrrates/rateserver/types.go
NewRateServer
func NewRateServer(index string, xcBot *exchanges.ExchangeBot) *RateServer { return &RateServer{ btcIndex: index, clientLock: new(sync.RWMutex), clients: make(map[StreamID]RateClient), xcBot: xcBot, } }
go
func NewRateServer(index string, xcBot *exchanges.ExchangeBot) *RateServer { return &RateServer{ btcIndex: index, clientLock: new(sync.RWMutex), clients: make(map[StreamID]RateClient), xcBot: xcBot, } }
[ "func", "NewRateServer", "(", "index", "string", ",", "xcBot", "*", "exchanges", ".", "ExchangeBot", ")", "*", "RateServer", "{", "return", "&", "RateServer", "{", "btcIndex", ":", "index", ",", "clientLock", ":", "new", "(", "sync", ".", "RWMutex", ")", ...
// NewRateServer is a constructor for a RateServer.
[ "NewRateServer", "is", "a", "constructor", "for", "a", "RateServer", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L37-L44
19,854
decred/dcrdata
dcrrates/rateserver/types.go
sendStateList
func sendStateList(client RateClient, states map[string]*exchanges.ExchangeState) (err error) { for token, state := range states { err = client.SendExchangeUpdate(makeExchangeRateUpdate(&exchanges.ExchangeUpdate{ Token: token, State: state, })) if err != nil { log.Errorf("SendExchangeUpdate error for %s...
go
func sendStateList(client RateClient, states map[string]*exchanges.ExchangeState) (err error) { for token, state := range states { err = client.SendExchangeUpdate(makeExchangeRateUpdate(&exchanges.ExchangeUpdate{ Token: token, State: state, })) if err != nil { log.Errorf("SendExchangeUpdate error for %s...
[ "func", "sendStateList", "(", "client", "RateClient", ",", "states", "map", "[", "string", "]", "*", "exchanges", ".", "ExchangeState", ")", "(", "err", "error", ")", "{", "for", "token", ",", "state", ":=", "range", "states", "{", "err", "=", "client", ...
// sendStateList is a helper for parsing the ExchangeBotState when a new client // subscription is received.
[ "sendStateList", "is", "a", "helper", "for", "parsing", "the", "ExchangeBotState", "when", "a", "new", "client", "subscription", "is", "received", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L54-L66
19,855
decred/dcrdata
dcrrates/rateserver/types.go
ReallySubscribeExchanges
func (server *RateServer) ReallySubscribeExchanges(hello *dcrrates.ExchangeSubscription, stream GRPCStream) (err error) { // For now, require the ExchangeBot clients to have the same base currency. // ToDo: Allow any index. if hello.BtcIndex != server.btcIndex { return fmt.Errorf("Exchange subscription has wrong B...
go
func (server *RateServer) ReallySubscribeExchanges(hello *dcrrates.ExchangeSubscription, stream GRPCStream) (err error) { // For now, require the ExchangeBot clients to have the same base currency. // ToDo: Allow any index. if hello.BtcIndex != server.btcIndex { return fmt.Errorf("Exchange subscription has wrong B...
[ "func", "(", "server", "*", "RateServer", ")", "ReallySubscribeExchanges", "(", "hello", "*", "dcrrates", ".", "ExchangeSubscription", ",", "stream", "GRPCStream", ")", "(", "err", "error", ")", "{", "// For now, require the ExchangeBot clients to have the same base curre...
// ReallySubscribeExchanges stores the client and their exchange subscriptions. // It waits for the client contexts Done channel to close and deletes the client // from the RateServer.clients map.
[ "ReallySubscribeExchanges", "stores", "the", "client", "and", "their", "exchange", "subscriptions", ".", "It", "waits", "for", "the", "client", "contexts", "Done", "channel", "to", "close", "and", "deletes", "the", "client", "from", "the", "RateServer", ".", "cl...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L78-L122
19,856
decred/dcrdata
dcrrates/rateserver/types.go
addClient
func (server *RateServer) addClient(stream GRPCStream, hello *dcrrates.ExchangeSubscription) (RateClient, StreamID) { server.clientLock.Lock() defer server.clientLock.Unlock() client := NewRateClient(stream, hello.GetExchanges()) streamCounter++ server.clients[streamCounter] = client return client, streamCounter ...
go
func (server *RateServer) addClient(stream GRPCStream, hello *dcrrates.ExchangeSubscription) (RateClient, StreamID) { server.clientLock.Lock() defer server.clientLock.Unlock() client := NewRateClient(stream, hello.GetExchanges()) streamCounter++ server.clients[streamCounter] = client return client, streamCounter ...
[ "func", "(", "server", "*", "RateServer", ")", "addClient", "(", "stream", "GRPCStream", ",", "hello", "*", "dcrrates", ".", "ExchangeSubscription", ")", "(", "RateClient", ",", "StreamID", ")", "{", "server", ".", "clientLock", ".", "Lock", "(", ")", "\n"...
// addClient adds a client to the map and advance the streamCounter.
[ "addClient", "adds", "a", "client", "to", "the", "map", "and", "advance", "the", "streamCounter", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L125-L132
19,857
decred/dcrdata
dcrrates/rateserver/types.go
deleteClient
func (server *RateServer) deleteClient(sid StreamID) { server.clientLock.Lock() defer server.clientLock.Unlock() delete(server.clients, sid) }
go
func (server *RateServer) deleteClient(sid StreamID) { server.clientLock.Lock() defer server.clientLock.Unlock() delete(server.clients, sid) }
[ "func", "(", "server", "*", "RateServer", ")", "deleteClient", "(", "sid", "StreamID", ")", "{", "server", ".", "clientLock", ".", "Lock", "(", ")", "\n", "defer", "server", ".", "clientLock", ".", "Unlock", "(", ")", "\n", "delete", "(", "server", "."...
// deleteClient deletes the client from the map.
[ "deleteClient", "deletes", "the", "client", "from", "the", "map", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L135-L139
19,858
decred/dcrdata
dcrrates/rateserver/types.go
NewRateClient
func NewRateClient(stream GRPCStream, exchanges []string) RateClient { return &rateClient{ stream: stream, exchanges: exchanges, } }
go
func NewRateClient(stream GRPCStream, exchanges []string) RateClient { return &rateClient{ stream: stream, exchanges: exchanges, } }
[ "func", "NewRateClient", "(", "stream", "GRPCStream", ",", "exchanges", "[", "]", "string", ")", "RateClient", "{", "return", "&", "rateClient", "{", "stream", ":", "stream", ",", "exchanges", ":", "exchanges", ",", "}", "\n", "}" ]
// NewRateClient is a constructor for rate client. It returns the RateClient // interface rather than rateClient itself.
[ "NewRateClient", "is", "a", "constructor", "for", "rate", "client", ".", "It", "returns", "the", "RateClient", "interface", "rather", "than", "rateClient", "itself", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L150-L155
19,859
decred/dcrdata
dcrrates/rateserver/types.go
makeExchangeRateUpdate
func makeExchangeRateUpdate(update *exchanges.ExchangeUpdate) *dcrrates.ExchangeRateUpdate { state := update.State protoUpdate := &dcrrates.ExchangeRateUpdate{ Token: update.Token, Price: state.Price, BaseVolume: state.BaseVolume, Volume: state.Volume, Change: state.Change, Stamp: s...
go
func makeExchangeRateUpdate(update *exchanges.ExchangeUpdate) *dcrrates.ExchangeRateUpdate { state := update.State protoUpdate := &dcrrates.ExchangeRateUpdate{ Token: update.Token, Price: state.Price, BaseVolume: state.BaseVolume, Volume: state.Volume, Change: state.Change, Stamp: s...
[ "func", "makeExchangeRateUpdate", "(", "update", "*", "exchanges", ".", "ExchangeUpdate", ")", "*", "dcrrates", ".", "ExchangeRateUpdate", "{", "state", ":=", "update", ".", "State", "\n", "protoUpdate", ":=", "&", "dcrrates", ".", "ExchangeRateUpdate", "{", "To...
// Translate from the ExchangeBot's type to the gRPC type.
[ "Translate", "from", "the", "ExchangeBot", "s", "type", "to", "the", "gRPC", "type", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L158-L211
19,860
decred/dcrdata
dcrrates/rateserver/types.go
SendExchangeUpdate
func (client *rateClient) SendExchangeUpdate(update *dcrrates.ExchangeRateUpdate) (err error) { for i := range client.exchanges { if client.exchanges[i] == update.Token { err = client.stream.Send(update) return } } return }
go
func (client *rateClient) SendExchangeUpdate(update *dcrrates.ExchangeRateUpdate) (err error) { for i := range client.exchanges { if client.exchanges[i] == update.Token { err = client.stream.Send(update) return } } return }
[ "func", "(", "client", "*", "rateClient", ")", "SendExchangeUpdate", "(", "update", "*", "dcrrates", ".", "ExchangeRateUpdate", ")", "(", "err", "error", ")", "{", "for", "i", ":=", "range", "client", ".", "exchanges", "{", "if", "client", ".", "exchanges"...
// SendExchangeUpdate sends the update if the client is subscribed to the exchange.
[ "SendExchangeUpdate", "sends", "the", "update", "if", "the", "client", "is", "subscribed", "to", "the", "exchange", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L214-L222
19,861
decred/dcrdata
blockdata/datasaver.go
NewBlockDataToSummaryStdOut
func NewBlockDataToSummaryStdOut(sdiffWinSize int64, m ...*sync.Mutex) *BlockDataToSummaryStdOut { if len(m) > 1 { panic("Too many inputs.") } if len(m) > 0 { return &BlockDataToSummaryStdOut{m[0], sdiffWinSize} } return &BlockDataToSummaryStdOut{sdiffWinSize: sdiffWinSize} }
go
func NewBlockDataToSummaryStdOut(sdiffWinSize int64, m ...*sync.Mutex) *BlockDataToSummaryStdOut { if len(m) > 1 { panic("Too many inputs.") } if len(m) > 0 { return &BlockDataToSummaryStdOut{m[0], sdiffWinSize} } return &BlockDataToSummaryStdOut{sdiffWinSize: sdiffWinSize} }
[ "func", "NewBlockDataToSummaryStdOut", "(", "sdiffWinSize", "int64", ",", "m", "...", "*", "sync", ".", "Mutex", ")", "*", "BlockDataToSummaryStdOut", "{", "if", "len", "(", "m", ")", ">", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if",...
// NewBlockDataToSummaryStdOut creates a new BlockDataToSummaryStdOut with // optional existing mutex
[ "NewBlockDataToSummaryStdOut", "creates", "a", "new", "BlockDataToSummaryStdOut", "with", "optional", "existing", "mutex" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L77-L85
19,862
decred/dcrdata
blockdata/datasaver.go
NewBlockDataToJSONFiles
func NewBlockDataToJSONFiles(folder string, fileBase string, m ...*sync.Mutex) *BlockDataToJSONFiles { if len(m) > 1 { panic("Too many inputs.") } var mtx *sync.Mutex if len(m) > 0 { mtx = m[0] } else { mtx = new(sync.Mutex) } return &BlockDataToJSONFiles{ fileSaver: fileSaver{ folder: folder, ...
go
func NewBlockDataToJSONFiles(folder string, fileBase string, m ...*sync.Mutex) *BlockDataToJSONFiles { if len(m) > 1 { panic("Too many inputs.") } var mtx *sync.Mutex if len(m) > 0 { mtx = m[0] } else { mtx = new(sync.Mutex) } return &BlockDataToJSONFiles{ fileSaver: fileSaver{ folder: folder, ...
[ "func", "NewBlockDataToJSONFiles", "(", "folder", "string", ",", "fileBase", "string", ",", "m", "...", "*", "sync", ".", "Mutex", ")", "*", "BlockDataToJSONFiles", "{", "if", "len", "(", "m", ")", ">", "1", "{", "panic", "(", "\"", "\"", ")", "\n", ...
// NewBlockDataToJSONFiles creates a new BlockDataToJSONFiles with optional // existing mutex
[ "NewBlockDataToJSONFiles", "creates", "a", "new", "BlockDataToJSONFiles", "with", "optional", "existing", "mutex" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L89-L110
19,863
decred/dcrdata
blockdata/datasaver.go
Store
func (s *BlockDataToJSONStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to std...
go
func (s *BlockDataToJSONStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to std...
[ "func", "(", "s", "*", "BlockDataToJSONStdOut", ")", "Store", "(", "data", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "if", "s", ".", "mtx", "!=", "nil", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer"...
// Store writes BlockData to stdout in JSON format
[ "Store", "writes", "BlockData", "to", "stdout", "in", "JSON", "format" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L113-L131
19,864
decred/dcrdata
blockdata/datasaver.go
Store
func (s *BlockDataToSummaryStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } fmt.Printf("\nBlock %v:\n", data.Header.Height) fmt.Printf(" Stake difficulty: %9.3f -> %.3f (current -> next block)\n", data.CurrentStakeDiff.CurrentSta...
go
func (s *BlockDataToSummaryStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } fmt.Printf("\nBlock %v:\n", data.Header.Height) fmt.Printf(" Stake difficulty: %9.3f -> %.3f (current -> next block)\n", data.CurrentStakeDiff.CurrentSta...
[ "func", "(", "s", "*", "BlockDataToSummaryStdOut", ")", "Store", "(", "data", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "if", "s", ".", "mtx", "!=", "nil", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "def...
// Store writes BlockData to stdout as plain text summary
[ "Store", "writes", "BlockData", "to", "stdout", "as", "plain", "text", "summary" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L134-L163
19,865
decred/dcrdata
blockdata/datasaver.go
Store
func (s *BlockDataToJSONFiles) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to a fi...
go
func (s *BlockDataToJSONFiles) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to a fi...
[ "func", "(", "s", "*", "BlockDataToJSONFiles", ")", "Store", "(", "data", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "if", "s", ".", "mtx", "!=", "nil", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer",...
// Store writes BlockData to a file in JSON format // The file name is nameBase+height+".json".
[ "Store", "writes", "BlockData", "to", "a", "file", "in", "JSON", "format", "The", "file", "name", "is", "nameBase", "+", "height", "+", ".", "json", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L167-L194
19,866
decred/dcrdata
blockdata/datasaver.go
JSONFormatBlockData
func JSONFormatBlockData(data *BlockData) (*bytes.Buffer, error) { var jsonAll bytes.Buffer jsonAll.WriteString("{\"estimatestakediff\": ") stakeDiffEstJSON, err := json.Marshal(data.EstStakeDiff) if err != nil { return nil, err } jsonAll.Write(stakeDiffEstJSON) //stakeDiffEstJSON, err := json.MarshalIndent(d...
go
func JSONFormatBlockData(data *BlockData) (*bytes.Buffer, error) { var jsonAll bytes.Buffer jsonAll.WriteString("{\"estimatestakediff\": ") stakeDiffEstJSON, err := json.Marshal(data.EstStakeDiff) if err != nil { return nil, err } jsonAll.Write(stakeDiffEstJSON) //stakeDiffEstJSON, err := json.MarshalIndent(d...
[ "func", "JSONFormatBlockData", "(", "data", "*", "BlockData", ")", "(", "*", "bytes", ".", "Buffer", ",", "error", ")", "{", "var", "jsonAll", "bytes", ".", "Buffer", "\n\n", "jsonAll", ".", "WriteString", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "s...
// JSONFormatBlockData concatenates block data results into a single JSON // object with primary keys for the result type
[ "JSONFormatBlockData", "concatenates", "block", "data", "results", "into", "a", "single", "JSON", "object", "with", "primary", "keys", "for", "the", "result", "type" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L204-L253
19,867
decred/dcrdata
blockdata/datasaver.go
Store
func (s BlockTrigger) Store(bd *BlockData, _ *wire.MsgBlock) error { s.Saver(bd.Header.Hash, bd.Header.Height) return nil }
go
func (s BlockTrigger) Store(bd *BlockData, _ *wire.MsgBlock) error { s.Saver(bd.Header.Hash, bd.Header.Height) return nil }
[ "func", "(", "s", "BlockTrigger", ")", "Store", "(", "bd", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "s", ".", "Saver", "(", "bd", ".", "Header", ".", "Hash", ",", "bd", ".", "Header", ".", "Height", ")", "\n", ...
// Store reduces the block data to the hash and height in builtin types, // and passes the data to the saver.
[ "Store", "reduces", "the", "block", "data", "to", "the", "hash", "and", "height", "in", "builtin", "types", "and", "passes", "the", "data", "to", "the", "saver", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L263-L266
19,868
decred/dcrdata
blockdata/blockdata.go
ToStakeInfoExtended
func (b *BlockData) ToStakeInfoExtended() apitypes.StakeInfoExtended { return apitypes.StakeInfoExtended{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: b.CurrentStakeDiff.CurrentStakeDifficulty, PriceWindowNum: b.PriceWindowNum, IdxBlockInWindow: b.IdxBlockInWindow, Pool...
go
func (b *BlockData) ToStakeInfoExtended() apitypes.StakeInfoExtended { return apitypes.StakeInfoExtended{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: b.CurrentStakeDiff.CurrentStakeDifficulty, PriceWindowNum: b.PriceWindowNum, IdxBlockInWindow: b.IdxBlockInWindow, Pool...
[ "func", "(", "b", "*", "BlockData", ")", "ToStakeInfoExtended", "(", ")", "apitypes", ".", "StakeInfoExtended", "{", "return", "apitypes", ".", "StakeInfoExtended", "{", "Hash", ":", "b", ".", "Header", ".", "Hash", ",", "Feeinfo", ":", "b", ".", "FeeInfo"...
// ToStakeInfoExtended returns an apitypes.StakeInfoExtended object from the // blockdata
[ "ToStakeInfoExtended", "returns", "an", "apitypes", ".", "StakeInfoExtended", "object", "from", "the", "blockdata" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L42-L51
19,869
decred/dcrdata
blockdata/blockdata.go
ToStakeInfoExtendedEstimates
func (b *BlockData) ToStakeInfoExtendedEstimates() apitypes.StakeInfoExtendedEstimates { return apitypes.StakeInfoExtendedEstimates{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: apitypes.StakeDiff{ GetStakeDifficultyResult: b.CurrentStakeDiff, Estimates: b.EstStakeDiff, IdxBlock...
go
func (b *BlockData) ToStakeInfoExtendedEstimates() apitypes.StakeInfoExtendedEstimates { return apitypes.StakeInfoExtendedEstimates{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: apitypes.StakeDiff{ GetStakeDifficultyResult: b.CurrentStakeDiff, Estimates: b.EstStakeDiff, IdxBlock...
[ "func", "(", "b", "*", "BlockData", ")", "ToStakeInfoExtendedEstimates", "(", ")", "apitypes", ".", "StakeInfoExtendedEstimates", "{", "return", "apitypes", ".", "StakeInfoExtendedEstimates", "{", "Hash", ":", "b", ".", "Header", ".", "Hash", ",", "Feeinfo", ":"...
// ToStakeInfoExtendedEstimates returns an apitypes.StakeInfoExtendedEstimates // object from the blockdata
[ "ToStakeInfoExtendedEstimates", "returns", "an", "apitypes", ".", "StakeInfoExtendedEstimates", "object", "from", "the", "blockdata" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L55-L70
19,870
decred/dcrdata
blockdata/blockdata.go
ToBlockSummary
func (b *BlockData) ToBlockSummary() apitypes.BlockDataBasic { t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockDataBasic{ Height: b.Header.Height, Size: b.Header.Size, Hash: b.Header.Hash, Difficulty: b.Header.Difficulty, StakeDiff: b.Header.SBits, Time: apitypes...
go
func (b *BlockData) ToBlockSummary() apitypes.BlockDataBasic { t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockDataBasic{ Height: b.Header.Height, Size: b.Header.Size, Hash: b.Header.Hash, Difficulty: b.Header.Difficulty, StakeDiff: b.Header.SBits, Time: apitypes...
[ "func", "(", "b", "*", "BlockData", ")", "ToBlockSummary", "(", ")", "apitypes", ".", "BlockDataBasic", "{", "t", ":=", "dbtypes", ".", "NewTimeDefFromUNIX", "(", "b", ".", "Header", ".", "Time", ")", "\n", "return", "apitypes", ".", "BlockDataBasic", "{",...
// ToBlockSummary returns an apitypes.BlockDataBasic object from the blockdata
[ "ToBlockSummary", "returns", "an", "apitypes", ".", "BlockDataBasic", "object", "from", "the", "blockdata" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L73-L84
19,871
decred/dcrdata
blockdata/blockdata.go
ToBlockExplorerSummary
func (b *BlockData) ToBlockExplorerSummary() apitypes.BlockExplorerBasic { extra := b.ExtraInfo t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockExplorerBasic{ Height: b.Header.Height, Size: b.Header.Size, Voters: b.Header.Voters, Revocatio...
go
func (b *BlockData) ToBlockExplorerSummary() apitypes.BlockExplorerBasic { extra := b.ExtraInfo t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockExplorerBasic{ Height: b.Header.Height, Size: b.Header.Size, Voters: b.Header.Voters, Revocatio...
[ "func", "(", "b", "*", "BlockData", ")", "ToBlockExplorerSummary", "(", ")", "apitypes", ".", "BlockExplorerBasic", "{", "extra", ":=", "b", ".", "ExtraInfo", "\n", "t", ":=", "dbtypes", ".", "NewTimeDefFromUNIX", "(", "b", ".", "Header", ".", "Time", ")",...
// ToBlockExplorerSummary returns a BlockExplorerBasic
[ "ToBlockExplorerSummary", "returns", "a", "BlockExplorerBasic" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L87-L100
19,872
decred/dcrdata
blockdata/blockdata.go
NewCollector
func NewCollector(dcrdChainSvr *rpcclient.Client, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase) *Collector { return &Collector{ dcrdChainSvr: dcrdChainSvr, netParams: params, stakeDB: stakeDB, } }
go
func NewCollector(dcrdChainSvr *rpcclient.Client, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase) *Collector { return &Collector{ dcrdChainSvr: dcrdChainSvr, netParams: params, stakeDB: stakeDB, } }
[ "func", "NewCollector", "(", "dcrdChainSvr", "*", "rpcclient", ".", "Client", ",", "params", "*", "chaincfg", ".", "Params", ",", "stakeDB", "*", "stakedb", ".", "StakeDatabase", ")", "*", "Collector", "{", "return", "&", "Collector", "{", "dcrdChainSvr", ":...
// NewCollector creates a new Collector.
[ "NewCollector", "creates", "a", "new", "Collector", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L111-L118
19,873
decred/dcrdata
blockdata/blockdata.go
CollectAPITypes
func (t *Collector) CollectAPITypes(hash *chainhash.Hash) (*apitypes.BlockDataBasic, *apitypes.StakeInfoExtended) { blockDataBasic, feeInfoBlock, _, _, _, err := t.CollectBlockInfo(hash) if err != nil { return nil, nil } height := int64(blockDataBasic.Height) winSize := t.netParams.StakeDiffWindowSize stakeIn...
go
func (t *Collector) CollectAPITypes(hash *chainhash.Hash) (*apitypes.BlockDataBasic, *apitypes.StakeInfoExtended) { blockDataBasic, feeInfoBlock, _, _, _, err := t.CollectBlockInfo(hash) if err != nil { return nil, nil } height := int64(blockDataBasic.Height) winSize := t.netParams.StakeDiffWindowSize stakeIn...
[ "func", "(", "t", "*", "Collector", ")", "CollectAPITypes", "(", "hash", "*", "chainhash", ".", "Hash", ")", "(", "*", "apitypes", ".", "BlockDataBasic", ",", "*", "apitypes", ".", "StakeInfoExtended", ")", "{", "blockDataBasic", ",", "feeInfoBlock", ",", ...
// CollectAPITypes uses CollectBlockInfo to collect block data, then organizes // it into the BlockDataBasic and StakeInfoExtended and dcrdataapi types.
[ "CollectAPITypes", "uses", "CollectBlockInfo", "to", "collect", "block", "data", "then", "organizes", "it", "into", "the", "BlockDataBasic", "and", "StakeInfoExtended", "and", "dcrdataapi", "types", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L122-L141
19,874
decred/dcrdata
blockdata/blockdata.go
CollectHash
func (t *Collector) CollectHash(hash *chainhash.Hash) (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collecto...
go
func (t *Collector) CollectHash(hash *chainhash.Hash) (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collecto...
[ "func", "(", "t", "*", "Collector", ")", "CollectHash", "(", "hash", "*", "chainhash", ".", "Hash", ")", "(", "*", "BlockData", ",", "*", "wire", ".", "MsgBlock", ",", "error", ")", "{", "// In case of a very fast block, make sure previous call to collect is not",...
// CollectHash collects chain data at the block with the specified hash.
[ "CollectHash", "collects", "chain", "data", "at", "the", "block", "with", "the", "specified", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L225-L277
19,875
decred/dcrdata
blockdata/blockdata.go
Collect
func (t *Collector) Collect() (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collector.Collect() completed in...
go
func (t *Collector) Collect() (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collector.Collect() completed in...
[ "func", "(", "t", "*", "Collector", ")", "Collect", "(", ")", "(", "*", "BlockData", ",", "*", "wire", ".", "MsgBlock", ",", "error", ")", "{", "// In case of a very fast block, make sure previous call to collect is not", "// still running, or dcrd may be mad.", "t", ...
// Collect collects chain data at the current best block.
[ "Collect", "collects", "chain", "data", "at", "the", "current", "best", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L280-L367
19,876
decred/dcrdata
explorer/websocket.go
NewWebsocketHub
func NewWebsocketHub() *WebsocketHub { return &WebsocketHub{ clients: make(map[*hubSpoke]*clientHubSpoke), Register: make(chan *clientHubSpoke), Unregister: make(chan *hubSpoke), HubRelay: make(chan hubMessage), newTxBuffer: make([]*types.MempoolTx, 0, newTxBufferSize), ...
go
func NewWebsocketHub() *WebsocketHub { return &WebsocketHub{ clients: make(map[*hubSpoke]*clientHubSpoke), Register: make(chan *clientHubSpoke), Unregister: make(chan *hubSpoke), HubRelay: make(chan hubMessage), newTxBuffer: make([]*types.MempoolTx, 0, newTxBufferSize), ...
[ "func", "NewWebsocketHub", "(", ")", "*", "WebsocketHub", "{", "return", "&", "WebsocketHub", "{", "clients", ":", "make", "(", "map", "[", "*", "hubSpoke", "]", "*", "clientHubSpoke", ")", ",", "Register", ":", "make", "(", "chan", "*", "clientHubSpoke", ...
// NewWebsocketHub creates a new WebsocketHub
[ "NewWebsocketHub", "creates", "a", "new", "WebsocketHub" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L90-L102
19,877
decred/dcrdata
explorer/websocket.go
NumClients
func (wsh *WebsocketHub) NumClients() int { // Swallow any type assertion error since the default int of 0 is OK. n, _ := wsh.numClients.Load().(int) return n }
go
func (wsh *WebsocketHub) NumClients() int { // Swallow any type assertion error since the default int of 0 is OK. n, _ := wsh.numClients.Load().(int) return n }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "NumClients", "(", ")", "int", "{", "// Swallow any type assertion error since the default int of 0 is OK.", "n", ",", "_", ":=", "wsh", ".", "numClients", ".", "Load", "(", ")", ".", "(", "int", ")", "\n", "return...
// NumClients returns the number of clients connected to the websocket hub.
[ "NumClients", "returns", "the", "number", "of", "clients", "connected", "to", "the", "websocket", "hub", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L111-L115
19,878
decred/dcrdata
explorer/websocket.go
RegisterClient
func (wsh *WebsocketHub) RegisterClient(c *hubSpoke, xcChan exchangeChannel) *client { cl := new(client) wsh.Register <- &clientHubSpoke{cl, c, xcChan} return cl }
go
func (wsh *WebsocketHub) RegisterClient(c *hubSpoke, xcChan exchangeChannel) *client { cl := new(client) wsh.Register <- &clientHubSpoke{cl, c, xcChan} return cl }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "RegisterClient", "(", "c", "*", "hubSpoke", ",", "xcChan", "exchangeChannel", ")", "*", "client", "{", "cl", ":=", "new", "(", "client", ")", "\n", "wsh", ".", "Register", "<-", "&", "clientHubSpoke", "{", ...
// RegisterClient registers a websocket connection with the hub, and returns a // pointer to the new client data object.
[ "RegisterClient", "registers", "a", "websocket", "connection", "with", "the", "hub", "and", "returns", "a", "pointer", "to", "the", "new", "client", "data", "object", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L123-L127
19,879
decred/dcrdata
explorer/websocket.go
pingClients
func (wsh *WebsocketHub) pingClients() chan<- struct{} { stopPing := make(chan struct{}) go func() { // start the client ping ticker ticker := time.NewTicker(pingInterval) defer ticker.Stop() for { select { case <-ticker.C: wsh.HubRelay <- pstypes.HubMessage{Signal: sigPingAndUserCount} case _,...
go
func (wsh *WebsocketHub) pingClients() chan<- struct{} { stopPing := make(chan struct{}) go func() { // start the client ping ticker ticker := time.NewTicker(pingInterval) defer ticker.Stop() for { select { case <-ticker.C: wsh.HubRelay <- pstypes.HubMessage{Signal: sigPingAndUserCount} case _,...
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "pingClients", "(", ")", "chan", "<-", "struct", "{", "}", "{", "stopPing", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "go", "func", "(", ")", "{", "// start the client ping ticker", "ticker"...
// Periodically ping clients over websocket connection. Stop the ping loop by // closing the returned channel.
[ "Periodically", "ping", "clients", "over", "websocket", "connection", ".", "Stop", "the", "ping", "loop", "by", "closing", "the", "returned", "channel", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L171-L193
19,880
decred/dcrdata
explorer/websocket.go
addTxToBuffer
func (wsh *WebsocketHub) addTxToBuffer(tx *types.MempoolTx) bool { wsh.bufferMtx.Lock() defer wsh.bufferMtx.Unlock() wsh.newTxBuffer = append(wsh.newTxBuffer, tx) return len(wsh.newTxBuffer) >= newTxBufferSize }
go
func (wsh *WebsocketHub) addTxToBuffer(tx *types.MempoolTx) bool { wsh.bufferMtx.Lock() defer wsh.bufferMtx.Unlock() wsh.newTxBuffer = append(wsh.newTxBuffer, tx) return len(wsh.newTxBuffer) >= newTxBufferSize }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "addTxToBuffer", "(", "tx", "*", "types", ".", "MempoolTx", ")", "bool", "{", "wsh", ".", "bufferMtx", ".", "Lock", "(", ")", "\n", "defer", "wsh", ".", "bufferMtx", ".", "Unlock", "(", ")", "\n\n", "wsh"...
// addTxToBuffer adds a tx to the buffer, then returns if the buffer is full
[ "addTxToBuffer", "adds", "a", "tx", "to", "the", "buffer", "then", "returns", "if", "the", "buffer", "is", "full" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L358-L365
19,881
decred/dcrdata
explorer/websocket.go
periodicBufferSend
func (wsh *WebsocketHub) periodicBufferSend() { ticker := time.NewTicker(bufferTickerInterval * time.Second) for { select { case <-ticker.C: wsh.sendBufferChan <- bufferSend case sig := <-wsh.bufferTickerChan: switch sig { case tickerSigReset: ticker.Stop() ticker = time.NewTicker(bufferTickerI...
go
func (wsh *WebsocketHub) periodicBufferSend() { ticker := time.NewTicker(bufferTickerInterval * time.Second) for { select { case <-ticker.C: wsh.sendBufferChan <- bufferSend case sig := <-wsh.bufferTickerChan: switch sig { case tickerSigReset: ticker.Stop() ticker = time.NewTicker(bufferTickerI...
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "periodicBufferSend", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "bufferTickerInterval", "*", "time", ".", "Second", ")", "\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C", ...
// periodicBufferSend initiates a buffer send every bufferTickerInterval seconds
[ "periodicBufferSend", "initiates", "a", "buffer", "send", "every", "bufferTickerInterval", "seconds" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L368-L385
19,882
decred/dcrdata
blockdata/chainmonitor.go
NewChainMonitor
func NewChainMonitor(ctx context.Context, collector *Collector, savers []BlockDataSaver, reorgSavers []BlockDataSaver, wg *sync.WaitGroup, addrs map[string]txhelpers.TxAction, recvTxBlockChan chan *txhelpers.BlockWatchedTx, reorgChan chan *txhelpers.ReorgData) *chainMonitor { return &chainMonitor{ ctx: ...
go
func NewChainMonitor(ctx context.Context, collector *Collector, savers []BlockDataSaver, reorgSavers []BlockDataSaver, wg *sync.WaitGroup, addrs map[string]txhelpers.TxAction, recvTxBlockChan chan *txhelpers.BlockWatchedTx, reorgChan chan *txhelpers.ReorgData) *chainMonitor { return &chainMonitor{ ctx: ...
[ "func", "NewChainMonitor", "(", "ctx", "context", ".", "Context", ",", "collector", "*", "Collector", ",", "savers", "[", "]", "BlockDataSaver", ",", "reorgSavers", "[", "]", "BlockDataSaver", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "addrs", "map", ...
// NewChainMonitor creates a new chainMonitor.
[ "NewChainMonitor", "creates", "a", "new", "chainMonitor", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/chainmonitor.go#L34-L47
19,883
decred/dcrdata
db/dcrpg/pgblockchain.go
TicketPoolData
func TicketPoolData(interval dbtypes.TimeBasedGrouping, height int64) (timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutChart *dbtypes.PoolTicketsData, actualHeight int64, intervalFound, isStale bool) { ticketPoolGraphsCache.RLock() defer ticketPoolGraphsCache.RUnlock() var tFound, pFo...
go
func TicketPoolData(interval dbtypes.TimeBasedGrouping, height int64) (timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutChart *dbtypes.PoolTicketsData, actualHeight int64, intervalFound, isStale bool) { ticketPoolGraphsCache.RLock() defer ticketPoolGraphsCache.RUnlock() var tFound, pFo...
[ "func", "TicketPoolData", "(", "interval", "dbtypes", ".", "TimeBasedGrouping", ",", "height", "int64", ")", "(", "timeGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "priceGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "donutChart", "*", "dbtypes", "...
// TicketPoolData is a thread-safe way to access the ticketpool graphs data // stored in the cache.
[ "TicketPoolData", "is", "a", "thread", "-", "safe", "way", "to", "access", "the", "ticketpool", "graphs", "data", "stored", "in", "the", "cache", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L81-L96
19,884
decred/dcrdata
db/dcrpg/pgblockchain.go
UpdateTicketPoolData
func UpdateTicketPoolData(interval dbtypes.TimeBasedGrouping, timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutcharts *dbtypes.PoolTicketsData, height int64) { ticketPoolGraphsCache.Lock() defer ticketPoolGraphsCache.Unlock() ticketPoolGraphsCache.Height[interval] = height ticketPoolG...
go
func UpdateTicketPoolData(interval dbtypes.TimeBasedGrouping, timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutcharts *dbtypes.PoolTicketsData, height int64) { ticketPoolGraphsCache.Lock() defer ticketPoolGraphsCache.Unlock() ticketPoolGraphsCache.Height[interval] = height ticketPoolG...
[ "func", "UpdateTicketPoolData", "(", "interval", "dbtypes", ".", "TimeBasedGrouping", ",", "timeGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "priceGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "donutcharts", "*", "dbtypes", ".", "PoolTicketsData", ","...
// UpdateTicketPoolData updates the ticket pool cache with the latest data fetched. // This is a thread-safe way to update ticket pool cache data. TryLock helps avoid // stacking calls to update the cache.
[ "UpdateTicketPoolData", "updates", "the", "ticket", "pool", "cache", "with", "the", "latest", "data", "fetched", ".", "This", "is", "a", "thread", "-", "safe", "way", "to", "update", "ticket", "pool", "cache", "data", ".", "TryLock", "helps", "avoid", "stack...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L101-L110
19,885
decred/dcrdata
db/dcrpg/pgblockchain.go
newUtxoStore
func newUtxoStore(prealloc int) utxoStore { return utxoStore{ c: make(map[string]map[uint32]*dbtypes.UTXOData, prealloc), } }
go
func newUtxoStore(prealloc int) utxoStore { return utxoStore{ c: make(map[string]map[uint32]*dbtypes.UTXOData, prealloc), } }
[ "func", "newUtxoStore", "(", "prealloc", "int", ")", "utxoStore", "{", "return", "utxoStore", "{", "c", ":", "make", "(", "map", "[", "string", "]", "map", "[", "uint32", "]", "*", "dbtypes", ".", "UTXOData", ",", "prealloc", ")", ",", "}", "\n", "}"...
// newUtxoStore constructs a new utxoStore.
[ "newUtxoStore", "constructs", "a", "new", "utxoStore", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L119-L123
19,886
decred/dcrdata
db/dcrpg/pgblockchain.go
Get
func (u *utxoStore) Get(txHash string, txIndex uint32) (*dbtypes.UTXOData, bool) { u.Lock() defer u.Unlock() utxoData, ok := u.c[txHash][txIndex] if ok { u.c[txHash][txIndex] = nil delete(u.c[txHash], txIndex) if len(u.c[txHash]) == 0 { delete(u.c, txHash) } } return utxoData, ok }
go
func (u *utxoStore) Get(txHash string, txIndex uint32) (*dbtypes.UTXOData, bool) { u.Lock() defer u.Unlock() utxoData, ok := u.c[txHash][txIndex] if ok { u.c[txHash][txIndex] = nil delete(u.c[txHash], txIndex) if len(u.c[txHash]) == 0 { delete(u.c, txHash) } } return utxoData, ok }
[ "func", "(", "u", "*", "utxoStore", ")", "Get", "(", "txHash", "string", ",", "txIndex", "uint32", ")", "(", "*", "dbtypes", ".", "UTXOData", ",", "bool", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", ...
// Get attempts to locate UTXOData for the specified outpoint. If the data is // not in the cache, a nil pointer and false are returned. If the data is // located, the data and true are returned, and the data is evicted from cache.
[ "Get", "attempts", "to", "locate", "UTXOData", "for", "the", "specified", "outpoint", ".", "If", "the", "data", "is", "not", "in", "the", "cache", "a", "nil", "pointer", "and", "false", "are", "returned", ".", "If", "the", "data", "is", "located", "the",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L128-L140
19,887
decred/dcrdata
db/dcrpg/pgblockchain.go
Set
func (u *utxoStore) Set(txHash string, txIndex uint32, addrs []string, val int64) { u.Lock() defer u.Unlock() u.set(txHash, txIndex, addrs, val) }
go
func (u *utxoStore) Set(txHash string, txIndex uint32, addrs []string, val int64) { u.Lock() defer u.Unlock() u.set(txHash, txIndex, addrs, val) }
[ "func", "(", "u", "*", "utxoStore", ")", "Set", "(", "txHash", "string", ",", "txIndex", "uint32", ",", "addrs", "[", "]", "string", ",", "val", "int64", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", "...
// Set stores the addresses and amount in a UTXOData entry in the cache for the // given outpoint.
[ "Set", "stores", "the", "addresses", "and", "amount", "in", "a", "UTXOData", "entry", "in", "the", "cache", "for", "the", "given", "outpoint", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L161-L165
19,888
decred/dcrdata
db/dcrpg/pgblockchain.go
Reinit
func (u *utxoStore) Reinit(utxos []dbtypes.UTXO) { u.Lock() defer u.Unlock() // Pre-allocate the transaction hash map assuming the number of unique // transaction hashes in input is roughly 2/3 of the number of UTXOs. prealloc := 2 * len(utxos) / 3 u.c = make(map[string]map[uint32]*dbtypes.UTXOData, prealloc) fo...
go
func (u *utxoStore) Reinit(utxos []dbtypes.UTXO) { u.Lock() defer u.Unlock() // Pre-allocate the transaction hash map assuming the number of unique // transaction hashes in input is roughly 2/3 of the number of UTXOs. prealloc := 2 * len(utxos) / 3 u.c = make(map[string]map[uint32]*dbtypes.UTXOData, prealloc) fo...
[ "func", "(", "u", "*", "utxoStore", ")", "Reinit", "(", "utxos", "[", "]", "dbtypes", ".", "UTXO", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", "// Pre-allocate the transaction hash map assuming the number of uniqu...
// Reinit re-initializes the utxoStore with the given UTXOs.
[ "Reinit", "re", "-", "initializes", "the", "utxoStore", "with", "the", "given", "UTXOs", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L168-L178
19,889
decred/dcrdata
db/dcrpg/pgblockchain.go
Size
func (u *utxoStore) Size() (sz int) { u.Lock() defer u.Unlock() for _, m := range u.c { sz += len(m) } return }
go
func (u *utxoStore) Size() (sz int) { u.Lock() defer u.Unlock() for _, m := range u.c { sz += len(m) } return }
[ "func", "(", "u", "*", "utxoStore", ")", "Size", "(", ")", "(", "sz", "int", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "m", ":=", "range", "u", ".", "c", "{", "sz", "+=", "le...
// Size returns the size of the utxo cache in number of UTXOs.
[ "Size", "returns", "the", "size", "of", "the", "utxo", "cache", "in", "number", "of", "UTXOs", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L181-L188
19,890
decred/dcrdata
db/dcrpg/pgblockchain.go
NewChainDBRPC
func NewChainDBRPC(chaindb *ChainDB, cl *rpcclient.Client) (*ChainDBRPC, error) { return &ChainDBRPC{chaindb, cl}, nil }
go
func NewChainDBRPC(chaindb *ChainDB, cl *rpcclient.Client) (*ChainDBRPC, error) { return &ChainDBRPC{chaindb, cl}, nil }
[ "func", "NewChainDBRPC", "(", "chaindb", "*", "ChainDB", ",", "cl", "*", "rpcclient", ".", "Client", ")", "(", "*", "ChainDBRPC", ",", "error", ")", "{", "return", "&", "ChainDBRPC", "{", "chaindb", ",", "cl", "}", ",", "nil", "\n", "}" ]
// NewChainDBRPC contains ChainDB and RPC client parameters. By default, // duplicate row checks on insertion are enabled. also enables rpc client
[ "NewChainDBRPC", "contains", "ChainDB", "and", "RPC", "client", "parameters", ".", "By", "default", "duplicate", "row", "checks", "on", "insertion", "are", "enabled", ".", "also", "enables", "rpc", "client" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L288-L290
19,891
decred/dcrdata
db/dcrpg/pgblockchain.go
MissingSideChainBlocks
func (pgb *ChainDBRPC) MissingSideChainBlocks() ([]dbtypes.SideChain, int, error) { // First get the side chain tips (head blocks). tips, err := rpcutils.SideChains(pgb.Client) if err != nil { return nil, 0, fmt.Errorf("unable to get chain tips from node: %v", err) } nSideChains := len(tips) // Build a list of...
go
func (pgb *ChainDBRPC) MissingSideChainBlocks() ([]dbtypes.SideChain, int, error) { // First get the side chain tips (head blocks). tips, err := rpcutils.SideChains(pgb.Client) if err != nil { return nil, 0, fmt.Errorf("unable to get chain tips from node: %v", err) } nSideChains := len(tips) // Build a list of...
[ "func", "(", "pgb", "*", "ChainDBRPC", ")", "MissingSideChainBlocks", "(", ")", "(", "[", "]", "dbtypes", ".", "SideChain", ",", "int", ",", "error", ")", "{", "// First get the side chain tips (head blocks).", "tips", ",", "err", ":=", "rpcutils", ".", "SideC...
// MissingSideChainBlocks identifies side chain blocks that are missing from the // DB. Side chains known to dcrd are listed via the getchaintips RPC. Each block // presence in the postgres DB is checked, and any missing block is returned in // a SideChain along with a count of the total number of missing blocks.
[ "MissingSideChainBlocks", "identifies", "side", "chain", "blocks", "that", "are", "missing", "from", "the", "DB", ".", "Side", "chains", "known", "to", "dcrd", "are", "listed", "via", "the", "getchaintips", "RPC", ".", "Each", "block", "presence", "in", "the",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L337-L389
19,892
decred/dcrdata
db/dcrpg/pgblockchain.go
TxnDbID
func (t *TicketTxnIDGetter) TxnDbID(txid string, expire bool) (uint64, error) { if t == nil { panic("You're using an uninitialized TicketTxnIDGetter") } t.mtx.RLock() dbID, ok := t.idCache[txid] t.mtx.RUnlock() if ok { if expire { t.mtx.Lock() delete(t.idCache, txid) t.mtx.Unlock() } return dbID,...
go
func (t *TicketTxnIDGetter) TxnDbID(txid string, expire bool) (uint64, error) { if t == nil { panic("You're using an uninitialized TicketTxnIDGetter") } t.mtx.RLock() dbID, ok := t.idCache[txid] t.mtx.RUnlock() if ok { if expire { t.mtx.Lock() delete(t.idCache, txid) t.mtx.Unlock() } return dbID,...
[ "func", "(", "t", "*", "TicketTxnIDGetter", ")", "TxnDbID", "(", "txid", "string", ",", "expire", "bool", ")", "(", "uint64", ",", "error", ")", "{", "if", "t", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "t", ".", "mtx", ...
// TxnDbID fetches DB row ID for the ticket specified by the input transaction // hash. A cache is checked first. In the event of a cache hit, the DB ID is // returned and deleted from the internal cache. In the event of a cache miss, // the database is queried. If the database query fails, the error is non-nil.
[ "TxnDbID", "fetches", "DB", "row", "ID", "for", "the", "ticket", "specified", "by", "the", "input", "transaction", "hash", ".", "A", "cache", "is", "checked", "first", ".", "In", "the", "event", "of", "a", "cache", "hit", "the", "DB", "ID", "is", "retu...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L402-L420
19,893
decred/dcrdata
db/dcrpg/pgblockchain.go
NewTicketTxnIDGetter
func NewTicketTxnIDGetter(db *sql.DB) *TicketTxnIDGetter { return &TicketTxnIDGetter{ db: db, idCache: make(map[string]uint64), } }
go
func NewTicketTxnIDGetter(db *sql.DB) *TicketTxnIDGetter { return &TicketTxnIDGetter{ db: db, idCache: make(map[string]uint64), } }
[ "func", "NewTicketTxnIDGetter", "(", "db", "*", "sql", ".", "DB", ")", "*", "TicketTxnIDGetter", "{", "return", "&", "TicketTxnIDGetter", "{", "db", ":", "db", ",", "idCache", ":", "make", "(", "map", "[", "string", "]", "uint64", ")", ",", "}", "\n", ...
// NewTicketTxnIDGetter constructs a new TicketTxnIDGetter with an empty cache.
[ "NewTicketTxnIDGetter", "constructs", "a", "new", "TicketTxnIDGetter", "with", "an", "empty", "cache", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L445-L450
19,894
decred/dcrdata
db/dcrpg/pgblockchain.go
NewChainDB
func NewChainDB(dbi *DBInfo, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase, devPrefetch, hidePGConfig bool, addrCacheCap int, mp rpcutils.MempoolAddressChecker, parser ProposalsFetcher, bg BlockGetter) (*ChainDB, error) { ctx := context.Background() chainDB, err := NewChainDBWithCancel(ctx, dbi, params, s...
go
func NewChainDB(dbi *DBInfo, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase, devPrefetch, hidePGConfig bool, addrCacheCap int, mp rpcutils.MempoolAddressChecker, parser ProposalsFetcher, bg BlockGetter) (*ChainDB, error) { ctx := context.Background() chainDB, err := NewChainDBWithCancel(ctx, dbi, params, s...
[ "func", "NewChainDB", "(", "dbi", "*", "DBInfo", ",", "params", "*", "chaincfg", ".", "Params", ",", "stakeDB", "*", "stakedb", ".", "StakeDatabase", ",", "devPrefetch", ",", "hidePGConfig", "bool", ",", "addrCacheCap", "int", ",", "mp", "rpcutils", ".", "...
// NewChainDB constructs a ChainDB for the given connection and Decred network // parameters. By default, duplicate row checks on insertion are enabled. See // NewChainDBWithCancel to enable context cancellation of running queries. // proposalsUpdateChan is used to manage politeia update notifications trigger // betwee...
[ "NewChainDB", "constructs", "a", "ChainDB", "for", "the", "given", "connection", "and", "Decred", "network", "parameters", ".", "By", "default", "duplicate", "row", "checks", "on", "insertion", "are", "enabled", ".", "See", "NewChainDBWithCancel", "to", "enable", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L464-L475
19,895
decred/dcrdata
db/dcrpg/pgblockchain.go
InitUtxoCache
func (pgb *ChainDB) InitUtxoCache(utxos []dbtypes.UTXO) { pgb.utxoCache.Reinit(utxos) }
go
func (pgb *ChainDB) InitUtxoCache(utxos []dbtypes.UTXO) { pgb.utxoCache.Reinit(utxos) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "InitUtxoCache", "(", "utxos", "[", "]", "dbtypes", ".", "UTXO", ")", "{", "pgb", ".", "utxoCache", ".", "Reinit", "(", "utxos", ")", "\n", "}" ]
// InitUtxoCache resets the UTXO cache with the given slice of UTXO data.
[ "InitUtxoCache", "resets", "the", "UTXO", "cache", "with", "the", "given", "slice", "of", "UTXO", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L790-L792
19,896
decred/dcrdata
db/dcrpg/pgblockchain.go
SideChainBlocks
func (pgb *ChainDB) SideChainBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() scb, err := RetrieveSideChainBlocks(ctx, pgb.db) return scb, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) SideChainBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() scb, err := RetrieveSideChainBlocks(ctx, pgb.db) return scb, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "SideChainBlocks", "(", ")", "(", "[", "]", "*", "dbtypes", ".", "BlockStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "qu...
// SideChainBlocks retrieves all known side chain blocks.
[ "SideChainBlocks", "retrieves", "all", "known", "side", "chain", "blocks", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L874-L879
19,897
decred/dcrdata
db/dcrpg/pgblockchain.go
DisapprovedBlocks
func (pgb *ChainDB) DisapprovedBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() disb, err := RetrieveDisapprovedBlocks(ctx, pgb.db) return disb, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) DisapprovedBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() disb, err := RetrieveDisapprovedBlocks(ctx, pgb.db) return disb, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "DisapprovedBlocks", "(", ")", "(", "[", "]", "*", "dbtypes", ".", "BlockStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "...
// DisapprovedBlocks retrieves all blocks disapproved by stakeholder votes.
[ "DisapprovedBlocks", "retrieves", "all", "blocks", "disapproved", "by", "stakeholder", "votes", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L890-L895
19,898
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockStatus
func (pgb *ChainDB) BlockStatus(hash string) (dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bs, err := RetrieveBlockStatus(ctx, pgb.db, hash) return bs, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) BlockStatus(hash string) (dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bs, err := RetrieveBlockStatus(ctx, pgb.db, hash) return bs, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockStatus", "(", "hash", "string", ")", "(", "dbtypes", ".", "BlockStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "query...
// BlockStatus retrieves the block chain status of the specified block.
[ "BlockStatus", "retrieves", "the", "block", "chain", "status", "of", "the", "specified", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L898-L903
19,899
decred/dcrdata
db/dcrpg/pgblockchain.go
blockFlags
func (pgb *ChainDB) blockFlags(ctx context.Context, hash string) (bool, bool, error) { iv, im, err := RetrieveBlockFlags(ctx, pgb.db, hash) return iv, im, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) blockFlags(ctx context.Context, hash string) (bool, bool, error) { iv, im, err := RetrieveBlockFlags(ctx, pgb.db, hash) return iv, im, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "blockFlags", "(", "ctx", "context", ".", "Context", ",", "hash", "string", ")", "(", "bool", ",", "bool", ",", "error", ")", "{", "iv", ",", "im", ",", "err", ":=", "RetrieveBlockFlags", "(", "ctx", ",", "p...
// blockFlags retrieves the block's isValid and isMainchain flags.
[ "blockFlags", "retrieves", "the", "block", "s", "isValid", "and", "isMainchain", "flags", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L906-L909