id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
19,900 | 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 |
19,901 | 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 |
19,902 | 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 |
19,903 | 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 |
19,904 | 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 |
19,905 | 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 |
19,906 | 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 |
19,907 | 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 |
19,908 | 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 |
19,909 | 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 |
19,910 | 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 |
19,911 | 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 |
19,912 | 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 |
19,913 | 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 |
19,914 | 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 |
19,915 | 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 |
19,916 | 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 |
19,917 | 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 |
19,918 | 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 |
19,919 | 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 |
19,920 | 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 |
19,921 | 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 |
19,922 | 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 |
19,923 | 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 |
19,924 | 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 |
19,925 | 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 |
19,926 | 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 |
19,927 | 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 |
19,928 | 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 |
19,929 | 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 |
19,930 | 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 |
19,931 | 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 |
19,932 | 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 |
19,933 | 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 |
19,934 | 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 |
19,935 | 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 |
19,936 | 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 |
19,937 | 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 |
19,938 | 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 |
19,939 | 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 |
19,940 | 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 |
19,941 | 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 |
19,942 | 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 |
19,943 | 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 |
19,944 | 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 |
19,945 | 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 |
19,946 | 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 |
19,947 | 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 |
19,948 | 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 |
19,949 | 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 |
19,950 | 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 |
19,951 | 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 |
19,952 | 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 |
19,953 | 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 |
19,954 | 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 |
19,955 | 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 |
19,956 | 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 |
19,957 | 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 |
19,958 | 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 |
19,959 | 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 |
19,960 | 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 |
19,961 | 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 |
19,962 | 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 |
19,963 | 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 |
19,964 | 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 |
19,965 | 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 |
19,966 | 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 |
19,967 | 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 |
19,968 | 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 |
19,969 | 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 |
19,970 | 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 |
19,971 | 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 |
19,972 | 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 |
19,973 | 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 |
19,974 | 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 |
19,975 | 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 |
19,976 | 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 |
19,977 | 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 |
19,978 | 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 |
19,979 | 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 |
19,980 | 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 |
19,981 | 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 |
19,982 | 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 |
19,983 | 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 |
19,984 | decred/dcrdata | db/dcrsqlite/chainmonitor.go | switchToSideChain | func (p *ChainMonitor) switchToSideChain(reorgData *txhelpers.ReorgData) (int32, *chainhash.Hash, error) {
if reorgData == nil || len(reorgData.NewChain) == 0 {
return 0, nil, fmt.Errorf("no side chain")
}
newChain := reorgData.NewChain
// newChain does not include the common ancestor.
commonAncestorHeight := i... | go | func (p *ChainMonitor) switchToSideChain(reorgData *txhelpers.ReorgData) (int32, *chainhash.Hash, error) {
if reorgData == nil || len(reorgData.NewChain) == 0 {
return 0, nil, fmt.Errorf("no side chain")
}
newChain := reorgData.NewChain
// newChain does not include the common ancestor.
commonAncestorHeight := i... | [
"func",
"(",
"p",
"*",
"ChainMonitor",
")",
"switchToSideChain",
"(",
"reorgData",
"*",
"txhelpers",
".",
"ReorgData",
")",
"(",
"int32",
",",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"if",
"reorgData",
"==",
"nil",
"||",
"len",
"(",
"reo... | // switchToSideChain attempts to switch to a side chain by collecting data for
// each block in the side chain, and saving it as the new mainchain in sqlite. | [
"switchToSideChain",
"attempts",
"to",
"switch",
"to",
"a",
"side",
"chain",
"by",
"collecting",
"data",
"for",
"each",
"block",
"in",
"the",
"side",
"chain",
"and",
"saving",
"it",
"as",
"the",
"new",
"mainchain",
"in",
"sqlite",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/chainmonitor.go#L46-L106 |
19,985 | decred/dcrdata | db/dcrpg/queries.go | SetDBBestBlock | func SetDBBestBlock(db *sql.DB, hash string, height int64) error {
numRows, err := sqlExec(db, internal.SetMetaDBBestBlock,
"failed to update best block in meta table: ", height, hash)
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("failed to update exactly 1 row in meta table (%d)",
numR... | go | func SetDBBestBlock(db *sql.DB, hash string, height int64) error {
numRows, err := sqlExec(db, internal.SetMetaDBBestBlock,
"failed to update best block in meta table: ", height, hash)
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("failed to update exactly 1 row in meta table (%d)",
numR... | [
"func",
"SetDBBestBlock",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"hash",
"string",
",",
"height",
"int64",
")",
"error",
"{",
"numRows",
",",
"err",
":=",
"sqlExec",
"(",
"db",
",",
"internal",
".",
"SetMetaDBBestBlock",
",",
"\"",
"\"",
",",
"height",... | // SetDBBestBlock sets the best block hash and height in the meta table. | [
"SetDBBestBlock",
"sets",
"the",
"best",
"block",
"hash",
"and",
"height",
"in",
"the",
"meta",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L46-L57 |
19,986 | decred/dcrdata | db/dcrpg/queries.go | closeRows | func closeRows(rows *sql.Rows) {
if e := rows.Close(); e != nil {
log.Errorf("Close of Query failed: %v", e)
}
} | go | func closeRows(rows *sql.Rows) {
if e := rows.Close(); e != nil {
log.Errorf("Close of Query failed: %v", e)
}
} | [
"func",
"closeRows",
"(",
"rows",
"*",
"sql",
".",
"Rows",
")",
"{",
"if",
"e",
":=",
"rows",
".",
"Close",
"(",
")",
";",
"e",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
")",
"\n",
"}",
"\n",
"}"
] | // Maintenance functions
// closeRows closes the input sql.Rows, logging any error. | [
"Maintenance",
"functions",
"closeRows",
"closes",
"the",
"input",
"sql",
".",
"Rows",
"logging",
"any",
"error",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L99-L103 |
19,987 | decred/dcrdata | db/dcrpg/queries.go | sqlExec | func sqlExec(db SqlExecutor, stmt, execErrPrefix string, args ...interface{}) (int64, error) {
res, err := db.Exec(stmt, args...)
if err != nil {
return 0, fmt.Errorf(execErrPrefix + " " + err.Error())
}
if res == nil {
return 0, nil
}
var N int64
N, err = res.RowsAffected()
if err != nil {
return 0, fmt... | go | func sqlExec(db SqlExecutor, stmt, execErrPrefix string, args ...interface{}) (int64, error) {
res, err := db.Exec(stmt, args...)
if err != nil {
return 0, fmt.Errorf(execErrPrefix + " " + err.Error())
}
if res == nil {
return 0, nil
}
var N int64
N, err = res.RowsAffected()
if err != nil {
return 0, fmt... | [
"func",
"sqlExec",
"(",
"db",
"SqlExecutor",
",",
"stmt",
",",
"execErrPrefix",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"int64",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"db",
".",
"Exec",
"(",
"stmt",
",",
"args",
".... | // sqlExec executes the SQL statement string with any optional arguments, and
// returns the nuber of rows affected. | [
"sqlExec",
"executes",
"the",
"SQL",
"statement",
"string",
"with",
"any",
"optional",
"arguments",
"and",
"returns",
"the",
"nuber",
"of",
"rows",
"affected",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L112-L127 |
19,988 | decred/dcrdata | db/dcrpg/queries.go | sqlExecStmt | func sqlExecStmt(stmt *sql.Stmt, execErrPrefix string, args ...interface{}) (int64, error) {
res, err := stmt.Exec(args...)
if err != nil {
return 0, fmt.Errorf("%v %v", execErrPrefix, err)
}
if res == nil {
return 0, nil
}
var N int64
N, err = res.RowsAffected()
if err != nil {
return 0, fmt.Errorf(`err... | go | func sqlExecStmt(stmt *sql.Stmt, execErrPrefix string, args ...interface{}) (int64, error) {
res, err := stmt.Exec(args...)
if err != nil {
return 0, fmt.Errorf("%v %v", execErrPrefix, err)
}
if res == nil {
return 0, nil
}
var N int64
N, err = res.RowsAffected()
if err != nil {
return 0, fmt.Errorf(`err... | [
"func",
"sqlExecStmt",
"(",
"stmt",
"*",
"sql",
".",
"Stmt",
",",
"execErrPrefix",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"int64",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"args",
"...",
")"... | // sqlExecStmt executes the prepared SQL statement with any optional arguments,
// and returns the nuber of rows affected. | [
"sqlExecStmt",
"executes",
"the",
"prepared",
"SQL",
"statement",
"with",
"any",
"optional",
"arguments",
"and",
"returns",
"the",
"nuber",
"of",
"rows",
"affected",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L131-L146 |
19,989 | decred/dcrdata | db/dcrpg/queries.go | ExistsIndex | func ExistsIndex(db *sql.DB, indexName string) (exists bool, err error) {
err = db.QueryRow(internal.IndexExists, indexName, "public").Scan(&exists)
if err == sql.ErrNoRows {
err = nil
}
return
} | go | func ExistsIndex(db *sql.DB, indexName string) (exists bool, err error) {
err = db.QueryRow(internal.IndexExists, indexName, "public").Scan(&exists)
if err == sql.ErrNoRows {
err = nil
}
return
} | [
"func",
"ExistsIndex",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"indexName",
"string",
")",
"(",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRow",
"(",
"internal",
".",
"IndexExists",
",",
"indexName",
",",
"\"",
"\"",... | // ExistsIndex checks if the specified index name exists. | [
"ExistsIndex",
"checks",
"if",
"the",
"specified",
"index",
"name",
"exists",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L149-L155 |
19,990 | decred/dcrdata | db/dcrpg/queries.go | IsUniqueIndex | func IsUniqueIndex(db *sql.DB, indexName string) (isUnique bool, err error) {
err = db.QueryRow(internal.IndexIsUnique, indexName, "public").Scan(&isUnique)
return
} | go | func IsUniqueIndex(db *sql.DB, indexName string) (isUnique bool, err error) {
err = db.QueryRow(internal.IndexIsUnique, indexName, "public").Scan(&isUnique)
return
} | [
"func",
"IsUniqueIndex",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"indexName",
"string",
")",
"(",
"isUnique",
"bool",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRow",
"(",
"internal",
".",
"IndexIsUnique",
",",
"indexName",
",",
"\"",
... | // IsUniqueIndex checks if the given index name is defined as UNIQUE. | [
"IsUniqueIndex",
"checks",
"if",
"the",
"given",
"index",
"name",
"is",
"defined",
"as",
"UNIQUE",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L158-L161 |
19,991 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateVins | func DeleteDuplicateVins(db *sql.DB) (int64, error) {
execErrPrefix := "failed to delete duplicate vins: "
existsIdx, err := ExistsIndex(db, "uix_vin")
if err != nil {
return 0, err
} else if !existsIdx {
return sqlExec(db, internal.DeleteVinsDuplicateRows, execErrPrefix)
}
if isuniq, err := IsUniqueIndex(d... | go | func DeleteDuplicateVins(db *sql.DB) (int64, error) {
execErrPrefix := "failed to delete duplicate vins: "
existsIdx, err := ExistsIndex(db, "uix_vin")
if err != nil {
return 0, err
} else if !existsIdx {
return sqlExec(db, internal.DeleteVinsDuplicateRows, execErrPrefix)
}
if isuniq, err := IsUniqueIndex(d... | [
"func",
"DeleteDuplicateVins",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"execErrPrefix",
":=",
"\"",
"\"",
"\n\n",
"existsIdx",
",",
"err",
":=",
"ExistsIndex",
"(",
"db",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
... | // DeleteDuplicateVins deletes rows in vin with duplicate tx information,
// leaving the one row with the lowest id. | [
"DeleteDuplicateVins",
"deletes",
"rows",
"in",
"vin",
"with",
"duplicate",
"tx",
"information",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L165-L182 |
19,992 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateVouts | func DeleteDuplicateVouts(db *sql.DB) (int64, error) {
execErrPrefix := "failed to delete duplicate vouts: "
existsIdx, err := ExistsIndex(db, "uix_vout_txhash_ind")
if err != nil {
return 0, err
} else if !existsIdx {
return sqlExec(db, internal.DeleteVoutDuplicateRows, execErrPrefix)
}
if isuniq, err := I... | go | func DeleteDuplicateVouts(db *sql.DB) (int64, error) {
execErrPrefix := "failed to delete duplicate vouts: "
existsIdx, err := ExistsIndex(db, "uix_vout_txhash_ind")
if err != nil {
return 0, err
} else if !existsIdx {
return sqlExec(db, internal.DeleteVoutDuplicateRows, execErrPrefix)
}
if isuniq, err := I... | [
"func",
"DeleteDuplicateVouts",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"execErrPrefix",
":=",
"\"",
"\"",
"\n\n",
"existsIdx",
",",
"err",
":=",
"ExistsIndex",
"(",
"db",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
... | // DeleteDuplicateVouts deletes rows in vouts with duplicate tx information,
// leaving the one row with the lowest id. | [
"DeleteDuplicateVouts",
"deletes",
"rows",
"in",
"vouts",
"with",
"duplicate",
"tx",
"information",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L186-L203 |
19,993 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateTxns | func DeleteDuplicateTxns(db *sql.DB) (int64, error) {
execErrPrefix := "failed to delete duplicate transactions: "
existsIdx, err := ExistsIndex(db, "uix_tx_hashes")
if err != nil {
return 0, err
} else if !existsIdx {
return sqlExec(db, internal.DeleteTxDuplicateRows, execErrPrefix)
}
if isuniq, err := IsU... | go | func DeleteDuplicateTxns(db *sql.DB) (int64, error) {
execErrPrefix := "failed to delete duplicate transactions: "
existsIdx, err := ExistsIndex(db, "uix_tx_hashes")
if err != nil {
return 0, err
} else if !existsIdx {
return sqlExec(db, internal.DeleteTxDuplicateRows, execErrPrefix)
}
if isuniq, err := IsU... | [
"func",
"DeleteDuplicateTxns",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"execErrPrefix",
":=",
"\"",
"\"",
"\n\n",
"existsIdx",
",",
"err",
":=",
"ExistsIndex",
"(",
"db",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
... | // DeleteDuplicateTxns deletes rows in transactions with duplicate tx-block
// hashes, leaving the one row with the lowest id. | [
"DeleteDuplicateTxns",
"deletes",
"rows",
"in",
"transactions",
"with",
"duplicate",
"tx",
"-",
"block",
"hashes",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L207-L224 |
19,994 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateTickets | func DeleteDuplicateTickets(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_ticket_hashes_index"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate tickets: "
return sqlExec(db, internal.DeleteTicketsDuplica... | go | func DeleteDuplicateTickets(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_ticket_hashes_index"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate tickets: "
return sqlExec(db, internal.DeleteTicketsDuplica... | [
"func",
"DeleteDuplicateTickets",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"isuniq",
",",
"err",
":=",
"IsUniqueIndex",
"(",
"db",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"sql",
... | // DeleteDuplicateTickets deletes rows in tickets with duplicate tx-block
// hashes, leaving the one row with the lowest id. | [
"DeleteDuplicateTickets",
"deletes",
"rows",
"in",
"tickets",
"with",
"duplicate",
"tx",
"-",
"block",
"hashes",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L228-L236 |
19,995 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateVotes | func DeleteDuplicateVotes(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_votes_hashes_index"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate votes: "
return sqlExec(db, internal.DeleteVotesDuplicateRows,... | go | func DeleteDuplicateVotes(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_votes_hashes_index"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate votes: "
return sqlExec(db, internal.DeleteVotesDuplicateRows,... | [
"func",
"DeleteDuplicateVotes",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"isuniq",
",",
"err",
":=",
"IsUniqueIndex",
"(",
"db",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"sql",
".... | // DeleteDuplicateVotes deletes rows in votes with duplicate tx-block hashes,
// leaving the one row with the lowest id. | [
"DeleteDuplicateVotes",
"deletes",
"rows",
"in",
"votes",
"with",
"duplicate",
"tx",
"-",
"block",
"hashes",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L240-L248 |
19,996 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateMisses | func DeleteDuplicateMisses(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_misses_hashes_index"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate misses: "
return sqlExec(db, internal.DeleteMissesDuplicateR... | go | func DeleteDuplicateMisses(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_misses_hashes_index"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate misses: "
return sqlExec(db, internal.DeleteMissesDuplicateR... | [
"func",
"DeleteDuplicateMisses",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"isuniq",
",",
"err",
":=",
"IsUniqueIndex",
"(",
"db",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"sql",
"... | // DeleteDuplicateMisses deletes rows in misses with duplicate tx-block hashes,
// leaving the one row with the lowest id. | [
"DeleteDuplicateMisses",
"deletes",
"rows",
"in",
"misses",
"with",
"duplicate",
"tx",
"-",
"block",
"hashes",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L252-L260 |
19,997 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateAgendas | func DeleteDuplicateAgendas(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_agendas_name"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate agendas: "
return sqlExec(db, internal.DeleteAgendasDuplicateRows,... | go | func DeleteDuplicateAgendas(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_agendas_name"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate agendas: "
return sqlExec(db, internal.DeleteAgendasDuplicateRows,... | [
"func",
"DeleteDuplicateAgendas",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"isuniq",
",",
"err",
":=",
"IsUniqueIndex",
"(",
"db",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"sql",
... | // DeleteDuplicateAgendas deletes rows in agendas with duplicate names leaving
// the one row with the lowest id. | [
"DeleteDuplicateAgendas",
"deletes",
"rows",
"in",
"agendas",
"with",
"duplicate",
"names",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L264-L272 |
19,998 | decred/dcrdata | db/dcrpg/queries.go | DeleteDuplicateAgendaVotes | func DeleteDuplicateAgendaVotes(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_agenda_votes"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate agenda_votes: "
return sqlExec(db, internal.DeleteAgendaVotesD... | go | func DeleteDuplicateAgendaVotes(db *sql.DB) (int64, error) {
if isuniq, err := IsUniqueIndex(db, "uix_agenda_votes"); err != nil && err != sql.ErrNoRows {
return 0, err
} else if isuniq {
return 0, nil
}
execErrPrefix := "failed to delete duplicate agenda_votes: "
return sqlExec(db, internal.DeleteAgendaVotesD... | [
"func",
"DeleteDuplicateAgendaVotes",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"isuniq",
",",
"err",
":=",
"IsUniqueIndex",
"(",
"db",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"sql"... | // DeleteDuplicateAgendaVotes deletes rows in agenda_votes with duplicate
// votes-row-id and agendas-row-id leaving the one row with the lowest id. | [
"DeleteDuplicateAgendaVotes",
"deletes",
"rows",
"in",
"agenda_votes",
"with",
"duplicate",
"votes",
"-",
"row",
"-",
"id",
"and",
"agendas",
"-",
"row",
"-",
"id",
"leaving",
"the",
"one",
"row",
"with",
"the",
"lowest",
"id",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L276-L284 |
19,999 | decred/dcrdata | db/dcrpg/queries.go | RetrieveMissedVotesInBlock | func RetrieveMissedVotesInBlock(ctx context.Context, db *sql.DB, blockHash string) (ticketHashes []string, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectMissesInBlock, blockHash)
if err != nil {
return nil, err
}
defer closeRows(rows)
for rows.Next() {
var hash string
err... | go | func RetrieveMissedVotesInBlock(ctx context.Context, db *sql.DB, blockHash string) (ticketHashes []string, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectMissesInBlock, blockHash)
if err != nil {
return nil, err
}
defer closeRows(rows)
for rows.Next() {
var hash string
err... | [
"func",
"RetrieveMissedVotesInBlock",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
")",
"(",
"ticketHashes",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"var",
"rows",
"*",
"sql",
".",
"Row... | // RetrieveMissedVotesInBlock gets a list of ticket hashes that were called to
// vote in the given block, but missed their vote. | [
"RetrieveMissedVotesInBlock",
"gets",
"a",
"list",
"of",
"ticket",
"hashes",
"that",
"were",
"called",
"to",
"vote",
"in",
"the",
"given",
"block",
"but",
"missed",
"their",
"vote",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L661-L680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.