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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
141,900 | 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 |
141,901 | 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 |
141,902 | 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 |
141,903 | 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 |
141,904 | 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 |
141,905 | 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 |
141,906 | 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 |
141,907 | 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 |
141,908 | 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 |
141,909 | 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 |
141,910 | 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 |
141,911 | 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 |
141,912 | 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 |
141,913 | 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 |
141,914 | 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 |
141,915 | 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 |
141,916 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockFlags | func (pgb *ChainDB) BlockFlags(hash string) (bool, bool, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
return pgb.blockFlags(ctx, hash)
} | go | func (pgb *ChainDB) BlockFlags(hash string) (bool, bool, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
return pgb.blockFlags(ctx, hash)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockFlags",
"(",
"hash",
"string",
")",
"(",
"bool",
",",
"bool",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
... | // 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#L912-L916 |
141,917 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockFlagsNoCancel | func (pgb *ChainDB) BlockFlagsNoCancel(hash string) (bool, bool, error) {
return pgb.blockFlags(context.Background(), hash)
} | go | func (pgb *ChainDB) BlockFlagsNoCancel(hash string) (bool, bool, error) {
return pgb.blockFlags(context.Background(), hash)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockFlagsNoCancel",
"(",
"hash",
"string",
")",
"(",
"bool",
",",
"bool",
",",
"error",
")",
"{",
"return",
"pgb",
".",
"blockFlags",
"(",
"context",
".",
"Background",
"(",
")",
",",
"hash",
")",
"\n",
"}"
... | // BlockFlagsNoCancel retrieves the block's isValid and isMainchain flags. | [
"BlockFlagsNoCancel",
"retrieves",
"the",
"block",
"s",
"isValid",
"and",
"isMainchain",
"flags",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L919-L921 |
141,918 | decred/dcrdata | db/dcrpg/pgblockchain.go | blockChainDbID | func (pgb *ChainDB) blockChainDbID(ctx context.Context, hash string) (dbID uint64, err error) {
err = pgb.db.QueryRowContext(ctx, internal.SelectBlockChainRowIDByHash, hash).Scan(&dbID)
err = pgb.replaceCancelError(err)
return
} | go | func (pgb *ChainDB) blockChainDbID(ctx context.Context, hash string) (dbID uint64, err error) {
err = pgb.db.QueryRowContext(ctx, internal.SelectBlockChainRowIDByHash, hash).Scan(&dbID)
err = pgb.replaceCancelError(err)
return
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"blockChainDbID",
"(",
"ctx",
"context",
".",
"Context",
",",
"hash",
"string",
")",
"(",
"dbID",
"uint64",
",",
"err",
"error",
")",
"{",
"err",
"=",
"pgb",
".",
"db",
".",
"QueryRowContext",
"(",
"ctx",
",",... | // blockChainDbID gets the row ID of the given block hash in the block_chain
// table. The cancellation context is used without timeout. | [
"blockChainDbID",
"gets",
"the",
"row",
"ID",
"of",
"the",
"given",
"block",
"hash",
"in",
"the",
"block_chain",
"table",
".",
"The",
"cancellation",
"context",
"is",
"used",
"without",
"timeout",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L925-L929 |
141,919 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockChainDbID | func (pgb *ChainDB) BlockChainDbID(hash string) (dbID uint64, err error) {
return pgb.blockChainDbID(pgb.ctx, hash)
} | go | func (pgb *ChainDB) BlockChainDbID(hash string) (dbID uint64, err error) {
return pgb.blockChainDbID(pgb.ctx, hash)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockChainDbID",
"(",
"hash",
"string",
")",
"(",
"dbID",
"uint64",
",",
"err",
"error",
")",
"{",
"return",
"pgb",
".",
"blockChainDbID",
"(",
"pgb",
".",
"ctx",
",",
"hash",
")",
"\n",
"}"
] | // BlockChainDbID gets the row ID of the given block hash in the block_chain
// table. The cancellation context is used without timeout. | [
"BlockChainDbID",
"gets",
"the",
"row",
"ID",
"of",
"the",
"given",
"block",
"hash",
"in",
"the",
"block_chain",
"table",
".",
"The",
"cancellation",
"context",
"is",
"used",
"without",
"timeout",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L933-L935 |
141,920 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockChainDbIDNoCancel | func (pgb *ChainDB) BlockChainDbIDNoCancel(hash string) (dbID uint64, err error) {
return pgb.blockChainDbID(context.Background(), hash)
} | go | func (pgb *ChainDB) BlockChainDbIDNoCancel(hash string) (dbID uint64, err error) {
return pgb.blockChainDbID(context.Background(), hash)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockChainDbIDNoCancel",
"(",
"hash",
"string",
")",
"(",
"dbID",
"uint64",
",",
"err",
"error",
")",
"{",
"return",
"pgb",
".",
"blockChainDbID",
"(",
"context",
".",
"Background",
"(",
")",
",",
"hash",
")",
... | // BlockChainDbIDNoCancel gets the row ID of the given block hash in the
// block_chain table. The cancellation context is used without timeout. | [
"BlockChainDbIDNoCancel",
"gets",
"the",
"row",
"ID",
"of",
"the",
"given",
"block",
"hash",
"in",
"the",
"block_chain",
"table",
".",
"The",
"cancellation",
"context",
"is",
"used",
"without",
"timeout",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L939-L941 |
141,921 | decred/dcrdata | db/dcrpg/pgblockchain.go | TransactionBlocks | func (pgb *ChainDB) TransactionBlocks(txHash string) ([]*dbtypes.BlockStatus, []uint32, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
hashes, heights, inds, valids, mainchains, err := RetrieveTxnsBlocks(ctx, pgb.db, txHash)
if err != nil {
return nil, nil, pgb.replaceCancel... | go | func (pgb *ChainDB) TransactionBlocks(txHash string) ([]*dbtypes.BlockStatus, []uint32, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
hashes, heights, inds, valids, mainchains, err := RetrieveTxnsBlocks(ctx, pgb.db, txHash)
if err != nil {
return nil, nil, pgb.replaceCancel... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TransactionBlocks",
"(",
"txHash",
"string",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"BlockStatus",
",",
"[",
"]",
"uint32",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
... | // TransactionBlocks retrieves the blocks in which the specified transaction
// appears, along with the index of the transaction in each of the blocks. The
// next and previous block hashes are NOT SET in each BlockStatus. | [
"TransactionBlocks",
"retrieves",
"the",
"blocks",
"in",
"which",
"the",
"specified",
"transaction",
"appears",
"along",
"with",
"the",
"index",
"of",
"the",
"transaction",
"in",
"each",
"of",
"the",
"blocks",
".",
"The",
"next",
"and",
"previous",
"block",
"h... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L968-L989 |
141,922 | decred/dcrdata | db/dcrpg/pgblockchain.go | HeightDB | func (pgb *ChainDB) HeightDB() (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
bestHeight, _, _, err := RetrieveBestBlockHeight(ctx, pgb.db)
height := int64(bestHeight)
if err == sql.ErrNoRows {
height = -1
}
// DO NOT change this to return -1 if err == sql.ErrNoRo... | go | func (pgb *ChainDB) HeightDB() (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
bestHeight, _, _, err := RetrieveBestBlockHeight(ctx, pgb.db)
height := int64(bestHeight)
if err == sql.ErrNoRows {
height = -1
}
// DO NOT change this to return -1 if err == sql.ErrNoRo... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"HeightDB",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
"\n",
"defer",
"cancel",
"... | // HeightDB queries the DB for the best block height. When the tables are empty,
// the returned height will be -1. | [
"HeightDB",
"queries",
"the",
"DB",
"for",
"the",
"best",
"block",
"height",
".",
"When",
"the",
"tables",
"are",
"empty",
"the",
"returned",
"height",
"will",
"be",
"-",
"1",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L993-L1003 |
141,923 | decred/dcrdata | db/dcrpg/pgblockchain.go | HashDB | func (pgb *ChainDB) HashDB() (string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, bestHash, _, err := RetrieveBestBlockHeight(ctx, pgb.db)
return bestHash, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) HashDB() (string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, bestHash, _, err := RetrieveBestBlockHeight(ctx, pgb.db)
return bestHash, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"HashDB",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
"\n",
"defer",
"cancel",
"(... | // HashDB queries the DB for the best block's hash. | [
"HashDB",
"queries",
"the",
"DB",
"for",
"the",
"best",
"block",
"s",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1006-L1011 |
141,924 | decred/dcrdata | db/dcrpg/pgblockchain.go | HeightHashDB | func (pgb *ChainDB) HeightHashDB() (uint64, string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
height, hash, _, err := RetrieveBestBlockHeight(ctx, pgb.db)
return height, hash, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) HeightHashDB() (uint64, string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
height, hash, _, err := RetrieveBestBlockHeight(ctx, pgb.db)
return height, hash, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"HeightHashDB",
"(",
")",
"(",
"uint64",
",",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
"\n",
... | // HeightHashDB queries the DB for the best block's height and hash. | [
"HeightHashDB",
"queries",
"the",
"DB",
"for",
"the",
"best",
"block",
"s",
"height",
"and",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1014-L1019 |
141,925 | decred/dcrdata | db/dcrpg/pgblockchain.go | Height | func (block *BestBlock) Height() int64 {
block.mtx.RLock()
defer block.mtx.RUnlock()
return block.height
} | go | func (block *BestBlock) Height() int64 {
block.mtx.RLock()
defer block.mtx.RUnlock()
return block.height
} | [
"func",
"(",
"block",
"*",
"BestBlock",
")",
"Height",
"(",
")",
"int64",
"{",
"block",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"block",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"block",
".",
"height",
"\n",
"}"
] | // Height uses the last stored height. | [
"Height",
"uses",
"the",
"last",
"stored",
"height",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1027-L1031 |
141,926 | decred/dcrdata | db/dcrpg/pgblockchain.go | HashStr | func (block *BestBlock) HashStr() string {
block.mtx.RLock()
defer block.mtx.RUnlock()
return block.hash
} | go | func (block *BestBlock) HashStr() string {
block.mtx.RLock()
defer block.mtx.RUnlock()
return block.hash
} | [
"func",
"(",
"block",
"*",
"BestBlock",
")",
"HashStr",
"(",
")",
"string",
"{",
"block",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"block",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"block",
".",
"hash",
"\n",
"}"
] | // HashStr uses the last stored block hash. | [
"HashStr",
"uses",
"the",
"last",
"stored",
"block",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1040-L1044 |
141,927 | decred/dcrdata | db/dcrpg/pgblockchain.go | Hash | func (block *BestBlock) Hash() *chainhash.Hash {
// Caller should check hash instead of error
hash, _ := chainhash.NewHashFromStr(block.HashStr())
return hash
} | go | func (block *BestBlock) Hash() *chainhash.Hash {
// Caller should check hash instead of error
hash, _ := chainhash.NewHashFromStr(block.HashStr())
return hash
} | [
"func",
"(",
"block",
"*",
"BestBlock",
")",
"Hash",
"(",
")",
"*",
"chainhash",
".",
"Hash",
"{",
"// Caller should check hash instead of error",
"hash",
",",
"_",
":=",
"chainhash",
".",
"NewHashFromStr",
"(",
"block",
".",
"HashStr",
"(",
")",
")",
"\n",
... | // Hash uses the last stored block hash. | [
"Hash",
"uses",
"the",
"last",
"stored",
"block",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1047-L1051 |
141,928 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockHeight | func (pgb *ChainDB) BlockHeight(hash string) (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
height, err := RetrieveBlockHeight(ctx, pgb.db, hash)
return height, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) BlockHeight(hash string) (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
height, err := RetrieveBlockHeight(ctx, pgb.db, hash)
return height, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockHeight",
"(",
"hash",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
"\n",
... | // BlockHeight queries the DB for the height of the specified hash. | [
"BlockHeight",
"queries",
"the",
"DB",
"for",
"the",
"height",
"of",
"the",
"specified",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1077-L1082 |
141,929 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockHash | func (pgb *ChainDB) BlockHash(height int64) (string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
hash, err := RetrieveBlockHash(ctx, pgb.db, height)
return hash, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) BlockHash(height int64) (string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
hash, err := RetrieveBlockHash(ctx, pgb.db, height)
return hash, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockHash",
"(",
"height",
"int64",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
"\n",
... | // BlockHash queries the DB for the hash of the mainchain block at the given
// height. | [
"BlockHash",
"queries",
"the",
"DB",
"for",
"the",
"hash",
"of",
"the",
"mainchain",
"block",
"at",
"the",
"given",
"height",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1086-L1091 |
141,930 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockTimeByHeight | func (pgb *ChainDB) BlockTimeByHeight(height int64) (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
time, err := RetrieveBlockTimeByHeight(ctx, pgb.db, height)
return time.UNIX(), pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) BlockTimeByHeight(height int64) (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
time, err := RetrieveBlockTimeByHeight(ctx, pgb.db, height)
return time.UNIX(), pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockTimeByHeight",
"(",
"height",
"int64",
")",
"(",
"int64",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
... | // BlockTimeByHeight queries the DB for the time of the mainchain block at the
// given height. | [
"BlockTimeByHeight",
"queries",
"the",
"DB",
"for",
"the",
"time",
"of",
"the",
"mainchain",
"block",
"at",
"the",
"given",
"height",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1095-L1100 |
141,931 | decred/dcrdata | db/dcrpg/pgblockchain.go | VotesInBlock | func (pgb *ChainDB) VotesInBlock(hash string) (int16, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
voters, err := RetrieveBlockVoteCount(ctx, pgb.db, hash)
if err != nil {
err = pgb.replaceCancelError(err)
log.Errorf("Unable to get block voter count for hash %s: %v", has... | go | func (pgb *ChainDB) VotesInBlock(hash string) (int16, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
voters, err := RetrieveBlockVoteCount(ctx, pgb.db, hash)
if err != nil {
err = pgb.replaceCancelError(err)
log.Errorf("Unable to get block voter count for hash %s: %v", has... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"VotesInBlock",
"(",
"hash",
"string",
")",
"(",
"int16",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
")",
"\n",
... | // VotesInBlock returns the number of votes mined in the block with the
// specified hash. | [
"VotesInBlock",
"returns",
"the",
"number",
"of",
"votes",
"mined",
"in",
"the",
"block",
"with",
"the",
"specified",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1104-L1114 |
141,932 | decred/dcrdata | db/dcrpg/pgblockchain.go | proposalsUpdateHandler | func (pgb *ChainDB) proposalsUpdateHandler() {
// Do not initiate the async update if invalid piparser instance was found.
if pgb.piparser == nil {
log.Debug("invalid piparser instance was found: async update stopped")
return
}
go func() {
for range pgb.piparser.UpdateSignal() {
count, err := pgb.PiPropos... | go | func (pgb *ChainDB) proposalsUpdateHandler() {
// Do not initiate the async update if invalid piparser instance was found.
if pgb.piparser == nil {
log.Debug("invalid piparser instance was found: async update stopped")
return
}
go func() {
for range pgb.piparser.UpdateSignal() {
count, err := pgb.PiPropos... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"proposalsUpdateHandler",
"(",
")",
"{",
"// Do not initiate the async update if invalid piparser instance was found.",
"if",
"pgb",
".",
"piparser",
"==",
"nil",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"retur... | // proposalsUpdateHandler runs in the background asynchronous to retrieve the
// politeia proposal updates that the piparser tool signaled. | [
"proposalsUpdateHandler",
"runs",
"in",
"the",
"background",
"asynchronous",
"to",
"retrieve",
"the",
"politeia",
"proposal",
"updates",
"that",
"the",
"piparser",
"tool",
"signaled",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1118-L1135 |
141,933 | decred/dcrdata | db/dcrpg/pgblockchain.go | LastPiParserSync | func (pgb *ChainDB) LastPiParserSync() time.Time {
pgb.proposalsSync.mtx.RLock()
defer pgb.proposalsSync.mtx.RUnlock()
return pgb.proposalsSync.syncTime
} | go | func (pgb *ChainDB) LastPiParserSync() time.Time {
pgb.proposalsSync.mtx.RLock()
defer pgb.proposalsSync.mtx.RUnlock()
return pgb.proposalsSync.syncTime
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"LastPiParserSync",
"(",
")",
"time",
".",
"Time",
"{",
"pgb",
".",
"proposalsSync",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"pgb",
".",
"proposalsSync",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
... | // LastPiParserSync returns last time value when the piparser run sync on proposals
// and proposal_votes table. | [
"LastPiParserSync",
"returns",
"last",
"time",
"value",
"when",
"the",
"piparser",
"run",
"sync",
"on",
"proposals",
"and",
"proposal_votes",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1139-L1143 |
141,934 | decred/dcrdata | db/dcrpg/pgblockchain.go | PiProposalsHistory | func (pgb *ChainDB) PiProposalsHistory() (int64, error) {
if pgb.piparser == nil {
return -1, fmt.Errorf("invalid piparser instance was found")
}
pgb.proposalsSync.mtx.Lock()
// set the sync time
pgb.proposalsSync.syncTime = time.Now().UTC()
pgb.proposalsSync.mtx.Unlock()
var isChecked bool
var proposalsD... | go | func (pgb *ChainDB) PiProposalsHistory() (int64, error) {
if pgb.piparser == nil {
return -1, fmt.Errorf("invalid piparser instance was found")
}
pgb.proposalsSync.mtx.Lock()
// set the sync time
pgb.proposalsSync.syncTime = time.Now().UTC()
pgb.proposalsSync.mtx.Unlock()
var isChecked bool
var proposalsD... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"PiProposalsHistory",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"pgb",
".",
"piparser",
"==",
"nil",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",... | // PiProposalsHistory queries the politeia's proposal updates via the parser tool
// and pushes them to the proposals and proposal_votes tables. | [
"PiProposalsHistory",
"queries",
"the",
"politeia",
"s",
"proposal",
"updates",
"via",
"the",
"parser",
"tool",
"and",
"pushes",
"them",
"to",
"the",
"proposals",
"and",
"proposal_votes",
"tables",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1147-L1214 |
141,935 | decred/dcrdata | db/dcrpg/pgblockchain.go | ProposalVotes | func (pgb *ChainDB) ProposalVotes(proposalToken string) (*dbtypes.ProposalChartsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chartsData, err := retrieveProposalVotesData(ctx, pgb.db, proposalToken)
return chartsData, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) ProposalVotes(proposalToken string) (*dbtypes.ProposalChartsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chartsData, err := retrieveProposalVotesData(ctx, pgb.db, proposalToken)
return chartsData, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"ProposalVotes",
"(",
"proposalToken",
"string",
")",
"(",
"*",
"dbtypes",
".",
"ProposalChartsData",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",... | // ProposalVotes retrieves all the votes data associated with the provided token. | [
"ProposalVotes",
"retrieves",
"all",
"the",
"votes",
"data",
"associated",
"with",
"the",
"provided",
"token",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1217-L1222 |
141,936 | decred/dcrdata | db/dcrpg/pgblockchain.go | SpendingTransactions | func (pgb *ChainDB) SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, spendingTxns, vinInds, voutInds, err := RetrieveSpendingTxsByFundingTx(ctx, pgb.db, fundingTxID)
return spendingTxns, vinInds, voutInds... | go | func (pgb *ChainDB) SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, spendingTxns, vinInds, voutInds, err := RetrieveSpendingTxsByFundingTx(ctx, pgb.db, fundingTxID)
return spendingTxns, vinInds, voutInds... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"SpendingTransactions",
"(",
"fundingTxID",
"string",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"uint32",
",",
"[",
"]",
"uint32",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTi... | // SpendingTransactions retrieves all transactions spending outpoints from the
// specified funding transaction. The spending transaction hashes, the spending
// tx input indexes, and the corresponding funding tx output indexes, and an
// error value are returned. | [
"SpendingTransactions",
"retrieves",
"all",
"transactions",
"spending",
"outpoints",
"from",
"the",
"specified",
"funding",
"transaction",
".",
"The",
"spending",
"transaction",
"hashes",
"the",
"spending",
"tx",
"input",
"indexes",
"and",
"the",
"corresponding",
"fun... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1228-L1233 |
141,937 | decred/dcrdata | db/dcrpg/pgblockchain.go | SpendingTransaction | func (pgb *ChainDB) SpendingTransaction(fundingTxID string,
fundingTxVout uint32) (string, uint32, int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, spendingTx, vinInd, tree, err := RetrieveSpendingTxByTxOut(ctx, pgb.db, fundingTxID, fundingTxVout)
return spendingTx, vi... | go | func (pgb *ChainDB) SpendingTransaction(fundingTxID string,
fundingTxVout uint32) (string, uint32, int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, spendingTx, vinInd, tree, err := RetrieveSpendingTxByTxOut(ctx, pgb.db, fundingTxID, fundingTxVout)
return spendingTx, vi... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"SpendingTransaction",
"(",
"fundingTxID",
"string",
",",
"fundingTxVout",
"uint32",
")",
"(",
"string",
",",
"uint32",
",",
"int8",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",... | // SpendingTransaction returns the transaction that spends the specified
// transaction outpoint, if it is spent. The spending transaction hash, input
// index, tx tree, and an error value are returned. | [
"SpendingTransaction",
"returns",
"the",
"transaction",
"that",
"spends",
"the",
"specified",
"transaction",
"outpoint",
"if",
"it",
"is",
"spent",
".",
"The",
"spending",
"transaction",
"hash",
"input",
"index",
"tx",
"tree",
"and",
"an",
"error",
"value",
"are... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1238-L1244 |
141,938 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockTransactions | func (pgb *ChainDB) BlockTransactions(blockHash string) ([]string, []uint32, []int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, blockTransactions, blockInds, trees, _, err := RetrieveTxsByBlockHash(ctx, pgb.db, blockHash)
return blockTransactions, blockInds, trees, pgb.... | go | func (pgb *ChainDB) BlockTransactions(blockHash string) ([]string, []uint32, []int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, blockTransactions, blockInds, trees, _, err := RetrieveTxsByBlockHash(ctx, pgb.db, blockHash)
return blockTransactions, blockInds, trees, pgb.... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockTransactions",
"(",
"blockHash",
"string",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"uint32",
",",
"[",
"]",
"int8",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",... | // BlockTransactions retrieves all transactions in the specified block, their
// indexes in the block, their tree, and an error value. | [
"BlockTransactions",
"retrieves",
"all",
"transactions",
"in",
"the",
"specified",
"block",
"their",
"indexes",
"in",
"the",
"block",
"their",
"tree",
"and",
"an",
"error",
"value",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1248-L1253 |
141,939 | decred/dcrdata | db/dcrpg/pgblockchain.go | Transaction | func (pgb *ChainDB) Transaction(txHash string) ([]*dbtypes.Tx, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, dbTxs, err := RetrieveDbTxsByHash(ctx, pgb.db, txHash)
return dbTxs, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) Transaction(txHash string) ([]*dbtypes.Tx, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, dbTxs, err := RetrieveDbTxsByHash(ctx, pgb.db, txHash)
return dbTxs, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"Transaction",
"(",
"txHash",
"string",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"Tx",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
... | // Transaction retrieves all rows from the transactions table for the given
// transaction hash. | [
"Transaction",
"retrieves",
"all",
"rows",
"from",
"the",
"transactions",
"table",
"for",
"the",
"given",
"transaction",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1257-L1262 |
141,940 | decred/dcrdata | db/dcrpg/pgblockchain.go | BlockMissedVotes | func (pgb *ChainDB) BlockMissedVotes(blockHash string) ([]string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
mv, err := RetrieveMissedVotesInBlock(ctx, pgb.db, blockHash)
return mv, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) BlockMissedVotes(blockHash string) ([]string, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
mv, err := RetrieveMissedVotesInBlock(ctx, pgb.db, blockHash)
return mv, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"BlockMissedVotes",
"(",
"blockHash",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryT... | // BlockMissedVotes retrieves the ticket IDs for all missed votes in the
// specified block, and an error value. | [
"BlockMissedVotes",
"retrieves",
"the",
"ticket",
"IDs",
"for",
"all",
"missed",
"votes",
"in",
"the",
"specified",
"block",
"and",
"an",
"error",
"value",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1266-L1271 |
141,941 | decred/dcrdata | db/dcrpg/pgblockchain.go | PoolStatusForTicket | func (pgb *ChainDB) PoolStatusForTicket(txid string) (dbtypes.TicketSpendType, dbtypes.TicketPoolStatus, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, spendType, poolStatus, err := RetrieveTicketStatusByHash(ctx, pgb.db, txid)
return spendType, poolStatus, pgb.replaceCance... | go | func (pgb *ChainDB) PoolStatusForTicket(txid string) (dbtypes.TicketSpendType, dbtypes.TicketPoolStatus, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, spendType, poolStatus, err := RetrieveTicketStatusByHash(ctx, pgb.db, txid)
return spendType, poolStatus, pgb.replaceCance... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"PoolStatusForTicket",
"(",
"txid",
"string",
")",
"(",
"dbtypes",
".",
"TicketSpendType",
",",
"dbtypes",
".",
"TicketPoolStatus",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
... | // PoolStatusForTicket retrieves the specified ticket's spend status and ticket
// pool status, and an error value. | [
"PoolStatusForTicket",
"retrieves",
"the",
"specified",
"ticket",
"s",
"spend",
"status",
"and",
"ticket",
"pool",
"status",
"and",
"an",
"error",
"value",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1296-L1301 |
141,942 | decred/dcrdata | db/dcrpg/pgblockchain.go | VoutValue | func (pgb *ChainDB) VoutValue(txID string, vout uint32) (uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
voutValue, err := RetrieveVoutValue(ctx, pgb.db, txID, vout)
if err != nil {
return 0, pgb.replaceCancelError(err)
}
return voutValue, nil
} | go | func (pgb *ChainDB) VoutValue(txID string, vout uint32) (uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
voutValue, err := RetrieveVoutValue(ctx, pgb.db, txID, vout)
if err != nil {
return 0, pgb.replaceCancelError(err)
}
return voutValue, nil
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"VoutValue",
"(",
"txID",
"string",
",",
"vout",
"uint32",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"que... | // VoutValue retrieves the value of the specified transaction outpoint in atoms. | [
"VoutValue",
"retrieves",
"the",
"value",
"of",
"the",
"specified",
"transaction",
"outpoint",
"in",
"atoms",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1304-L1312 |
141,943 | decred/dcrdata | db/dcrpg/pgblockchain.go | VoutValues | func (pgb *ChainDB) VoutValues(txID string) ([]uint64, []uint32, []int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
voutValues, txInds, txTrees, err := RetrieveVoutValues(ctx, pgb.db, txID)
if err != nil {
return nil, nil, nil, pgb.replaceCancelError(err)
}
return vout... | go | func (pgb *ChainDB) VoutValues(txID string) ([]uint64, []uint32, []int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
voutValues, txInds, txTrees, err := RetrieveVoutValues(ctx, pgb.db, txID)
if err != nil {
return nil, nil, nil, pgb.replaceCancelError(err)
}
return vout... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"VoutValues",
"(",
"txID",
"string",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"uint32",
",",
"[",
"]",
"int8",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"p... | // VoutValues retrieves the values of each outpoint of the specified
// transaction. The corresponding indexes in the block and tx trees of the
// outpoints, and an error value are also returned. | [
"VoutValues",
"retrieves",
"the",
"values",
"of",
"each",
"outpoint",
"of",
"the",
"specified",
"transaction",
".",
"The",
"corresponding",
"indexes",
"in",
"the",
"block",
"and",
"tx",
"trees",
"of",
"the",
"outpoints",
"and",
"an",
"error",
"value",
"are",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1317-L1325 |
141,944 | decred/dcrdata | db/dcrpg/pgblockchain.go | TransactionBlock | func (pgb *ChainDB) TransactionBlock(txID string) (string, uint32, int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, blockHash, blockInd, tree, err := RetrieveTxByHash(ctx, pgb.db, txID)
return blockHash, blockInd, tree, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) TransactionBlock(txID string) (string, uint32, int8, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, blockHash, blockInd, tree, err := RetrieveTxByHash(ctx, pgb.db, txID)
return blockHash, blockInd, tree, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TransactionBlock",
"(",
"txID",
"string",
")",
"(",
"string",
",",
"uint32",
",",
"int8",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",... | // TransactionBlock retrieves the hash of the block containing the specified
// transaction. The index of the transaction within the block, the transaction
// index, and an error value are also returned. | [
"TransactionBlock",
"retrieves",
"the",
"hash",
"of",
"the",
"block",
"containing",
"the",
"specified",
"transaction",
".",
"The",
"index",
"of",
"the",
"transaction",
"within",
"the",
"block",
"the",
"transaction",
"index",
"and",
"an",
"error",
"value",
"are",... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1330-L1335 |
141,945 | decred/dcrdata | db/dcrpg/pgblockchain.go | AgendaVotes | func (pgb *ChainDB) AgendaVotes(agendaID string, chartType int) (*dbtypes.AgendaVoteChoices, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chainInfo := pgb.ChainInfo()
agendaInfo := chainInfo.AgendaMileStones[agendaID]
// check if starttime is in the future exit.
if time.... | go | func (pgb *ChainDB) AgendaVotes(agendaID string, chartType int) (*dbtypes.AgendaVoteChoices, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chainInfo := pgb.ChainInfo()
agendaInfo := chainInfo.AgendaMileStones[agendaID]
// check if starttime is in the future exit.
if time.... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AgendaVotes",
"(",
"agendaID",
"string",
",",
"chartType",
"int",
")",
"(",
"*",
"dbtypes",
".",
"AgendaVoteChoices",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",... | // AgendaVotes fetches the data used to plot a graph of votes cast per day per
// choice for the provided agenda. | [
"AgendaVotes",
"fetches",
"the",
"data",
"used",
"to",
"plot",
"a",
"graph",
"of",
"votes",
"cast",
"per",
"day",
"per",
"choice",
"for",
"the",
"provided",
"agenda",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1339-L1354 |
141,946 | decred/dcrdata | db/dcrpg/pgblockchain.go | AgendasVotesSummary | func (pgb *ChainDB) AgendasVotesSummary(agendaID string) (summary *dbtypes.AgendaSummary, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chainInfo := pgb.ChainInfo()
agendaInfo := chainInfo.AgendaMileStones[agendaID]
// Check if starttime is in the future and exit if tr... | go | func (pgb *ChainDB) AgendasVotesSummary(agendaID string) (summary *dbtypes.AgendaSummary, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chainInfo := pgb.ChainInfo()
agendaInfo := chainInfo.AgendaMileStones[agendaID]
// Check if starttime is in the future and exit if tr... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AgendasVotesSummary",
"(",
"agendaID",
"string",
")",
"(",
"summary",
"*",
"dbtypes",
".",
"AgendaSummary",
",",
"err",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".... | // AgendasVotesSummary fetches the total vote choices count for the provided agenda. | [
"AgendasVotesSummary",
"fetches",
"the",
"total",
"vote",
"choices",
"count",
"for",
"the",
"provided",
"agenda",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1357-L1377 |
141,947 | decred/dcrdata | db/dcrpg/pgblockchain.go | AgendaVoteCounts | func (pgb *ChainDB) AgendaVoteCounts(agendaID string) (yes, abstain, no uint32, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chainInfo := pgb.ChainInfo()
agendaInfo := chainInfo.AgendaMileStones[agendaID]
// Check if starttime is in the future and exit if true.
if ti... | go | func (pgb *ChainDB) AgendaVoteCounts(agendaID string) (yes, abstain, no uint32, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
chainInfo := pgb.ChainInfo()
agendaInfo := chainInfo.AgendaMileStones[agendaID]
// Check if starttime is in the future and exit if true.
if ti... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AgendaVoteCounts",
"(",
"agendaID",
"string",
")",
"(",
"yes",
",",
"abstain",
",",
"no",
"uint32",
",",
"err",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"... | // AgendaVoteCounts returns the vote counts for the agenda as builtin types. | [
"AgendaVoteCounts",
"returns",
"the",
"vote",
"counts",
"for",
"the",
"agenda",
"as",
"builtin",
"types",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1380-L1394 |
141,948 | decred/dcrdata | db/dcrpg/pgblockchain.go | AllAgendas | func (pgb *ChainDB) AllAgendas() (map[string]dbtypes.MileStone, error) {
return retrieveAllAgendas(pgb.db)
} | go | func (pgb *ChainDB) AllAgendas() (map[string]dbtypes.MileStone, error) {
return retrieveAllAgendas(pgb.db)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AllAgendas",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"dbtypes",
".",
"MileStone",
",",
"error",
")",
"{",
"return",
"retrieveAllAgendas",
"(",
"pgb",
".",
"db",
")",
"\n",
"}"
] | // AllAgendas returns all the agendas stored currently. | [
"AllAgendas",
"returns",
"all",
"the",
"agendas",
"stored",
"currently",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1397-L1399 |
141,949 | decred/dcrdata | db/dcrpg/pgblockchain.go | NumAddressIntervals | func (pgb *ChainDB) NumAddressIntervals(addr string, grouping dbtypes.TimeBasedGrouping) (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
return retrieveAddressTxsCount(ctx, pgb.db, addr, grouping.String())
} | go | func (pgb *ChainDB) NumAddressIntervals(addr string, grouping dbtypes.TimeBasedGrouping) (int64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
return retrieveAddressTxsCount(ctx, pgb.db, addr, grouping.String())
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"NumAddressIntervals",
"(",
"addr",
"string",
",",
"grouping",
"dbtypes",
".",
"TimeBasedGrouping",
")",
"(",
"int64",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
... | // NumAddressIntervals gets the number of unique time intervals for the
// specified grouping where there are entries in the addresses table for the
// given address. | [
"NumAddressIntervals",
"gets",
"the",
"number",
"of",
"unique",
"time",
"intervals",
"for",
"the",
"specified",
"grouping",
"where",
"there",
"are",
"entries",
"in",
"the",
"addresses",
"table",
"for",
"the",
"given",
"address",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1404-L1408 |
141,950 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressMetrics | func (pgb *ChainDB) AddressMetrics(addr string) (*dbtypes.AddressMetrics, error) {
// For each time grouping/interval size, get the number if intervals with
// data for the address.
var metrics dbtypes.AddressMetrics
for _, s := range dbtypes.TimeIntervals {
numIntervals, err := pgb.NumAddressIntervals(addr, s)
... | go | func (pgb *ChainDB) AddressMetrics(addr string) (*dbtypes.AddressMetrics, error) {
// For each time grouping/interval size, get the number if intervals with
// data for the address.
var metrics dbtypes.AddressMetrics
for _, s := range dbtypes.TimeIntervals {
numIntervals, err := pgb.NumAddressIntervals(addr, s)
... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressMetrics",
"(",
"addr",
"string",
")",
"(",
"*",
"dbtypes",
".",
"AddressMetrics",
",",
"error",
")",
"{",
"// For each time grouping/interval size, get the number if intervals with",
"// data for the address.",
"var",
"me... | // AddressMetrics returns the block time of the oldest transaction and the
// total count for all the transactions linked to the provided address grouped
// by years, months, weeks and days time grouping in seconds.
// This helps plot more meaningful address history graphs to the user. | [
"AddressMetrics",
"returns",
"the",
"block",
"time",
"of",
"the",
"oldest",
"transaction",
"and",
"the",
"total",
"count",
"for",
"all",
"the",
"transactions",
"linked",
"to",
"the",
"provided",
"address",
"grouped",
"by",
"years",
"months",
"weeks",
"and",
"d... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1414-L1447 |
141,951 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressTransactionsAll | func (pgb *ChainDB) AddressTransactionsAll(address string) (addressRows []*dbtypes.AddressRow, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
addressRows, err = RetrieveAllMainchainAddressTxns(ctx, pgb.db, address)
err = pgb.replaceCancelError(err)
return
} | go | func (pgb *ChainDB) AddressTransactionsAll(address string) (addressRows []*dbtypes.AddressRow, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
addressRows, err = RetrieveAllMainchainAddressTxns(ctx, pgb.db, address)
err = pgb.replaceCancelError(err)
return
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressTransactionsAll",
"(",
"address",
"string",
")",
"(",
"addressRows",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
",",
"err",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"... | // AddressTransactionsAll retrieves all non-merged main chain addresses table
// rows for the given address. | [
"AddressTransactionsAll",
"retrieves",
"all",
"non",
"-",
"merged",
"main",
"chain",
"addresses",
"table",
"rows",
"for",
"the",
"given",
"address",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1483-L1490 |
141,952 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressHistoryAll | func (pgb *ChainDB) AddressHistoryAll(address string, N, offset int64) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error) {
return pgb.AddressHistory(address, N, offset, dbtypes.AddrTxnAll)
} | go | func (pgb *ChainDB) AddressHistoryAll(address string, N, offset int64) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error) {
return pgb.AddressHistory(address, N, offset, dbtypes.AddrTxnAll)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressHistoryAll",
"(",
"address",
"string",
",",
"N",
",",
"offset",
"int64",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
",",
"*",
"dbtypes",
".",
"AddressBalance",
",",
"error",
")",
"{",
"return... | // AddressHistoryAll retrieves N address rows of type AddrTxnAll, skipping over
// offset rows first, in order of block time. | [
"AddressHistoryAll",
"retrieves",
"N",
"address",
"rows",
"of",
"type",
"AddrTxnAll",
"skipping",
"over",
"offset",
"rows",
"first",
"in",
"order",
"of",
"block",
"time",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1507-L1509 |
141,953 | decred/dcrdata | db/dcrpg/pgblockchain.go | TicketPoolBlockMaturity | func (pgb *ChainDB) TicketPoolBlockMaturity() int64 {
bestBlock := int64(pgb.stakeDB.Height())
return bestBlock - int64(pgb.chainParams.TicketMaturity)
} | go | func (pgb *ChainDB) TicketPoolBlockMaturity() int64 {
bestBlock := int64(pgb.stakeDB.Height())
return bestBlock - int64(pgb.chainParams.TicketMaturity)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TicketPoolBlockMaturity",
"(",
")",
"int64",
"{",
"bestBlock",
":=",
"int64",
"(",
"pgb",
".",
"stakeDB",
".",
"Height",
"(",
")",
")",
"\n",
"return",
"bestBlock",
"-",
"int64",
"(",
"pgb",
".",
"chainParams",
... | // TicketPoolBlockMaturity returns the block at which all tickets with height
// greater than it are immature. | [
"TicketPoolBlockMaturity",
"returns",
"the",
"block",
"at",
"which",
"all",
"tickets",
"with",
"height",
"greater",
"than",
"it",
"are",
"immature",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1513-L1516 |
141,954 | decred/dcrdata | db/dcrpg/pgblockchain.go | TicketPoolByDateAndInterval | func (pgb *ChainDB) TicketPoolByDateAndInterval(maturityBlock int64,
interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
tpd, err := retrieveTicketsByDate(ctx, pgb.db, maturityBlock, interval.String())
return tpd, pgb.... | go | func (pgb *ChainDB) TicketPoolByDateAndInterval(maturityBlock int64,
interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
tpd, err := retrieveTicketsByDate(ctx, pgb.db, maturityBlock, interval.String())
return tpd, pgb.... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TicketPoolByDateAndInterval",
"(",
"maturityBlock",
"int64",
",",
"interval",
"dbtypes",
".",
"TimeBasedGrouping",
")",
"(",
"*",
"dbtypes",
".",
"PoolTicketsData",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
... | // TicketPoolByDateAndInterval fetches the tickets ordered by the purchase date
// interval provided and an error value. | [
"TicketPoolByDateAndInterval",
"fetches",
"the",
"tickets",
"ordered",
"by",
"the",
"purchase",
"date",
"interval",
"provided",
"and",
"an",
"error",
"value",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1520-L1526 |
141,955 | decred/dcrdata | db/dcrpg/pgblockchain.go | PosIntervals | func (pgb *ChainDB) PosIntervals(limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
bgi, err := retrieveWindowBlocks(ctx, pgb.db, pgb.chainParams.StakeDiffWindowSize, limit, offset)
return bgi, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) PosIntervals(limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
bgi, err := retrieveWindowBlocks(ctx, pgb.db, pgb.chainParams.StakeDiffWindowSize, limit, offset)
return bgi, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"PosIntervals",
"(",
"limit",
",",
"offset",
"uint64",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"BlocksGroupedInfo",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",... | // PosIntervals retrieves the blocks at the respective stakebase windows
// interval. The term "window" is used here to describe the group of blocks
// whose count is defined by chainParams.StakeDiffWindowSize. During this
// chainParams.StakeDiffWindowSize block interval the ticket price and the
// difficulty value is... | [
"PosIntervals",
"retrieves",
"the",
"blocks",
"at",
"the",
"respective",
"stakebase",
"windows",
"interval",
".",
"The",
"term",
"window",
"is",
"used",
"here",
"to",
"describe",
"the",
"group",
"of",
"blocks",
"whose",
"count",
"is",
"defined",
"by",
"chainPa... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1533-L1538 |
141,956 | decred/dcrdata | db/dcrpg/pgblockchain.go | TimeBasedIntervals | func (pgb *ChainDB) TimeBasedIntervals(timeGrouping dbtypes.TimeBasedGrouping,
limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
bgi, err := retrieveTimeBasedBlockListing(ctx, pgb.db, timeGrouping.String(),
limit, offset)
re... | go | func (pgb *ChainDB) TimeBasedIntervals(timeGrouping dbtypes.TimeBasedGrouping,
limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
bgi, err := retrieveTimeBasedBlockListing(ctx, pgb.db, timeGrouping.String(),
limit, offset)
re... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TimeBasedIntervals",
"(",
"timeGrouping",
"dbtypes",
".",
"TimeBasedGrouping",
",",
"limit",
",",
"offset",
"uint64",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"BlocksGroupedInfo",
",",
"error",
")",
"{",
"ctx",
","... | // TimeBasedIntervals retrieves blocks groups by the selected time-based
// interval. For the consecutive groups the number of blocks grouped together is
// not uniform. | [
"TimeBasedIntervals",
"retrieves",
"blocks",
"groups",
"by",
"the",
"selected",
"time",
"-",
"based",
"interval",
".",
"For",
"the",
"consecutive",
"groups",
"the",
"number",
"of",
"blocks",
"grouped",
"together",
"is",
"not",
"uniform",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1543-L1550 |
141,957 | decred/dcrdata | db/dcrpg/pgblockchain.go | TicketPoolVisualization | func (pgb *ChainDB) TicketPoolVisualization(interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData,
*dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, int64, error) {
// Attempt to retrieve data for the current block from cache.
heightSeen := pgb.Height() // current block seen *by the ChainDB*
if heightSeen... | go | func (pgb *ChainDB) TicketPoolVisualization(interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData,
*dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, int64, error) {
// Attempt to retrieve data for the current block from cache.
heightSeen := pgb.Height() // current block seen *by the ChainDB*
if heightSeen... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TicketPoolVisualization",
"(",
"interval",
"dbtypes",
".",
"TimeBasedGrouping",
")",
"(",
"*",
"dbtypes",
".",
"PoolTicketsData",
",",
"*",
"dbtypes",
".",
"PoolTicketsData",
",",
"*",
"dbtypes",
".",
"PoolTicketsData",
... | // TicketPoolVisualization helps block consecutive and duplicate DB queries for
// the requested ticket pool chart data. If the data for the given interval is
// cached and fresh, it is returned. If the cached data is stale and there are
// no queries running to update the cache for the given interval, this launches
//... | [
"TicketPoolVisualization",
"helps",
"block",
"consecutive",
"and",
"duplicate",
"DB",
"queries",
"for",
"the",
"requested",
"ticket",
"pool",
"chart",
"data",
".",
"If",
"the",
"data",
"for",
"the",
"given",
"interval",
"is",
"cached",
"and",
"fresh",
"it",
"i... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1559-L1616 |
141,958 | decred/dcrdata | db/dcrpg/pgblockchain.go | GetTicketInfo | func (pgb *ChainDB) GetTicketInfo(txid string) (*apitypes.TicketInfo, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
spendStatus, poolStatus, purchaseBlock, lotteryBlock, spendTxid, err := RetrieveTicketInfoByHash(ctx, pgb.db, txid)
if err != nil {
return nil, pgb.replaceCa... | go | func (pgb *ChainDB) GetTicketInfo(txid string) (*apitypes.TicketInfo, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
spendStatus, poolStatus, purchaseBlock, lotteryBlock, spendTxid, err := RetrieveTicketInfoByHash(ctx, pgb.db, txid)
if err != nil {
return nil, pgb.replaceCa... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"GetTicketInfo",
"(",
"txid",
"string",
")",
"(",
"*",
"apitypes",
".",
"TicketInfo",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",... | // GetTicketInfo retrieves information about the pool and spend statuses, the
// purchase block, the lottery block, and the spending transaction. | [
"GetTicketInfo",
"retrieves",
"information",
"about",
"the",
"pool",
"and",
"spend",
"statuses",
"the",
"purchase",
"block",
"the",
"lottery",
"block",
"and",
"the",
"spending",
"transaction",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1663-L1706 |
141,959 | decred/dcrdata | db/dcrpg/pgblockchain.go | FreshenAddressCaches | func (pgb *ChainDB) FreshenAddressCaches(lazyProjectFund bool, expireAddresses []string) error {
// Clear existing cache entries.
//numCleared := pgb.AddressCache.ClearAll()
numCleared := pgb.AddressCache.Clear(expireAddresses)
log.Debugf("Cleared cache for %d addresses.", numCleared)
// Do not initiate project f... | go | func (pgb *ChainDB) FreshenAddressCaches(lazyProjectFund bool, expireAddresses []string) error {
// Clear existing cache entries.
//numCleared := pgb.AddressCache.ClearAll()
numCleared := pgb.AddressCache.Clear(expireAddresses)
log.Debugf("Cleared cache for %d addresses.", numCleared)
// Do not initiate project f... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"FreshenAddressCaches",
"(",
"lazyProjectFund",
"bool",
",",
"expireAddresses",
"[",
"]",
"string",
")",
"error",
"{",
"// Clear existing cache entries.",
"//numCleared := pgb.AddressCache.ClearAll()",
"numCleared",
":=",
"pgb",
... | // FreshenAddressCaches resets the address balance cache by purging data for the
// addresses listed in expireAddresses, and prefetches the project fund balance
// if devPrefetch is enabled and not mid-reorg. The project fund update is run
// asynchronously if lazyProjectFund is true. | [
"FreshenAddressCaches",
"resets",
"the",
"address",
"balance",
"cache",
"by",
"purging",
"data",
"for",
"the",
"addresses",
"listed",
"in",
"expireAddresses",
"and",
"prefetches",
"the",
"project",
"fund",
"balance",
"if",
"devPrefetch",
"is",
"enabled",
"and",
"n... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1725-L1757 |
141,960 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressBalance | func (pgb *ChainDB) AddressBalance(address string) (bal *dbtypes.AddressBalance, cacheUpdated bool, err error) {
// Check the cache first.
bestHash, height := pgb.BestBlock()
var validHeight *cache.BlockID
bal, validHeight = pgb.AddressCache.Balance(address)
if bal != nil && *bestHash == validHeight.Hash {
retur... | go | func (pgb *ChainDB) AddressBalance(address string) (bal *dbtypes.AddressBalance, cacheUpdated bool, err error) {
// Check the cache first.
bestHash, height := pgb.BestBlock()
var validHeight *cache.BlockID
bal, validHeight = pgb.AddressCache.Balance(address)
if bal != nil && *bestHash == validHeight.Hash {
retur... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressBalance",
"(",
"address",
"string",
")",
"(",
"bal",
"*",
"dbtypes",
".",
"AddressBalance",
",",
"cacheUpdated",
"bool",
",",
"err",
"error",
")",
"{",
"// Check the cache first.",
"bestHash",
",",
"height",
"... | // AddressBalance attempts to retrieve balance information for a specific
// address from cache, and if cache is stale or missing data for the address, a
// DB query is used. A successful DB query will freshen the cache. | [
"AddressBalance",
"attempts",
"to",
"retrieve",
"balance",
"information",
"for",
"a",
"specific",
"address",
"from",
"cache",
"and",
"if",
"cache",
"is",
"stale",
"or",
"missing",
"data",
"for",
"the",
"address",
"a",
"DB",
"query",
"is",
"used",
".",
"A",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1789-L1830 |
141,961 | decred/dcrdata | db/dcrpg/pgblockchain.go | updateAddressRows | func (pgb *ChainDB) updateAddressRows(address string) (rows []*dbtypes.AddressRow, cacheUpdated bool, err error) {
busy, wait, done := pgb.CacheLocks.rows.TryLock(address)
if busy {
// Just wait until the updater is finished.
<-wait
err = fmt.Errorf("retry")
return
}
// We will run the DB query, so block o... | go | func (pgb *ChainDB) updateAddressRows(address string) (rows []*dbtypes.AddressRow, cacheUpdated bool, err error) {
busy, wait, done := pgb.CacheLocks.rows.TryLock(address)
if busy {
// Just wait until the updater is finished.
<-wait
err = fmt.Errorf("retry")
return
}
// We will run the DB query, so block o... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"updateAddressRows",
"(",
"address",
"string",
")",
"(",
"rows",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
",",
"cacheUpdated",
"bool",
",",
"err",
"error",
")",
"{",
"busy",
",",
"wait",
",",
"done",
":=",
... | // updateAddressRows updates address rows, or waits for them to update by an
// ongoing query. On completion, the cache should be ready, although it must be
// checked again. | [
"updateAddressRows",
"updates",
"address",
"rows",
"or",
"waits",
"for",
"them",
"to",
"update",
"by",
"an",
"ongoing",
"query",
".",
"On",
"completion",
"the",
"cache",
"should",
"be",
"ready",
"although",
"it",
"must",
"be",
"checked",
"again",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1835-L1861 |
141,962 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressRowsMerged | func (pgb *ChainDB) AddressRowsMerged(address string) ([]dbtypes.AddressRowMerged, error) {
// Try the address cache.
hash := pgb.BestBlockHash()
rowsCompact, validBlock := pgb.AddressCache.Rows(address)
cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil
if cacheCurrent {
log.Tra... | go | func (pgb *ChainDB) AddressRowsMerged(address string) ([]dbtypes.AddressRowMerged, error) {
// Try the address cache.
hash := pgb.BestBlockHash()
rowsCompact, validBlock := pgb.AddressCache.Rows(address)
cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil
if cacheCurrent {
log.Tra... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressRowsMerged",
"(",
"address",
"string",
")",
"(",
"[",
"]",
"dbtypes",
".",
"AddressRowMerged",
",",
"error",
")",
"{",
"// Try the address cache.",
"hash",
":=",
"pgb",
".",
"BestBlockHash",
"(",
")",
"\n",
... | // AddressRowsMerged gets the merged address rows either from cache or via DB
// query. | [
"AddressRowsMerged",
"gets",
"the",
"merged",
"address",
"rows",
"either",
"from",
"cache",
"or",
"via",
"DB",
"query",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1865-L1889 |
141,963 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressRowsCompact | func (pgb *ChainDB) AddressRowsCompact(address string) ([]dbtypes.AddressRowCompact, error) {
// Try the address cache.
hash := pgb.BestBlockHash()
rowsCompact, validBlock := pgb.AddressCache.Rows(address)
cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil
if cacheCurrent {
log.T... | go | func (pgb *ChainDB) AddressRowsCompact(address string) ([]dbtypes.AddressRowCompact, error) {
// Try the address cache.
hash := pgb.BestBlockHash()
rowsCompact, validBlock := pgb.AddressCache.Rows(address)
cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil
if cacheCurrent {
log.T... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressRowsCompact",
"(",
"address",
"string",
")",
"(",
"[",
"]",
"dbtypes",
".",
"AddressRowCompact",
",",
"error",
")",
"{",
"// Try the address cache.",
"hash",
":=",
"pgb",
".",
"BestBlockHash",
"(",
")",
"\n",
... | // AddressRowsCompact gets non-merged address rows either from cache or via DB
// query. | [
"AddressRowsCompact",
"gets",
"non",
"-",
"merged",
"address",
"rows",
"either",
"from",
"cache",
"or",
"via",
"DB",
"query",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1893-L1917 |
141,964 | decred/dcrdata | db/dcrpg/pgblockchain.go | retrieveMergedTxnCount | func (pgb *ChainDB) retrieveMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var count int64
var err error
switch txnView {
case dbtypes.AddrMergedTxnDebit:
count, err = CountMergedSpendingTxns(ctx, pgb.db, ... | go | func (pgb *ChainDB) retrieveMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var count int64
var err error
switch txnView {
case dbtypes.AddrMergedTxnDebit:
count, err = CountMergedSpendingTxns(ctx, pgb.db, ... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"retrieveMergedTxnCount",
"(",
"addr",
"string",
",",
"txnView",
"dbtypes",
".",
"AddrTxnViewType",
")",
"(",
"int",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
"... | // retrieveMergedTxnCount queries the DB for the merged address transaction view
// row count. | [
"retrieveMergedTxnCount",
"queries",
"the",
"DB",
"for",
"the",
"merged",
"address",
"transaction",
"view",
"row",
"count",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1921-L1938 |
141,965 | decred/dcrdata | db/dcrpg/pgblockchain.go | mergedTxnCount | func (pgb *ChainDB) mergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
// Try the cache first.
rows, blockID := pgb.AddressCache.Rows(addr)
if blockID == nil {
// Query the DB.
return pgb.retrieveMergedTxnCount(addr, txnView)
}
return dbtypes.CountMergedRowsCompact(rows, txnView)
} | go | func (pgb *ChainDB) mergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
// Try the cache first.
rows, blockID := pgb.AddressCache.Rows(addr)
if blockID == nil {
// Query the DB.
return pgb.retrieveMergedTxnCount(addr, txnView)
}
return dbtypes.CountMergedRowsCompact(rows, txnView)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"mergedTxnCount",
"(",
"addr",
"string",
",",
"txnView",
"dbtypes",
".",
"AddrTxnViewType",
")",
"(",
"int",
",",
"error",
")",
"{",
"// Try the cache first.",
"rows",
",",
"blockID",
":=",
"pgb",
".",
"AddressCache",... | // mergedTxnCount checks cache and falls back to retrieveMergedTxnCount. | [
"mergedTxnCount",
"checks",
"cache",
"and",
"falls",
"back",
"to",
"retrieveMergedTxnCount",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1941-L1950 |
141,966 | decred/dcrdata | db/dcrpg/pgblockchain.go | nonMergedTxnCount | func (pgb *ChainDB) nonMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
bal, _, err := pgb.AddressBalance(addr)
if err != nil {
return 0, err
}
var count int64
switch txnView {
case dbtypes.AddrTxnAll:
count = (bal.NumSpent * 2) + bal.NumUnspent
case dbtypes.AddrTxnCredit:
count ... | go | func (pgb *ChainDB) nonMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
bal, _, err := pgb.AddressBalance(addr)
if err != nil {
return 0, err
}
var count int64
switch txnView {
case dbtypes.AddrTxnAll:
count = (bal.NumSpent * 2) + bal.NumUnspent
case dbtypes.AddrTxnCredit:
count ... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"nonMergedTxnCount",
"(",
"addr",
"string",
",",
"txnView",
"dbtypes",
".",
"AddrTxnViewType",
")",
"(",
"int",
",",
"error",
")",
"{",
"bal",
",",
"_",
",",
"err",
":=",
"pgb",
".",
"AddressBalance",
"(",
"addr... | // nonMergedTxnCount gets the non-merged address transaction view row count via
// AddressBalance, which checks the cache and falls back to a DB query. | [
"nonMergedTxnCount",
"gets",
"the",
"non",
"-",
"merged",
"address",
"transaction",
"view",
"row",
"count",
"via",
"AddressBalance",
"which",
"checks",
"the",
"cache",
"and",
"falls",
"back",
"to",
"a",
"DB",
"query",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1954-L1971 |
141,967 | decred/dcrdata | db/dcrpg/pgblockchain.go | CountTransactions | func (pgb *ChainDB) CountTransactions(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
merged, err := txnView.IsMerged()
if err != nil {
return 0, err
}
countFn := pgb.nonMergedTxnCount
if merged {
countFn = pgb.mergedTxnCount
}
count, err := countFn(addr, txnView)
if err != nil {
return 0, ... | go | func (pgb *ChainDB) CountTransactions(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
merged, err := txnView.IsMerged()
if err != nil {
return 0, err
}
countFn := pgb.nonMergedTxnCount
if merged {
countFn = pgb.mergedTxnCount
}
count, err := countFn(addr, txnView)
if err != nil {
return 0, ... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"CountTransactions",
"(",
"addr",
"string",
",",
"txnView",
"dbtypes",
".",
"AddrTxnViewType",
")",
"(",
"int",
",",
"error",
")",
"{",
"merged",
",",
"err",
":=",
"txnView",
".",
"IsMerged",
"(",
")",
"\n",
"if... | // CountTransactions gets the total row count for the given address and address
// transaction view. | [
"CountTransactions",
"gets",
"the",
"total",
"row",
"count",
"for",
"the",
"given",
"address",
"and",
"address",
"transaction",
"view",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1975-L1991 |
141,968 | decred/dcrdata | db/dcrpg/pgblockchain.go | DbTxByHash | func (pgb *ChainDB) DbTxByHash(txid string) (*dbtypes.Tx, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, dbTx, err := RetrieveDbTxByHash(ctx, pgb.db, txid)
return dbTx, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) DbTxByHash(txid string) (*dbtypes.Tx, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
_, dbTx, err := RetrieveDbTxByHash(ctx, pgb.db, txid)
return dbTx, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"DbTxByHash",
"(",
"txid",
"string",
")",
"(",
"*",
"dbtypes",
".",
"Tx",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTim... | // DbTxByHash retrieves a row of the transactions table corresponding to the
// given transaction hash. Transactions in valid and mainchain blocks are chosen
// first. | [
"DbTxByHash",
"retrieves",
"a",
"row",
"of",
"the",
"transactions",
"table",
"corresponding",
"to",
"the",
"given",
"transaction",
"hash",
".",
"Transactions",
"in",
"valid",
"and",
"mainchain",
"blocks",
"are",
"chosen",
"first",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2314-L2319 |
141,969 | decred/dcrdata | db/dcrpg/pgblockchain.go | FundingOutpointIndxByVinID | func (pgb *ChainDB) FundingOutpointIndxByVinID(id uint64) (uint32, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
ind, err := RetrieveFundingOutpointIndxByVinID(ctx, pgb.db, id)
return ind, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) FundingOutpointIndxByVinID(id uint64) (uint32, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
ind, err := RetrieveFundingOutpointIndxByVinID(ctx, pgb.db, id)
return ind, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"FundingOutpointIndxByVinID",
"(",
"id",
"uint64",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTimeout",
... | // FundingOutpointIndxByVinID retrieves the the transaction output index of the
// previous outpoint for a transaction input specified by row ID in the vins
// table, which stores previous outpoints for each vin. | [
"FundingOutpointIndxByVinID",
"retrieves",
"the",
"the",
"transaction",
"output",
"index",
"of",
"the",
"previous",
"outpoint",
"for",
"a",
"transaction",
"input",
"specified",
"by",
"row",
"ID",
"in",
"the",
"vins",
"table",
"which",
"stores",
"previous",
"outpoi... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2324-L2329 |
141,970 | decred/dcrdata | db/dcrpg/pgblockchain.go | FillAddressTransactions | func (pgb *ChainDB) FillAddressTransactions(addrInfo *dbtypes.AddressInfo) error {
if addrInfo == nil {
return nil
}
var numUnconfirmed int64
for i, txn := range addrInfo.Transactions {
// Retrieve the most valid, most mainchain, and most recent tx with this
// hash. This means it prefers mainchain and vali... | go | func (pgb *ChainDB) FillAddressTransactions(addrInfo *dbtypes.AddressInfo) error {
if addrInfo == nil {
return nil
}
var numUnconfirmed int64
for i, txn := range addrInfo.Transactions {
// Retrieve the most valid, most mainchain, and most recent tx with this
// hash. This means it prefers mainchain and vali... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"FillAddressTransactions",
"(",
"addrInfo",
"*",
"dbtypes",
".",
"AddressInfo",
")",
"error",
"{",
"if",
"addrInfo",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"numUnconfirmed",
"int64",
"\n\n",
"f... | // FillAddressTransactions is used to fill out the transaction details in an
// explorer.AddressInfo generated by dbtypes.ReduceAddressHistory, usually from
// the output of AddressHistory. This function also sets the number of
// unconfirmed transactions for the current best block in the database. | [
"FillAddressTransactions",
"is",
"used",
"to",
"fill",
"out",
"the",
"transaction",
"details",
"in",
"an",
"explorer",
".",
"AddressInfo",
"generated",
"by",
"dbtypes",
".",
"ReduceAddressHistory",
"usually",
"from",
"the",
"output",
"of",
"AddressHistory",
".",
"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2335-L2393 |
141,971 | decred/dcrdata | db/dcrpg/pgblockchain.go | AddressTransactionDetails | func (pgb *ChainDB) AddressTransactionDetails(addr string, count, skip int64,
txnType dbtypes.AddrTxnViewType) (*apitypes.Address, error) {
// Fetch address history for given transaction range and type
addrData, _, err := pgb.addressInfo(addr, count, skip, txnType)
if err != nil {
return nil, err
}
// No transa... | go | func (pgb *ChainDB) AddressTransactionDetails(addr string, count, skip int64,
txnType dbtypes.AddrTxnViewType) (*apitypes.Address, error) {
// Fetch address history for given transaction range and type
addrData, _, err := pgb.addressInfo(addr, count, skip, txnType)
if err != nil {
return nil, err
}
// No transa... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"AddressTransactionDetails",
"(",
"addr",
"string",
",",
"count",
",",
"skip",
"int64",
",",
"txnType",
"dbtypes",
".",
"AddrTxnViewType",
")",
"(",
"*",
"apitypes",
".",
"Address",
",",
"error",
")",
"{",
"// Fetch... | // AddressTransactionDetails returns an apitypes.Address with at most the last
// count transactions of type txnType in which the address was involved,
// starting after skip transactions. This does NOT include unconfirmed
// transactions. | [
"AddressTransactionDetails",
"returns",
"an",
"apitypes",
".",
"Address",
"with",
"at",
"most",
"the",
"last",
"count",
"transactions",
"of",
"type",
"txnType",
"in",
"which",
"the",
"address",
"was",
"involved",
"starting",
"after",
"skip",
"transactions",
".",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2610-L2643 |
141,972 | decred/dcrdata | db/dcrpg/pgblockchain.go | ChainInfo | func (pgb *ChainDB) ChainInfo() *dbtypes.BlockChainData {
pgb.deployments.mtx.RLock()
defer pgb.deployments.mtx.RUnlock()
return pgb.deployments.chainInfo
} | go | func (pgb *ChainDB) ChainInfo() *dbtypes.BlockChainData {
pgb.deployments.mtx.RLock()
defer pgb.deployments.mtx.RUnlock()
return pgb.deployments.chainInfo
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"ChainInfo",
"(",
")",
"*",
"dbtypes",
".",
"BlockChainData",
"{",
"pgb",
".",
"deployments",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"pgb",
".",
"deployments",
".",
"mtx",
".",
"RUnlock",
"(",
")",... | // ChainInfo guarantees thread-safe access of the deployment data. | [
"ChainInfo",
"guarantees",
"thread",
"-",
"safe",
"access",
"of",
"the",
"deployment",
"data",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2746-L2750 |
141,973 | decred/dcrdata | db/dcrpg/pgblockchain.go | Store | func (pgb *ChainDB) Store(blockData *blockdata.BlockData, msgBlock *wire.MsgBlock) error {
// This function must handle being run when pgb is nil (not constructed).
if pgb == nil {
return nil
}
// New blocks stored this way are considered valid and part of mainchain,
// warranting updates to existing records. W... | go | func (pgb *ChainDB) Store(blockData *blockdata.BlockData, msgBlock *wire.MsgBlock) error {
// This function must handle being run when pgb is nil (not constructed).
if pgb == nil {
return nil
}
// New blocks stored this way are considered valid and part of mainchain,
// warranting updates to existing records. W... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"Store",
"(",
"blockData",
"*",
"blockdata",
".",
"BlockData",
",",
"msgBlock",
"*",
"wire",
".",
"MsgBlock",
")",
"error",
"{",
"// This function must handle being run when pgb is nil (not constructed).",
"if",
"pgb",
"==",
... | // Store satisfies BlockDataSaver. Blocks stored this way are considered valid
// and part of mainchain. Store should not be used for batch block processing;
// instead, use StoreBlock and specify appropriate flags. | [
"Store",
"satisfies",
"BlockDataSaver",
".",
"Blocks",
"stored",
"this",
"way",
"are",
"considered",
"valid",
"and",
"part",
"of",
"mainchain",
".",
"Store",
"should",
"not",
"be",
"used",
"for",
"batch",
"block",
"processing",
";",
"instead",
"use",
"StoreBlo... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2755-L2775 |
141,974 | decred/dcrdata | db/dcrpg/pgblockchain.go | PurgeBestBlocks | func (pgb *ChainDB) PurgeBestBlocks(N int64) (*dbtypes.DeletionSummary, int64, error) {
res, height, _, err := DeleteBlocks(pgb.ctx, N, pgb.db)
if err != nil {
return nil, height, pgb.replaceCancelError(err)
}
summary := dbtypes.DeletionSummarySlice(res).Reduce()
return &summary, height, err
} | go | func (pgb *ChainDB) PurgeBestBlocks(N int64) (*dbtypes.DeletionSummary, int64, error) {
res, height, _, err := DeleteBlocks(pgb.ctx, N, pgb.db)
if err != nil {
return nil, height, pgb.replaceCancelError(err)
}
summary := dbtypes.DeletionSummarySlice(res).Reduce()
return &summary, height, err
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"PurgeBestBlocks",
"(",
"N",
"int64",
")",
"(",
"*",
"dbtypes",
".",
"DeletionSummary",
",",
"int64",
",",
"error",
")",
"{",
"res",
",",
"height",
",",
"_",
",",
"err",
":=",
"DeleteBlocks",
"(",
"pgb",
".",
... | // PurgeBestBlocks deletes all data for the N best blocks in the DB. | [
"PurgeBestBlocks",
"deletes",
"all",
"data",
"for",
"the",
"N",
"best",
"blocks",
"in",
"the",
"DB",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2778-L2787 |
141,975 | decred/dcrdata | db/dcrpg/pgblockchain.go | TxHistoryData | func (pgb *ChainDB) TxHistoryData(address string, addrChart dbtypes.HistoryChart,
chartGroupings dbtypes.TimeBasedGrouping) (cd *dbtypes.ChartsData, err error) {
// First check cache for this address' chart data of the given type and
// interval.
bestHash, height := pgb.BestBlock()
var validHeight *cache.BlockID
... | go | func (pgb *ChainDB) TxHistoryData(address string, addrChart dbtypes.HistoryChart,
chartGroupings dbtypes.TimeBasedGrouping) (cd *dbtypes.ChartsData, err error) {
// First check cache for this address' chart data of the given type and
// interval.
bestHash, height := pgb.BestBlock()
var validHeight *cache.BlockID
... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TxHistoryData",
"(",
"address",
"string",
",",
"addrChart",
"dbtypes",
".",
"HistoryChart",
",",
"chartGroupings",
"dbtypes",
".",
"TimeBasedGrouping",
")",
"(",
"cd",
"*",
"dbtypes",
".",
"ChartsData",
",",
"err",
"... | // TxHistoryData fetches the address history chart data for specified chart
// type and time grouping. | [
"TxHistoryData",
"fetches",
"the",
"address",
"history",
"chart",
"data",
"for",
"specified",
"chart",
"type",
"and",
"time",
"grouping",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2791-L2845 |
141,976 | decred/dcrdata | db/dcrpg/pgblockchain.go | TicketsByPrice | func (pgb *ChainDB) TicketsByPrice(maturityBlock int64) (*dbtypes.PoolTicketsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
ptd, err := retrieveTicketByPrice(ctx, pgb.db, maturityBlock)
return ptd, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) TicketsByPrice(maturityBlock int64) (*dbtypes.PoolTicketsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
ptd, err := retrieveTicketByPrice(ctx, pgb.db, maturityBlock)
return ptd, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TicketsByPrice",
"(",
"maturityBlock",
"int64",
")",
"(",
"*",
"dbtypes",
".",
"PoolTicketsData",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
... | // TicketsByPrice returns chart data for tickets grouped by price. maturityBlock
// is used to define when tickets are considered live. | [
"TicketsByPrice",
"returns",
"chart",
"data",
"for",
"tickets",
"grouped",
"by",
"price",
".",
"maturityBlock",
"is",
"used",
"to",
"define",
"when",
"tickets",
"are",
"considered",
"live",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2849-L2854 |
141,977 | decred/dcrdata | db/dcrpg/pgblockchain.go | TicketsByInputCount | func (pgb *ChainDB) TicketsByInputCount() (*dbtypes.PoolTicketsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
ptd, err := retrieveTicketsGroupedByType(ctx, pgb.db)
return ptd, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) TicketsByInputCount() (*dbtypes.PoolTicketsData, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
ptd, err := retrieveTicketsGroupedByType(ctx, pgb.db)
return ptd, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"TicketsByInputCount",
"(",
")",
"(",
"*",
"dbtypes",
".",
"PoolTicketsData",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTim... | // TicketsByInputCount returns chart data for tickets grouped by number of
// inputs. | [
"TicketsByInputCount",
"returns",
"chart",
"data",
"for",
"tickets",
"grouped",
"by",
"number",
"of",
"inputs",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2858-L2863 |
141,978 | decred/dcrdata | db/dcrpg/pgblockchain.go | windowStats | func (pgb *ChainDB) windowStats(charts *cache.ChartData) (*sql.Rows, func(), error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
rows, err := retrieveWindowStats(ctx, pgb.db, charts)
if err != nil {
return nil, cancel, fmt.Errorf("windowStats: %v", pgb.replaceCancelError(err))
}
return rows,... | go | func (pgb *ChainDB) windowStats(charts *cache.ChartData) (*sql.Rows, func(), error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
rows, err := retrieveWindowStats(ctx, pgb.db, charts)
if err != nil {
return nil, cancel, fmt.Errorf("windowStats: %v", pgb.replaceCancelError(err))
}
return rows,... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"windowStats",
"(",
"charts",
"*",
"cache",
".",
"ChartData",
")",
"(",
"*",
"sql",
".",
"Rows",
",",
"func",
"(",
")",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",... | // windowStats fetches the charts data from retrieveWindowStats.
// This is the Fetcher half of a pair that make up a cache.ChartUpdater. The
// Appender half is appendWindowStats. | [
"windowStats",
"fetches",
"the",
"charts",
"data",
"from",
"retrieveWindowStats",
".",
"This",
"is",
"the",
"Fetcher",
"half",
"of",
"a",
"pair",
"that",
"make",
"up",
"a",
"cache",
".",
"ChartUpdater",
".",
"The",
"Appender",
"half",
"is",
"appendWindowStats"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2868-L2877 |
141,979 | decred/dcrdata | db/dcrpg/pgblockchain.go | txPerDay | func (pgb *ChainDB) txPerDay(timeArr []dbtypes.TimeDef, txCountArr []uint64) (
[]dbtypes.TimeDef, []uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var err error
timeArr, txCountArr, err = retrieveTxPerDay(ctx, pgb.db, timeArr, txCountArr)
if err != nil {
err = fmt... | go | func (pgb *ChainDB) txPerDay(timeArr []dbtypes.TimeDef, txCountArr []uint64) (
[]dbtypes.TimeDef, []uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var err error
timeArr, txCountArr, err = retrieveTxPerDay(ctx, pgb.db, timeArr, txCountArr)
if err != nil {
err = fmt... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"txPerDay",
"(",
"timeArr",
"[",
"]",
"dbtypes",
".",
"TimeDef",
",",
"txCountArr",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"dbtypes",
".",
"TimeDef",
",",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"ctx",
... | // txPerDay fetches the tx-per-day chart data from retrieveTxPerDay. | [
"txPerDay",
"fetches",
"the",
"tx",
"-",
"per",
"-",
"day",
"chart",
"data",
"from",
"retrieveTxPerDay",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2907-L2919 |
141,980 | decred/dcrdata | db/dcrpg/pgblockchain.go | PowerlessTickets | func (pgb *ChainDB) PowerlessTickets() (*apitypes.PowerlessTickets, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
return retrievePowerlessTickets(ctx, pgb.db)
} | go | func (pgb *ChainDB) PowerlessTickets() (*apitypes.PowerlessTickets, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
return retrievePowerlessTickets(ctx, pgb.db)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"PowerlessTickets",
"(",
")",
"(",
"*",
"apitypes",
".",
"PowerlessTickets",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
",",
"pgb",
".",
"queryTime... | // PowerlessTickets fetches all missed and expired tickets, sorted by revocation
// status. | [
"PowerlessTickets",
"fetches",
"all",
"missed",
"and",
"expired",
"tickets",
"sorted",
"by",
"revocation",
"status",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2923-L2927 |
141,981 | decred/dcrdata | db/dcrpg/pgblockchain.go | ticketsByBlocks | func (pgb *ChainDB) ticketsByBlocks(heightArr, soloArr, pooledArr []uint64) ([]uint64,
[]uint64, []uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var err error
heightArr, soloArr, pooledArr, err = retrieveTicketByOutputCount(ctx,
pgb.db, 1, outputCountByAllBlocks, ... | go | func (pgb *ChainDB) ticketsByBlocks(heightArr, soloArr, pooledArr []uint64) ([]uint64,
[]uint64, []uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var err error
heightArr, soloArr, pooledArr, err = retrieveTicketByOutputCount(ctx,
pgb.db, 1, outputCountByAllBlocks, ... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"ticketsByBlocks",
"(",
"heightArr",
",",
"soloArr",
",",
"pooledArr",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"uint64",
",",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"ctx",
",",
... | // ticketsByBlocks fetches the tickets by blocks output count chart data from
// retrieveTicketByOutputCount
// This chart has been deprecated. Leaving ticketsByBlocks for possible future
// re-appropriation, says buck54321 on April 24, 2019. | [
"ticketsByBlocks",
"fetches",
"the",
"tickets",
"by",
"blocks",
"output",
"count",
"chart",
"data",
"from",
"retrieveTicketByOutputCount",
"This",
"chart",
"has",
"been",
"deprecated",
".",
"Leaving",
"ticketsByBlocks",
"for",
"possible",
"future",
"re",
"-",
"appro... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2933-L2946 |
141,982 | decred/dcrdata | db/dcrpg/pgblockchain.go | ticketsByTPWindows | func (pgb *ChainDB) ticketsByTPWindows(heightArr, soloArr, pooledArr []uint64) ([]uint64,
[]uint64, []uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var err error
heightArr, soloArr, pooledArr, err = retrieveTicketByOutputCount(ctx, pgb.db,
pgb.chainParams.StakeDif... | go | func (pgb *ChainDB) ticketsByTPWindows(heightArr, soloArr, pooledArr []uint64) ([]uint64,
[]uint64, []uint64, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
var err error
heightArr, soloArr, pooledArr, err = retrieveTicketByOutputCount(ctx, pgb.db,
pgb.chainParams.StakeDif... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"ticketsByTPWindows",
"(",
"heightArr",
",",
"soloArr",
",",
"pooledArr",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"uint64",
",",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"ctx",
",... | // ticketsByTPWindows fetches the tickets by ticket pool windows count chart data
// from retrieveTicketByOutputCount.
// This chart has been deprecated. Leaving ticketsByTPWindows for possible
// future re-appropriation, says buck54321 on April 24, 2019. | [
"ticketsByTPWindows",
"fetches",
"the",
"tickets",
"by",
"ticket",
"pool",
"windows",
"count",
"chart",
"data",
"from",
"retrieveTicketByOutputCount",
".",
"This",
"chart",
"has",
"been",
"deprecated",
".",
"Leaving",
"ticketsByTPWindows",
"for",
"possible",
"future",... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2952-L2966 |
141,983 | decred/dcrdata | db/dcrpg/pgblockchain.go | getChartData | func (pgb *ChainDB) getChartData(data map[string]*dbtypes.ChartsData,
chartT string) *dbtypes.ChartsData {
cData := data[chartT]
if cData == nil {
cData = new(dbtypes.ChartsData)
}
return cData
} | go | func (pgb *ChainDB) getChartData(data map[string]*dbtypes.ChartsData,
chartT string) *dbtypes.ChartsData {
cData := data[chartT]
if cData == nil {
cData = new(dbtypes.ChartsData)
}
return cData
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"getChartData",
"(",
"data",
"map",
"[",
"string",
"]",
"*",
"dbtypes",
".",
"ChartsData",
",",
"chartT",
"string",
")",
"*",
"dbtypes",
".",
"ChartsData",
"{",
"cData",
":=",
"data",
"[",
"chartT",
"]",
"\n",
... | // getChartData returns the chart data if it exists and initializes a new chart
// data instance if otherwise. | [
"getChartData",
"returns",
"the",
"chart",
"data",
"if",
"it",
"exists",
"and",
"initializes",
"a",
"new",
"chart",
"data",
"instance",
"if",
"otherwise",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2970-L2977 |
141,984 | decred/dcrdata | db/dcrpg/pgblockchain.go | SetVinsMainchainByBlock | func (pgb *ChainDB) SetVinsMainchainByBlock(blockHash string) (int64, []dbtypes.UInt64Array, []dbtypes.UInt64Array, error) {
// The queries in this function should not timeout or (probably) canceled,
// so use a background context.
ctx := context.Background()
// Get vins DB IDs from the transactions table, for eac... | go | func (pgb *ChainDB) SetVinsMainchainByBlock(blockHash string) (int64, []dbtypes.UInt64Array, []dbtypes.UInt64Array, error) {
// The queries in this function should not timeout or (probably) canceled,
// so use a background context.
ctx := context.Background()
// Get vins DB IDs from the transactions table, for eac... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"SetVinsMainchainByBlock",
"(",
"blockHash",
"string",
")",
"(",
"int64",
",",
"[",
"]",
"dbtypes",
".",
"UInt64Array",
",",
"[",
"]",
"dbtypes",
".",
"UInt64Array",
",",
"error",
")",
"{",
"// The queries in this fun... | // SetVinsMainchainByBlock first retrieves for all transactions in the specified
// block the vin_db_ids and vout_db_ids arrays, along with mainchain status,
// from the transactions table, and then sets the is_mainchain flag in the vins
// table for each row of vins in the vin_db_ids array. The returns are the
// numb... | [
"SetVinsMainchainByBlock",
"first",
"retrieves",
"for",
"all",
"transactions",
"in",
"the",
"specified",
"block",
"the",
"vin_db_ids",
"and",
"vout_db_ids",
"arrays",
"along",
"with",
"mainchain",
"status",
"from",
"the",
"transactions",
"table",
"and",
"then",
"set... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2985-L3001 |
141,985 | decred/dcrdata | db/dcrpg/pgblockchain.go | PkScriptByVinID | func (pgb *ChainDB) PkScriptByVinID(id uint64) (pkScript []byte, ver uint16, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
pks, ver, err := RetrievePkScriptByVinID(ctx, pgb.db, id)
return pks, ver, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) PkScriptByVinID(id uint64) (pkScript []byte, ver uint16, err error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
pks, ver, err := RetrievePkScriptByVinID(ctx, pgb.db, id)
return pks, ver, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"PkScriptByVinID",
"(",
"id",
"uint64",
")",
"(",
"pkScript",
"[",
"]",
"byte",
",",
"ver",
"uint16",
",",
"err",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
... | // PkScriptByVinID retrieves the pkScript and script version for the row of the
// vouts table corresponding to the previous output of the vin specified by row
// ID of the vins table. | [
"PkScriptByVinID",
"retrieves",
"the",
"pkScript",
"and",
"script",
"version",
"for",
"the",
"row",
"of",
"the",
"vouts",
"table",
"corresponding",
"to",
"the",
"previous",
"output",
"of",
"the",
"vin",
"specified",
"by",
"row",
"ID",
"of",
"the",
"vins",
"t... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L3043-L3048 |
141,986 | decred/dcrdata | db/dcrpg/pgblockchain.go | VinsForTx | func (pgb *ChainDB) VinsForTx(dbTx *dbtypes.Tx) ([]dbtypes.VinTxProperty, []string, []uint16, error) {
// Retrieve the pkScript and script version for the previous outpoint of
// each vin.
prevPkScripts := make([]string, 0, len(dbTx.VinDbIds))
versions := make([]uint16, 0, len(dbTx.VinDbIds))
for _, id := range db... | go | func (pgb *ChainDB) VinsForTx(dbTx *dbtypes.Tx) ([]dbtypes.VinTxProperty, []string, []uint16, error) {
// Retrieve the pkScript and script version for the previous outpoint of
// each vin.
prevPkScripts := make([]string, 0, len(dbTx.VinDbIds))
versions := make([]uint16, 0, len(dbTx.VinDbIds))
for _, id := range db... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"VinsForTx",
"(",
"dbTx",
"*",
"dbtypes",
".",
"Tx",
")",
"(",
"[",
"]",
"dbtypes",
".",
"VinTxProperty",
",",
"[",
"]",
"string",
",",
"[",
"]",
"uint16",
",",
"error",
")",
"{",
"// Retrieve the pkScript and s... | // VinsForTx returns a slice of dbtypes.VinTxProperty values for each vin
// referenced by the transaction dbTx, along with the pkScript and script
// version for the corresponding prevous outpoints. | [
"VinsForTx",
"returns",
"a",
"slice",
"of",
"dbtypes",
".",
"VinTxProperty",
"values",
"for",
"each",
"vin",
"referenced",
"by",
"the",
"transaction",
"dbTx",
"along",
"with",
"the",
"pkScript",
"and",
"script",
"version",
"for",
"the",
"corresponding",
"prevous... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L3062-L3084 |
141,987 | decred/dcrdata | db/dcrpg/pgblockchain.go | VoutsForTx | func (pgb *ChainDB) VoutsForTx(dbTx *dbtypes.Tx) ([]dbtypes.Vout, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
vouts, err := RetrieveVoutsByIDs(ctx, pgb.db, dbTx.VoutDbIds)
return vouts, pgb.replaceCancelError(err)
} | go | func (pgb *ChainDB) VoutsForTx(dbTx *dbtypes.Tx) ([]dbtypes.Vout, error) {
ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)
defer cancel()
vouts, err := RetrieveVoutsByIDs(ctx, pgb.db, dbTx.VoutDbIds)
return vouts, pgb.replaceCancelError(err)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"VoutsForTx",
"(",
"dbTx",
"*",
"dbtypes",
".",
"Tx",
")",
"(",
"[",
"]",
"dbtypes",
".",
"Vout",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"pgb",
".",
"ctx",
... | // VoutsForTx returns a slice of dbtypes.Vout values for each vout referenced by
// the transaction dbTx. | [
"VoutsForTx",
"returns",
"a",
"slice",
"of",
"dbtypes",
".",
"Vout",
"values",
"for",
"each",
"vout",
"referenced",
"by",
"the",
"transaction",
"dbTx",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L3088-L3093 |
141,988 | decred/dcrdata | db/dcrpg/pgblockchain.go | SetDBBestBlock | func (pgb *ChainDB) SetDBBestBlock() error {
pgb.bestBlock.mtx.RLock()
defer pgb.bestBlock.mtx.RUnlock()
return SetDBBestBlock(pgb.db, pgb.bestBlock.hash, pgb.bestBlock.height)
} | go | func (pgb *ChainDB) SetDBBestBlock() error {
pgb.bestBlock.mtx.RLock()
defer pgb.bestBlock.mtx.RUnlock()
return SetDBBestBlock(pgb.db, pgb.bestBlock.hash, pgb.bestBlock.height)
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"SetDBBestBlock",
"(",
")",
"error",
"{",
"pgb",
".",
"bestBlock",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"pgb",
".",
"bestBlock",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"SetDBBestBl... | // SetDBBestBlock stores ChainDB's BestBlock data in the meta table. | [
"SetDBBestBlock",
"stores",
"ChainDB",
"s",
"BestBlock",
"data",
"in",
"the",
"meta",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L3340-L3344 |
141,989 | decred/dcrdata | db/dcrpg/pgblockchain.go | CollectTicketSpendDBInfo | func (pgb *ChainDB) CollectTicketSpendDBInfo(dbTxns []*dbtypes.Tx, txDbIDs []uint64,
msgBlock *wire.MsgBlock, isMainchain bool) (spendingTxDbIDs []uint64, spendTypes []dbtypes.TicketSpendType,
ticketHashes []string, ticketDbIDs []uint64, err error) {
// This only makes sense for stake transactions. Check that the nu... | go | func (pgb *ChainDB) CollectTicketSpendDBInfo(dbTxns []*dbtypes.Tx, txDbIDs []uint64,
msgBlock *wire.MsgBlock, isMainchain bool) (spendingTxDbIDs []uint64, spendTypes []dbtypes.TicketSpendType,
ticketHashes []string, ticketDbIDs []uint64, err error) {
// This only makes sense for stake transactions. Check that the nu... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"CollectTicketSpendDBInfo",
"(",
"dbTxns",
"[",
"]",
"*",
"dbtypes",
".",
"Tx",
",",
"txDbIDs",
"[",
"]",
"uint64",
",",
"msgBlock",
"*",
"wire",
".",
"MsgBlock",
",",
"isMainchain",
"bool",
")",
"(",
"spendingTxD... | // CollectTicketSpendDBInfo processes the stake transactions in msgBlock, which
// correspond to the transaction data in dbTxns, and extracts data for votes and
// revokes, including the spent ticket hash and DB row ID. | [
"CollectTicketSpendDBInfo",
"processes",
"the",
"stake",
"transactions",
"in",
"msgBlock",
"which",
"correspond",
"to",
"the",
"transaction",
"data",
"in",
"dbTxns",
"and",
"extracts",
"data",
"for",
"votes",
"and",
"revokes",
"including",
"the",
"spent",
"ticket",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L3900-L3957 |
141,990 | decred/dcrdata | db/dcrpg/pgblockchain.go | UpdateSpendingInfoInAllTickets | func (pgb *ChainDB) UpdateSpendingInfoInAllTickets() (int64, error) {
// The queries in this function should not timeout or (probably) canceled,
// so use a background context.
ctx := context.Background()
// Get the full list of votes (DB IDs and heights), and spent ticket hashes
allVotesDbIDs, allVotesHeights, t... | go | func (pgb *ChainDB) UpdateSpendingInfoInAllTickets() (int64, error) {
// The queries in this function should not timeout or (probably) canceled,
// so use a background context.
ctx := context.Background()
// Get the full list of votes (DB IDs and heights), and spent ticket hashes
allVotesDbIDs, allVotesHeights, t... | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"UpdateSpendingInfoInAllTickets",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// The queries in this function should not timeout or (probably) canceled,",
"// so use a background context.",
"ctx",
":=",
"context",
".",
"Backgrou... | // UpdateSpendingInfoInAllTickets reviews all votes and revokes and sets this
// spending info in the tickets table. | [
"UpdateSpendingInfoInAllTickets",
"reviews",
"all",
"votes",
"and",
"revokes",
"and",
"sets",
"this",
"spending",
"info",
"in",
"the",
"tickets",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L4032-L4110 |
141,991 | decred/dcrdata | db/dcrpg/pgblockchain.go | GetChainWork | func (pgb *ChainDBRPC) GetChainWork(hash *chainhash.Hash) (string, error) {
return rpcutils.GetChainWork(pgb.Client, hash)
} | go | func (pgb *ChainDBRPC) GetChainWork(hash *chainhash.Hash) (string, error) {
return rpcutils.GetChainWork(pgb.Client, hash)
} | [
"func",
"(",
"pgb",
"*",
"ChainDBRPC",
")",
"GetChainWork",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"rpcutils",
".",
"GetChainWork",
"(",
"pgb",
".",
"Client",
",",
"hash",
")",
"\n",
"}"
] | // GetChainWork fetches the dcrjson.BlockHeaderVerbose and returns only the
// ChainWork attribute as a hex-encoded string, without 0x prefix. | [
"GetChainWork",
"fetches",
"the",
"dcrjson",
".",
"BlockHeaderVerbose",
"and",
"returns",
"only",
"the",
"ChainWork",
"attribute",
"as",
"a",
"hex",
"-",
"encoded",
"string",
"without",
"0x",
"prefix",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L4122-L4124 |
141,992 | decred/dcrdata | db/dcrpg/pgblockchain.go | GenesisStamp | func (pgb *ChainDB) GenesisStamp() int64 {
tDef := dbtypes.NewTimeDefFromUNIX(0)
// Ignoring error and returning zero time.
pgb.db.QueryRowContext(pgb.ctx, internal.SelectGenesisTime).Scan(&tDef)
return tDef.T.Unix()
} | go | func (pgb *ChainDB) GenesisStamp() int64 {
tDef := dbtypes.NewTimeDefFromUNIX(0)
// Ignoring error and returning zero time.
pgb.db.QueryRowContext(pgb.ctx, internal.SelectGenesisTime).Scan(&tDef)
return tDef.T.Unix()
} | [
"func",
"(",
"pgb",
"*",
"ChainDB",
")",
"GenesisStamp",
"(",
")",
"int64",
"{",
"tDef",
":=",
"dbtypes",
".",
"NewTimeDefFromUNIX",
"(",
"0",
")",
"\n",
"// Ignoring error and returning zero time.",
"pgb",
".",
"db",
".",
"QueryRowContext",
"(",
"pgb",
".",
... | // GenesisStamp returns the stamp of the lowest mainchain block in the database. | [
"GenesisStamp",
"returns",
"the",
"stamp",
"of",
"the",
"lowest",
"mainchain",
"block",
"in",
"the",
"database",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L4127-L4132 |
141,993 | decred/dcrdata | db/dcrpg/rewind.go | RetrieveTxsBlocksAboveHeight | func RetrieveTxsBlocksAboveHeight(ctx context.Context, db *sql.DB, height int64) (heights []int64, hashes []string, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectTxsBlocksAboveHeight, height)
if err != nil {
return
}
for rows.Next() {
var height int64
var hash string
if e... | go | func RetrieveTxsBlocksAboveHeight(ctx context.Context, db *sql.DB, height int64) (heights []int64, hashes []string, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectTxsBlocksAboveHeight, height)
if err != nil {
return
}
for rows.Next() {
var height int64
var hash string
if e... | [
"func",
"RetrieveTxsBlocksAboveHeight",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"height",
"int64",
")",
"(",
"heights",
"[",
"]",
"int64",
",",
"hashes",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"var",
... | // RetrieveTxsBlocksAboveHeight returns all distinct mainchain block heights and
// hashes referenced in the transactions table above the given height. | [
"RetrieveTxsBlocksAboveHeight",
"returns",
"all",
"distinct",
"mainchain",
"block",
"heights",
"and",
"hashes",
"referenced",
"in",
"the",
"transactions",
"table",
"above",
"the",
"given",
"height",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/rewind.go#L104-L121 |
141,994 | decred/dcrdata | db/dcrpg/rewind.go | RetrieveTxsBestBlockMainchain | func RetrieveTxsBestBlockMainchain(ctx context.Context, db *sql.DB) (height int64, hash string, err error) {
err = db.QueryRowContext(ctx, internal.SelectTxsBestBlock).Scan(&height, &hash)
if err == sql.ErrNoRows {
err = nil
height = -1
}
return
} | go | func RetrieveTxsBestBlockMainchain(ctx context.Context, db *sql.DB) (height int64, hash string, err error) {
err = db.QueryRowContext(ctx, internal.SelectTxsBestBlock).Scan(&height, &hash)
if err == sql.ErrNoRows {
err = nil
height = -1
}
return
} | [
"func",
"RetrieveTxsBestBlockMainchain",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"height",
"int64",
",",
"hash",
"string",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
"(",
"ctx",
"... | // RetrieveTxsBestBlockMainchain returns the best mainchain block's height from
// the transactions table. If the table is empty, a height of -1, an empty hash
// string, and a nil error are returned | [
"RetrieveTxsBestBlockMainchain",
"returns",
"the",
"best",
"mainchain",
"block",
"s",
"height",
"from",
"the",
"transactions",
"table",
".",
"If",
"the",
"table",
"is",
"empty",
"a",
"height",
"of",
"-",
"1",
"an",
"empty",
"hash",
"string",
"and",
"a",
"nil... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/rewind.go#L126-L133 |
141,995 | decred/dcrdata | db/dcrpg/rewind.go | DeleteBestBlock | func DeleteBestBlock(ctx context.Context, db *sql.DB) (res dbtypes.DeletionSummary, height int64, hash string, err error) {
height, hash, err = RetrieveBestBlock(ctx, db)
if err != nil {
return
}
res, err = DeleteBlockData(ctx, db, hash)
if err != nil {
return
}
height, hash, err = RetrieveBestBlock(ctx, d... | go | func DeleteBestBlock(ctx context.Context, db *sql.DB) (res dbtypes.DeletionSummary, height int64, hash string, err error) {
height, hash, err = RetrieveBestBlock(ctx, db)
if err != nil {
return
}
res, err = DeleteBlockData(ctx, db, hash)
if err != nil {
return
}
height, hash, err = RetrieveBestBlock(ctx, d... | [
"func",
"DeleteBestBlock",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"res",
"dbtypes",
".",
"DeletionSummary",
",",
"height",
"int64",
",",
"hash",
"string",
",",
"err",
"error",
")",
"{",
"height",
",",
"hash",... | // DeleteBestBlock removes all data for the best block in the DB from every
// table via DeleteBlockData. The returned height and hash are for the best
// block after successful data removal, or the initial best block if removal
// fails as indicated by a non-nil error value. | [
"DeleteBestBlock",
"removes",
"all",
"data",
"for",
"the",
"best",
"block",
"in",
"the",
"DB",
"from",
"every",
"table",
"via",
"DeleteBlockData",
".",
"The",
"returned",
"height",
"and",
"hash",
"are",
"for",
"the",
"best",
"block",
"after",
"successful",
"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/rewind.go#L253-L271 |
141,996 | decred/dcrdata | db/dcrpg/rewind.go | DeleteBlocks | func DeleteBlocks(ctx context.Context, N int64, db *sql.DB) (res []dbtypes.DeletionSummary, 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 {
height, hash, err = RetrieveBestBlock(ctx, db)
return
}
for i := int64(0); i < N; i... | go | func DeleteBlocks(ctx context.Context, N int64, db *sql.DB) (res []dbtypes.DeletionSummary, 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 {
height, hash, err = RetrieveBestBlock(ctx, db)
return
}
for i := int64(0); i < N; i... | [
"func",
"DeleteBlocks",
"(",
"ctx",
"context",
".",
"Context",
",",
"N",
"int64",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"res",
"[",
"]",
"dbtypes",
".",
"DeletionSummary",
",",
"height",
"int64",
",",
"hash",
"string",
",",
"err",
"error",
")",... | // DeleteBlocks removes all data for the N best blocks in the DB from every
// table via repeated calls to DeleteBestBlock. | [
"DeleteBlocks",
"removes",
"all",
"data",
"for",
"the",
"N",
"best",
"blocks",
"in",
"the",
"DB",
"from",
"every",
"table",
"via",
"repeated",
"calls",
"to",
"DeleteBestBlock",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/rewind.go#L275-L299 |
141,997 | decred/dcrdata | version/version.go | normalizeSemString | func normalizeSemString(str, alphabet string) string {
var result bytes.Buffer
for _, r := range str {
if strings.ContainsRune(alphabet, r) {
result.WriteRune(r)
}
}
return result.String()
} | go | func normalizeSemString(str, alphabet string) string {
var result bytes.Buffer
for _, r := range str {
if strings.ContainsRune(alphabet, r) {
result.WriteRune(r)
}
}
return result.String()
} | [
"func",
"normalizeSemString",
"(",
"str",
",",
"alphabet",
"string",
")",
"string",
"{",
"var",
"result",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"str",
"{",
"if",
"strings",
".",
"ContainsRune",
"(",
"alphabet",
",",
"r",
")... | // normalizeSemString returns the passed string stripped of all characters
// which are not valid according to the provided semantic versioning alphabet. | [
"normalizeSemString",
"returns",
"the",
"passed",
"string",
"stripped",
"of",
"all",
"characters",
"which",
"are",
"not",
"valid",
"according",
"to",
"the",
"provided",
"semantic",
"versioning",
"alphabet",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/version/version.go#L74-L82 |
141,998 | decred/dcrdata | explorer/mempool.go | matchMempoolVins | func matchMempoolVins(txid string, txsList []types.MempoolTx) (vins []types.MempoolVin) {
for idx := range txsList {
tx := &txsList[idx]
var inputs []types.MempoolInput
for vindex := range tx.Vin {
input := &tx.Vin[vindex]
if input.TxId != txid {
continue
}
inputs = append(inputs, *input)
}
i... | go | func matchMempoolVins(txid string, txsList []types.MempoolTx) (vins []types.MempoolVin) {
for idx := range txsList {
tx := &txsList[idx]
var inputs []types.MempoolInput
for vindex := range tx.Vin {
input := &tx.Vin[vindex]
if input.TxId != txid {
continue
}
inputs = append(inputs, *input)
}
i... | [
"func",
"matchMempoolVins",
"(",
"txid",
"string",
",",
"txsList",
"[",
"]",
"types",
".",
"MempoolTx",
")",
"(",
"vins",
"[",
"]",
"types",
".",
"MempoolVin",
")",
"{",
"for",
"idx",
":=",
"range",
"txsList",
"{",
"tx",
":=",
"&",
"txsList",
"[",
"i... | // matchMempoolVins filters relevant mempool transaction inputs whose previous
// outpoints match the specified transaction id. | [
"matchMempoolVins",
"filters",
"relevant",
"mempool",
"transaction",
"inputs",
"whose",
"previous",
"outpoints",
"match",
"the",
"specified",
"transaction",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/mempool.go#L11-L31 |
141,999 | decred/dcrdata | explorer/mempool.go | GetTxMempoolInputs | func (exp *explorerUI) GetTxMempoolInputs(txid string, txType string) (vins []types.MempoolVin) {
// Lock the pointer from changing, and the contents of the shared struct.
inv := exp.MempoolInventory()
inv.RLock()
defer inv.RUnlock()
vins = append(vins, matchMempoolVins(txid, inv.Transactions)...)
vins = append(v... | go | func (exp *explorerUI) GetTxMempoolInputs(txid string, txType string) (vins []types.MempoolVin) {
// Lock the pointer from changing, and the contents of the shared struct.
inv := exp.MempoolInventory()
inv.RLock()
defer inv.RUnlock()
vins = append(vins, matchMempoolVins(txid, inv.Transactions)...)
vins = append(v... | [
"func",
"(",
"exp",
"*",
"explorerUI",
")",
"GetTxMempoolInputs",
"(",
"txid",
"string",
",",
"txType",
"string",
")",
"(",
"vins",
"[",
"]",
"types",
".",
"MempoolVin",
")",
"{",
"// Lock the pointer from changing, and the contents of the shared struct.",
"inv",
":... | // GetTxMempoolInputs grabs very simple information about mempool transaction
// inputs that spend a particular previous transaction's outputs. The returned
// slice has just enough information to match an unspent transaction output. | [
"GetTxMempoolInputs",
"grabs",
"very",
"simple",
"information",
"about",
"mempool",
"transaction",
"inputs",
"that",
"spend",
"a",
"particular",
"previous",
"transaction",
"s",
"outputs",
".",
"The",
"returned",
"slice",
"has",
"just",
"enough",
"information",
"to",... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/mempool.go#L36-L46 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.