Versions in this module Expand all Collapse all v3 v3.1.1 Jul 23, 2019 Changes in this version + func AnalyzeAllTables(db *sql.DB, statisticsTarget int) error + func AnalyzeTable(db *sql.DB, table string, statisticsTarget int) error + func CheckColumnDataType(db *sql.DB, table, column string) (dataType string, err error) + func CheckCurrentTimeZone(db *sql.DB) (currentTZ string, err error) + func CheckDefaultTimeZone(db *sql.DB) (defaultTZ, currentTZ string, err error) + func ClearTestingTable(db *sql.DB) error + func Connect(host, port, user, pass, dbname string) (*sql.DB, error) + func CountMergedFundingTxns(ctx context.Context, db *sql.DB, address string) (count int64, err error) + func CountMergedSpendingTxns(ctx context.Context, db *sql.DB, address string) (count int64, err error) + func CountMergedTxns(ctx context.Context, db *sql.DB, address string) (count int64, err error) + func CreateTable(db *sql.DB, tableName string) error + func CreateTableLegacy(db *sql.DB, tableName string) error + func CreateTables(db *sql.DB) error + func CreateTablesLegacy(db *sql.DB) error + func DBBestBlock(ctx context.Context, db *sql.DB) (hash string, height int64, err error) + func DeindexAddressTableOnAddress(db *sql.DB) (err error) + func DeindexAddressTableOnTxHash(db *sql.DB) (err error) + func DeindexAddressTableOnVoutID(db *sql.DB) (err error) + func DeindexAgendaVotesTableOnAgendaID(db *sql.DB) (err error) + func DeindexAgendasTableOnAgendaID(db *sql.DB) (err error) + func DeindexBlockTableOnHash(db *sql.DB) (err error) + func DeindexBlockTableOnHeight(db *sql.DB) (err error) + func DeindexBlockTimeOnTableAddress(db *sql.DB) (err error) + func DeindexMatchingTxHashOnTableAddress(db *sql.DB) (err error) + func DeindexMissesTableOnHash(db *sql.DB) (err error) + func DeindexProposalVotesTableOnProposalsID(db *sql.DB) (err error) + func DeindexProposalsTableOnToken(db *sql.DB) (err error) + func DeindexTicketsTableOnHashes(db *sql.DB) (err error) + func DeindexTicketsTableOnPoolStatus(db *sql.DB) (err error) + func DeindexTicketsTableOnTxDbID(db *sql.DB) (err error) + func DeindexTransactionTableOnBlockIn(db *sql.DB) (err error) + func DeindexTransactionTableOnHashes(db *sql.DB) (err error) + func DeindexVinTableOnPrevOuts(db *sql.DB) (err error) + func DeindexVinTableOnVins(db *sql.DB) (err error) + func DeindexVotesTableOnBlockHash(db *sql.DB) (err error) + func DeindexVotesTableOnBlockTime(db *sql.DB) (err error) + func DeindexVotesTableOnCandidate(db *sql.DB) (err error) + func DeindexVotesTableOnHash(db *sql.DB) (err error) + func DeindexVotesTableOnHeight(db *sql.DB) (err error) + func DeindexVotesTableOnVoteVersion(db *sql.DB) (err error) + func DeindexVoutTableOnTxHashIdx(db *sql.DB) (err error) + func DeleteBestBlock(ctx context.Context, db *sql.DB) (res dbtypes.DeletionSummary, height int64, hash string, err error) + func DeleteBlockData(ctx context.Context, db *sql.DB, hash string) (res dbtypes.DeletionSummary, err error) + func DeleteBlocks(ctx context.Context, N int64, db *sql.DB) (res []dbtypes.DeletionSummary, height int64, hash string, err error) + func DeleteDuplicateAgendaVotes(db *sql.DB) (int64, error) + func DeleteDuplicateAgendas(db *sql.DB) (int64, error) + func DeleteDuplicateMisses(db *sql.DB) (int64, error) + func DeleteDuplicateTickets(db *sql.DB) (int64, error) + func DeleteDuplicateTxns(db *sql.DB) (int64, error) + func DeleteDuplicateVins(db *sql.DB) (int64, error) + func DeleteDuplicateVinsCockroach(db *sql.DB) (int64, error) + func DeleteDuplicateVotes(db *sql.DB) (int64, error) + func DeleteDuplicateVouts(db *sql.DB) (int64, error) + func DeleteDuplicateVoutsCockroach(db *sql.DB) (int64, error) + func DisableLog() + func DropTables(db *sql.DB) + func DropTestingTable(db SqlExecutor) error + func ExistsIndex(db *sql.DB, indexName string) (exists bool, err error) + func IBDComplete(db *sql.DB) (ibdComplete bool, err error) + func IndexAddressTableOnAddress(db *sql.DB) (err error) + func IndexAddressTableOnTxHash(db *sql.DB) (err error) + func IndexAddressTableOnVoutID(db *sql.DB) (err error) + func IndexAgendaVotesTableOnAgendaID(db *sql.DB) (err error) + func IndexAgendasTableOnAgendaID(db *sql.DB) (err error) + func IndexBlockTableOnHash(db *sql.DB) (err error) + func IndexBlockTableOnHeight(db *sql.DB) (err error) + func IndexBlockTimeOnTableAddress(db *sql.DB) (err error) + func IndexMatchingTxHashOnTableAddress(db *sql.DB) (err error) + func IndexMissesTableOnHashes(db *sql.DB) (err error) + func IndexProposalVotesTableOnProposalsID(db *sql.DB) (err error) + func IndexProposalsTableOnToken(db *sql.DB) (err error) + func IndexTicketsTableOnHashes(db *sql.DB) (err error) + func IndexTicketsTableOnPoolStatus(db *sql.DB) (err error) + func IndexTicketsTableOnTxDbID(db *sql.DB) (err error) + func IndexTransactionTableOnBlockIn(db *sql.DB) (err error) + func IndexTransactionTableOnHashes(db *sql.DB) (err error) + func IndexVinTableOnPrevOuts(db *sql.DB) (err error) + func IndexVinTableOnVins(db *sql.DB) (err error) + func IndexVotesTableOnBlockHash(db *sql.DB) (err error) + func IndexVotesTableOnBlockTime(db *sql.DB) (err error) + func IndexVotesTableOnCandidate(db *sql.DB) (err error) + func IndexVotesTableOnHashes(db *sql.DB) (err error) + func IndexVotesTableOnHeight(db *sql.DB) (err error) + func IndexVotesTableOnVoteVersion(db *sql.DB) (err error) + func IndexVoutTableOnTxHashIdx(db *sql.DB) (err error) + func InsertAddressRow(db *sql.DB, dbA *dbtypes.AddressRow, dupCheck, updateExistingRecords bool) (uint64, error) + func InsertAddressRows(db *sql.DB, dbAs []*dbtypes.AddressRow, dupCheck, updateExistingRecords bool) ([]uint64, error) + func InsertAddressRowsDbTx(dbTx *sql.Tx, dbAs []*dbtypes.AddressRow, dupCheck, updateExistingRecords bool) ([]uint64, error) + func InsertBlock(db *sql.DB, dbBlock *dbtypes.Block, isValid, isMainchain, checked bool) (uint64, error) + func InsertBlockPrevNext(db *sql.DB, blockDbID uint64, hash, prev, next string) error + func InsertProposal(db *sql.DB, tokenHash, author, commit string, timestamp time.Time, ...) (uint64, error) + func InsertProposalVote(db *sql.DB, proposalRowID uint64, ticket, choice string, checked bool) (uint64, error) + func InsertSpendingAddressRow(db *sql.DB, fundingTxHash string, fundingTxVoutIndex uint32, ...) (int64, error) + func InsertTickets(db *sql.DB, dbTxns []*dbtypes.Tx, txDbIDs []uint64, ...) ([]uint64, []*dbtypes.Tx, error) + func InsertTx(db *sql.DB, dbTx *dbtypes.Tx, checked, updateExistingRecords bool) (uint64, error) + func InsertTxns(db *sql.DB, dbTxns []*dbtypes.Tx, checked, updateExistingRecords bool) ([]uint64, error) + func InsertTxnsDbTxn(dbTx *sql.Tx, dbTxns []*dbtypes.Tx, checked, updateExistingRecords bool) ([]uint64, error) + func InsertTxnsStmt(stmt *sql.Stmt, dbTxns []*dbtypes.Tx, checked, updateExistingRecords bool) ([]uint64, error) + func InsertVin(db *sql.DB, dbVin dbtypes.VinTxProperty, checked bool, ...) (id uint64, err error) + func InsertVins(db *sql.DB, dbVins dbtypes.VinTxPropertyARRAY, checked bool, ...) ([]uint64, error) + func InsertVinsDbTxn(dbTx *sql.Tx, dbVins dbtypes.VinTxPropertyARRAY, checked bool, doUpsert bool) ([]uint64, error) + func InsertVinsStmt(stmt *sql.Stmt, dbVins dbtypes.VinTxPropertyARRAY, checked bool, doUpsert bool) ([]uint64, error) + func InsertVotes(db *sql.DB, dbTxns []*dbtypes.Tx, _ []uint64, fTx *TicketTxnIDGetter, ...) ([]uint64, []*dbtypes.Tx, []string, []uint64, map[string]uint64, error) + func InsertVout(db *sql.DB, dbVout *dbtypes.Vout, checked bool, updateOnConflict ...bool) (uint64, error) + func InsertVouts(db *sql.DB, dbVouts []*dbtypes.Vout, checked bool, updateOnConflict ...bool) ([]uint64, []dbtypes.AddressRow, error) + func InsertVoutsDbTxn(dbTx *sql.Tx, dbVouts []*dbtypes.Vout, checked bool, doUpsert bool) ([]uint64, []dbtypes.AddressRow, error) + func InsertVoutsStmt(stmt *sql.Stmt, dbVouts []*dbtypes.Vout, checked bool, doUpsert bool) ([]uint64, []dbtypes.AddressRow, error) + func IsRetryError(err error) bool + func IsUniqueIndex(db *sql.DB, indexName string) (isUnique bool, err error) + func MakeCsvAddressRows(rows []*dbtypes.AddressRow) [][]string + func MakeCsvAddressRowsCompact(rows []*dbtypes.AddressRowCompact) [][]string + func RetrieveAddressBalance(ctx context.Context, db *sql.DB, address string) (balance *dbtypes.AddressBalance, err error) + func RetrieveAddressCreditTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) + func RetrieveAddressDbUTXOs(ctx context.Context, db *sql.DB, address string) ([]*dbtypes.AddressTxnOutput, error) + func RetrieveAddressDebitTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) + func RetrieveAddressIDsByOutpoint(ctx context.Context, db *sql.DB, txHash string, voutIndex uint32) ([]uint64, []string, int64, error) + func RetrieveAddressMergedCreditTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) + func RetrieveAddressMergedDebitTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) + func RetrieveAddressMergedTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) + func RetrieveAddressSpent(ctx context.Context, db *sql.DB, address string) (count, totalAmount int64, err error) + func RetrieveAddressTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) + func RetrieveAddressTxnsOrdered(ctx context.Context, db *sql.DB, addresses []string, recentBlockTime int64) (txs, recenttxs []chainhash.Hash, err error) + func RetrieveAddressUTXOs(ctx context.Context, db *sql.DB, address string, currentBlockHeight int64) ([]*apitypes.AddressTxnOutput, error) + func RetrieveAddressUnspent(ctx context.Context, db *sql.DB, address string) (count, totalAmount int64, err error) + func RetrieveAllAddressMergedTxns(ctx context.Context, db *sql.DB, address string, onlyValidMainchain bool) ([]uint64, []*dbtypes.AddressRow, error) + func RetrieveAllAddressTxns(ctx context.Context, db *sql.DB, address string) ([]*dbtypes.AddressRow, error) + func RetrieveAllMainchainAddressTxns(ctx context.Context, db *sql.DB, address string) ([]*dbtypes.AddressRow, error) + func RetrieveAllRevokes(ctx context.Context, db *sql.DB) (ids []uint64, hashes []string, heights []int64, vinDbIDs []uint64, err error) + func RetrieveAllVinDbIDs(db *sql.DB) (vinDbIDs []uint64, err error) + func RetrieveAllVotesDbIDsHeightsTicketDbIDs(ctx context.Context, db *sql.DB) (ids []uint64, heights []int64, ticketDbIDs []uint64, err error) + func RetrieveBestBlock(ctx context.Context, db *sql.DB) (height int64, hash string, err error) + func RetrieveBestBlockHeight(ctx context.Context, db *sql.DB) (height uint64, hash string, id uint64, err error) + func RetrieveBestBlockHeightAny(ctx context.Context, db *sql.DB) (height uint64, hash string, id uint64, err error) + func RetrieveBlockChainDbID(ctx context.Context, db *sql.DB, hash string) (dbID uint64, err error) + func RetrieveBlockFlags(ctx context.Context, db *sql.DB, hash string) (isValid bool, isMainchain bool, err error) + func RetrieveBlockHash(ctx context.Context, db *sql.DB, idx int64) (hash string, err error) + func RetrieveBlockHeight(ctx context.Context, db *sql.DB, hash string) (height int64, err error) + func RetrieveBlockStatus(ctx context.Context, db *sql.DB, hash string) (bs dbtypes.BlockStatus, err error) + func RetrieveBlockSummaryByTimeRange(ctx context.Context, db *sql.DB, minTime, maxTime int64, limit int) ([]dbtypes.BlockDataBasic, error) + func RetrieveBlockTimeByHeight(ctx context.Context, db *sql.DB, idx int64) (time dbtypes.TimeDef, err error) + func RetrieveBlockVoteCount(ctx context.Context, db *sql.DB, hash string) (numVotes int16, err error) + func RetrieveBlocksHashesAll(ctx context.Context, db *sql.DB) ([]string, error) + func RetrieveDbTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64, dbTx *dbtypes.Tx, err error) + func RetrieveDbTxsByHash(ctx context.Context, db *sql.DB, txHash string) (ids []uint64, dbTxs []*dbtypes.Tx, err error) + func RetrieveDisapprovedBlocks(ctx context.Context, db *sql.DB) (blocks []*dbtypes.BlockStatus, err error) + func RetrieveFullTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64, blockHash string, blockHeight int64, ...) + func RetrieveFundingOutpointByTxIn(ctx context.Context, db *sql.DB, txHash string, vinIndex uint32) (id uint64, tx string, index uint32, tree int8, err error) + func RetrieveFundingOutpointByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, index uint32, tree int8, err error) + func RetrieveFundingOutpointIndxByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (idx uint32, err error) + func RetrieveFundingTxByTxIn(ctx context.Context, db *sql.DB, txHash string, vinIndex uint32) (id uint64, tx string, err error) + func RetrieveFundingTxByVinDbID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, err error) + func RetrieveFundingTxsByTx(db *sql.DB, txHash string) ([]uint64, []*dbtypes.Tx, error) + func RetrieveMissForTicket(ctx context.Context, db *sql.DB, ticketHash string) (blockHash string, blockHeight int64, err error) + func RetrieveMissedVotesInBlock(ctx context.Context, db *sql.DB, blockHash string) (ticketHashes []string, err error) + func RetrieveMissesForTicket(ctx context.Context, db *sql.DB, ticketHash string) (blockHashes []string, blockHeights []int64, err error) + func RetrievePGVersion(db *sql.DB) (ver string, err error) + func RetrievePkScriptByOutpoint(ctx context.Context, db *sql.DB, txHash string, voutIndex uint32) (pkScript []byte, ver uint16, err error) + func RetrievePkScriptByVinID(ctx context.Context, db *sql.DB, vinID uint64) (pkScript []byte, ver uint16, err error) + func RetrievePkScriptByVoutID(ctx context.Context, db *sql.DB, voutID uint64) (pkScript []byte, ver uint16, err error) + func RetrievePreviousHashByBlockHash(ctx context.Context, db *sql.DB, hash string) (previousHash string, err error) + func RetrieveSideChainBlocks(ctx context.Context, db *sql.DB) (blocks []*dbtypes.BlockStatus, err error) + func RetrieveSideChainTips(ctx context.Context, db *sql.DB) (blocks []*dbtypes.BlockStatus, err error) + func RetrieveSpendingTxByTxOut(ctx context.Context, db *sql.DB, txHash string, voutIndex uint32) (id uint64, tx string, vin uint32, tree int8, err error) + func RetrieveSpendingTxByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, vinIndex uint32, tree int8, err error) + func RetrieveSpendingTxsByFundingTx(ctx context.Context, db *sql.DB, fundingTxID string) (dbIDs []uint64, txns []string, vinInds []uint32, voutInds []uint32, err error) + func RetrieveSpendingTxsByFundingTxWithBlockHeight(ctx context.Context, db *sql.DB, fundingTxID string) (aSpendByFunHash []*apitypes.SpendByFundingHash, err error) + func RetrieveSysSettingSyncCommit(db *sql.DB) (syncCommit string, err error) + func RetrieveTicketIDByHashNoCancel(db *sql.DB, ticketHash string) (id uint64, err error) + func RetrieveTicketIDsByHashes(ctx context.Context, db *sql.DB, ticketHashes []string) (ids []uint64, err error) + func RetrieveTicketInfoByHash(ctx context.Context, db *sql.DB, ticketHash string) (spendStatus dbtypes.TicketSpendType, poolStatus dbtypes.TicketPoolStatus, ...) + func RetrieveTicketStatusByHash(ctx context.Context, db *sql.DB, ticketHash string) (id uint64, spendStatus dbtypes.TicketSpendType, ...) + func RetrieveTxBlockTimeByHash(ctx context.Context, db *sql.DB, txHash string) (blockTime dbtypes.TimeDef, err error) + func RetrieveTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64, blockHash string, blockInd uint32, tree int8, err error) + func RetrieveTxnsBlocks(ctx context.Context, db *sql.DB, txHash string) (blockHashes []string, blockHeights, blockIndexes []uint32, ...) + func RetrieveTxnsVinsByBlock(ctx context.Context, db *sql.DB, blockHash string) (vinDbIDs []dbtypes.UInt64Array, areValid []bool, areMainchain []bool, ...) + func RetrieveTxnsVinsVoutsByBlock(ctx context.Context, db *sql.DB, blockHash string, onlyRegular bool) (vinDbIDs, voutDbIDs []dbtypes.UInt64Array, areMainchain []bool, err error) + func RetrieveTxsBestBlockMainchain(ctx context.Context, db *sql.DB) (height int64, hash string, err error) + func RetrieveTxsBlocksAboveHeight(ctx context.Context, db *sql.DB, height int64) (heights []int64, hashes []string, err error) + func RetrieveTxsByBlockHash(ctx context.Context, db *sql.DB, blockHash string) (ids []uint64, txs []string, blockInds []uint32, trees []int8, ...) + func RetrieveUTXOs(ctx context.Context, db *sql.DB) ([]dbtypes.UTXO, error) + func RetrieveUnspentTickets(ctx context.Context, db *sql.DB) (ids []uint64, hashes []string, err error) + func RetrieveVinByID(ctx context.Context, db *sql.DB, vinDbID uint64) (prevOutHash string, prevOutVoutInd uint32, prevOutTree int8, txHash string, ...) + func RetrieveVinsByIDs(ctx context.Context, db *sql.DB, vinDbIDs []uint64) ([]dbtypes.VinTxProperty, error) + func RetrieveVoutIDByOutpoint(ctx context.Context, db *sql.DB, txHash string, voutIndex uint32) (id uint64, err error) + func RetrieveVoutValue(ctx context.Context, db *sql.DB, txHash string, voutIndex uint32) (value uint64, err error) + func RetrieveVoutValues(ctx context.Context, db *sql.DB, txHash string) (values []uint64, txInds []uint32, txTrees []int8, err error) + func RetrieveVoutsByIDs(ctx context.Context, db *sql.DB, voutDbIDs []uint64) ([]dbtypes.Vout, error) + func SetDBBestBlock(db *sql.DB, hash string, height int64) error + func SetIBDComplete(db SqlExecutor, ibdComplete bool) error + func SetMainchainByBlockHash(db *sql.DB, hash string, isMainchain bool) (previousHash string, err error) + func SetPoolStatusForTickets(db *sql.DB, ticketDbIDs []uint64, poolStatuses []dbtypes.TicketPoolStatus) (int64, error) + func SetPoolStatusForTicketsByHash(db *sql.DB, tickets []string, poolStatuses []dbtypes.TicketPoolStatus) (int64, error) + func SetSpendingForFundingOP(db SqlExecutor, fundingTxHash string, fundingTxVoutIndex uint32, ...) (int64, error) + func SetSpendingForTickets(db *sql.DB, ticketDbIDs, spendDbIDs []uint64, blockHeights []int64, ...) (int64, error) + func SetSpendingForVinDbID(db *sql.DB, vinDbID uint64) (int64, error) + func SetSpendingForVinDbIDs(db *sql.DB, vinDbIDs []uint64) ([]int64, int64, error) + func SetSynchronousCommit(db SqlExecutor, syncCommit string) error + func TableExists(db *sql.DB, tableName string) (bool, error) + func TableVersions(db *sql.DB) map[string]TableVersion + func TicketPoolData(interval dbtypes.TimeBasedGrouping, height int64) (timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, ...) + func UpdateAddressesMainchainByIDs(db SqlExecutor, vinsBlk, voutsBlk []dbtypes.UInt64Array, isValidMainchain bool) (numSpendingRows, numFundingRows int64, err error) + func UpdateBlockNext(db SqlExecutor, blockDbID uint64, next string) error + func UpdateBlockNextByHash(db SqlExecutor, this, next string) error + func UpdateBlockNextByNextHash(db SqlExecutor, currentNext, newNext string) error + func UpdateLastAddressesValid(db *sql.DB, blockHash string, isValid bool) error + func UpdateLastBlockValid(db SqlExecutor, blockDbID uint64, isValid bool) error + func UpdateLastVins(db *sql.DB, blockHash string, isValid, isMainchain bool) error + func UpdateTicketPoolData(interval dbtypes.TimeBasedGrouping, timeGraph *dbtypes.PoolTicketsData, ...) + func UpdateTicketsMainchain(db SqlExecutor, blockHash string, isMainchain bool) (int64, error) + func UpdateTransactionsMainchain(db *sql.DB, blockHash string, isMainchain bool) (int64, []uint64, error) + func UpdateTransactionsValid(db *sql.DB, blockHash string, isValid bool) (int64, []uint64, error) + func UpdateVotesMainchain(db SqlExecutor, blockHash string, isMainchain bool) (int64, error) + func UpgradeDatabase(db *sql.DB, bg BlockGetter) (bool, error) + func UseLogger(logger slog.Logger) + type BestBlock struct + func (block *BestBlock) Hash() *chainhash.Hash + func (block *BestBlock) HashStr() string + func (block *BestBlock) Height() int64 + type BlockGetter interface + GetBlockChainInfo func() (*dcrjson.GetBlockChainInfoResult, error) + type ChainDB struct + AddressCache *cache.AddressCache + CacheLocks cacheLocks + InBatchSync bool + InReorg bool + func NewChainDB(dbi *DBInfo, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase, ...) (*ChainDB, error) + func NewChainDBWithCancel(ctx context.Context, dbi *DBInfo, params *chaincfg.Params, ...) (*ChainDB, error) + func (pgb *ChainDB) AddressBalance(address string) (bal *dbtypes.AddressBalance, cacheUpdated bool, err error) + func (pgb *ChainDB) AddressHistory(address string, N, offset int64, txnView dbtypes.AddrTxnViewType) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error) + func (pgb *ChainDB) AddressHistoryAll(address string, N, offset int64) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error) + func (pgb *ChainDB) AddressIDsByOutpoint(txHash string, voutIndex uint32) ([]uint64, []string, int64, error) + func (pgb *ChainDB) AddressMetrics(addr string) (*dbtypes.AddressMetrics, error) + func (pgb *ChainDB) AddressRowsCompact(address string) ([]*dbtypes.AddressRowCompact, error) + func (pgb *ChainDB) AddressRowsMerged(address string) ([]*dbtypes.AddressRowMerged, error) + func (pgb *ChainDB) AddressTotals(address string) (*apitypes.AddressTotals, error) + func (pgb *ChainDB) AddressTransactionDetails(addr string, count, skip int64, txnType dbtypes.AddrTxnViewType) (*apitypes.Address, error) + func (pgb *ChainDB) AddressTransactionRawDetails(addr string, count, skip int64, txnType dbtypes.AddrTxnViewType) ([]*apitypes.AddressTxRaw, error) + func (pgb *ChainDB) AddressTransactions(address string, N, offset int64, txnType dbtypes.AddrTxnViewType) (addressRows []*dbtypes.AddressRow, err error) + func (pgb *ChainDB) AddressTransactionsAll(address string) (addressRows []*dbtypes.AddressRow, err error) + func (pgb *ChainDB) AddressTransactionsAllMerged(address string) (addressRows []*dbtypes.AddressRow, err error) + func (pgb *ChainDB) AddressTxIoCsv(address string) ([][]string, error) + func (pgb *ChainDB) AddressUTXO(address string) ([]*dbtypes.AddressTxnOutput, bool, error) + func (pgb *ChainDB) AgendaVoteCounts(agendaID string) (yes, abstain, no uint32, err error) + func (pgb *ChainDB) AgendaVotes(agendaID string, chartType int) (*dbtypes.AgendaVoteChoices, error) + func (pgb *ChainDB) AgendasVotesSummary(agendaID string) (summary *dbtypes.AgendaSummary, err error) + func (pgb *ChainDB) AllAgendas() (map[string]dbtypes.MileStone, error) + func (pgb *ChainDB) BestBlock() (*chainhash.Hash, int64) + func (pgb *ChainDB) BestBlockHash() *chainhash.Hash + func (pgb *ChainDB) BestBlockHashStr() string + func (pgb *ChainDB) BestBlockStr() (string, int64) + func (pgb *ChainDB) BlockChainDbID(hash string) (dbID uint64, err error) + func (pgb *ChainDB) BlockChainDbIDNoCancel(hash string) (dbID uint64, err error) + func (pgb *ChainDB) BlockFlags(hash string) (bool, bool, error) + func (pgb *ChainDB) BlockFlagsNoCancel(hash string) (bool, bool, error) + func (pgb *ChainDB) BlockHash(height int64) (string, error) + func (pgb *ChainDB) BlockHeight(hash string) (int64, error) + func (pgb *ChainDB) BlockMissedVotes(blockHash string) ([]string, error) + func (pgb *ChainDB) BlockStatus(hash string) (dbtypes.BlockStatus, error) + func (pgb *ChainDB) BlockSummaryTimeRange(min, max int64, limit int) ([]dbtypes.BlockDataBasic, error) + func (pgb *ChainDB) BlockTimeByHeight(height int64) (int64, error) + func (pgb *ChainDB) BlockTransactions(blockHash string) ([]string, []uint32, []int8, error) + func (pgb *ChainDB) ChainInfo() *dbtypes.BlockChainData + func (pgb *ChainDB) Close() error + func (pgb *ChainDB) CollectTicketSpendDBInfo(dbTxns []*dbtypes.Tx, txDbIDs []uint64, msgBlock *wire.MsgBlock, ...) (spendingTxDbIDs []uint64, spendTypes []dbtypes.TicketSpendType, ...) + func (pgb *ChainDB) CountTransactions(addr string, txnView dbtypes.AddrTxnViewType) (int, error) + func (pgb *ChainDB) DbTxByHash(txid string) (*dbtypes.Tx, error) + func (pgb *ChainDB) DeindexAddressTable() error + func (pgb *ChainDB) DeindexAll() error + func (pgb *ChainDB) DeindexTicketsTable() error + func (pgb *ChainDB) DeleteDuplicateAgendaVotes() (int64, error) + func (pgb *ChainDB) DeleteDuplicateAgendas() (int64, error) + func (pgb *ChainDB) DeleteDuplicateMisses() (int64, error) + func (pgb *ChainDB) DeleteDuplicateTickets() (int64, error) + func (pgb *ChainDB) DeleteDuplicateTxns() (int64, error) + func (pgb *ChainDB) DeleteDuplicateVins() (int64, error) + func (pgb *ChainDB) DeleteDuplicateVinsCockroach() (int64, error) + func (pgb *ChainDB) DeleteDuplicateVotes() (int64, error) + func (pgb *ChainDB) DeleteDuplicateVouts() (int64, error) + func (pgb *ChainDB) DeleteDuplicateVoutsCockroach() (int64, error) + func (pgb *ChainDB) DeleteDuplicates(barLoad chan *dbtypes.ProgressBarLoad) error + func (pgb *ChainDB) DeleteDuplicatesRecovery(barLoad chan *dbtypes.ProgressBarLoad) error + func (pgb *ChainDB) DevBalance() (*dbtypes.AddressBalance, error) + func (pgb *ChainDB) DisapprovedBlocks() ([]*dbtypes.BlockStatus, error) + func (pgb *ChainDB) DropTables() + func (pgb *ChainDB) EnableDuplicateCheckOnInsert(dupCheck bool) + func (pgb *ChainDB) FillAddressTransactions(addrInfo *dbtypes.AddressInfo) error + func (pgb *ChainDB) FreshenAddressCaches(lazyProjectFund bool, expireAddresses []string) error + func (pgb *ChainDB) FundingOutpointIndxByVinID(id uint64) (uint32, error) + func (pgb *ChainDB) GenesisStamp() int64 + func (pgb *ChainDB) GetBlockHash(idx int64) (string, error) + func (pgb *ChainDB) GetBlockHeight(hash string) (int64, error) + func (pgb *ChainDB) GetHeight() (int64, error) + func (pgb *ChainDB) GetTicketInfo(txid string) (*apitypes.TicketInfo, error) + func (pgb *ChainDB) HashDB() (string, error) + func (pgb *ChainDB) HashDBLegacy() (string, error) + func (pgb *ChainDB) Height() int64 + func (pgb *ChainDB) HeightDB() (int64, error) + func (pgb *ChainDB) HeightDBLegacy() (int64, error) + func (pgb *ChainDB) HeightHashDB() (int64, string, error) + func (pgb *ChainDB) HeightHashDBLegacy() (uint64, string, error) + func (pgb *ChainDB) IndexAddressTable(barLoad chan *dbtypes.ProgressBarLoad) error + func (pgb *ChainDB) IndexAll(barLoad chan *dbtypes.ProgressBarLoad) error + func (pgb *ChainDB) IndexTicketsTable(barLoad chan *dbtypes.ProgressBarLoad) error + func (pgb *ChainDB) InitUtxoCache(utxos []dbtypes.UTXO) + func (pgb *ChainDB) InsightAddressTransactions(addr []string, recentBlockHeight int64) (txs, recentTxs []chainhash.Hash, err error) + func (pgb *ChainDB) LastPiParserSync() time.Time + func (pgb *ChainDB) MissingAddressIndexes() (missing []string, descs []string, err error) + func (pgb *ChainDB) MissingIndexes() (missing, descs []string, err error) + func (pgb *ChainDB) NumAddressIntervals(addr string, grouping dbtypes.TimeBasedGrouping) (int64, error) + func (pgb *ChainDB) PiProposalsHistory() (int64, error) + func (pgb *ChainDB) PkScriptByVinID(id uint64) (pkScript []byte, ver uint16, err error) + func (pgb *ChainDB) PkScriptByVoutID(id uint64) (pkScript []byte, ver uint16, err error) + func (pgb *ChainDB) PoolStatusForTicket(txid string) (dbtypes.TicketSpendType, dbtypes.TicketPoolStatus, error) + func (pgb *ChainDB) PosIntervals(limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) + func (pgb *ChainDB) PowerlessTickets() (*apitypes.PowerlessTickets, error) + func (pgb *ChainDB) ProposalVotes(proposalToken string) (*dbtypes.ProposalChartsData, error) + func (pgb *ChainDB) PurgeBestBlocks(N int64) (*dbtypes.DeletionSummary, int64, error) + func (pgb *ChainDB) RegisterCharts(charts *cache.ChartData) + func (pgb *ChainDB) ReindexAddressesBlockTime() error + func (pgb *ChainDB) SetDBBestBlock() error + func (pgb *ChainDB) SetVinsMainchainByBlock(blockHash string) (int64, []dbtypes.UInt64Array, []dbtypes.UInt64Array, error) + func (pgb *ChainDB) SideChainBlocks() ([]*dbtypes.BlockStatus, error) + func (pgb *ChainDB) SideChainTips() ([]*dbtypes.BlockStatus, error) + func (pgb *ChainDB) SpendDetailsForFundingTx(fundHash string) ([]*apitypes.SpendByFundingHash, error) + func (pgb *ChainDB) SpendingTransaction(fundingTxID string, fundingTxVout uint32) (string, uint32, int8, error) + func (pgb *ChainDB) SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error) + func (pgb *ChainDB) StartPiparserHandler() + func (pgb *ChainDB) Store(blockData *blockdata.BlockData, msgBlock *wire.MsgBlock) error + func (pgb *ChainDB) StoreBlock(msgBlock *wire.MsgBlock, winningTickets []string, ...) (numVins int64, numVouts int64, numAddresses int64, err error) + func (pgb *ChainDB) SyncChainDB(ctx context.Context, client rpcutils.MasterBlockGetter, ...) (int64, error) + func (pgb *ChainDB) SyncChainDBAsync(ctx context.Context, res chan dbtypes.SyncResult, ...) + func (pgb *ChainDB) TicketMiss(ticketHash string) (string, int64, error) + func (pgb *ChainDB) TicketMisses(ticketHash string) ([]string, []int64, error) + func (pgb *ChainDB) TicketPoolBlockMaturity() int64 + func (pgb *ChainDB) TicketPoolByDateAndInterval(maturityBlock int64, interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, error) + func (pgb *ChainDB) TicketPoolVisualization(interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, ...) + func (pgb *ChainDB) TicketsByInputCount() (*dbtypes.PoolTicketsData, error) + func (pgb *ChainDB) TicketsByPrice(maturityBlock int64) (*dbtypes.PoolTicketsData, error) + func (pgb *ChainDB) TimeBasedIntervals(timeGrouping dbtypes.TimeBasedGrouping, limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) + func (pgb *ChainDB) TipToSideChain(mainRoot string) (string, int64, error) + func (pgb *ChainDB) Transaction(txHash string) ([]*dbtypes.Tx, error) + func (pgb *ChainDB) TransactionBlock(txID string) (string, uint32, int8, error) + func (pgb *ChainDB) TransactionBlocks(txHash string) ([]*dbtypes.BlockStatus, []uint32, error) + func (pgb *ChainDB) TxHistoryData(address string, addrChart dbtypes.HistoryChart, ...) (cd *dbtypes.ChartsData, err error) + func (pgb *ChainDB) UpdateChainState(blockChainInfo *dcrjson.GetBlockChainInfoResult) + func (pgb *ChainDB) UpdateLastBlock(msgBlock *wire.MsgBlock, isMainchain bool) error + func (pgb *ChainDB) UpdateSpendingInfoInAllAddresses(barLoad chan *dbtypes.ProgressBarLoad) (int64, error) + func (pgb *ChainDB) UpdateSpendingInfoInAllTickets() (int64, error) + func (pgb *ChainDB) UpgradeTables(dcrdClient BlockGetter, version, needVersion TableVersion) (bool, error) + func (pgb *ChainDB) UseMempoolChecker(mp rpcutils.MempoolAddressChecker) + func (pgb *ChainDB) UseStakeDB(stakeDB *stakedb.StakeDatabase) + func (pgb *ChainDB) VersionCheck(client BlockGetter) error + func (pgb *ChainDB) VinsForTx(dbTx *dbtypes.Tx) ([]dbtypes.VinTxProperty, []string, []uint16, error) + func (pgb *ChainDB) VotesInBlock(hash string) (int16, error) + func (pgb *ChainDB) VoutValue(txID string, vout uint32) (uint64, error) + func (pgb *ChainDB) VoutValues(txID string) ([]uint64, []uint32, []int8, error) + func (pgb *ChainDB) VoutsForTx(dbTx *dbtypes.Tx) ([]dbtypes.Vout, error) + type ChainDBRPC struct + Client *rpcclient.Client + func NewChainDBRPC(chaindb *ChainDB, cl *rpcclient.Client) (*ChainDBRPC, error) + func (pgb *ChainDBRPC) AddressData(address string, limitN, offsetAddrOuts int64, txnType dbtypes.AddrTxnViewType) (addrData *dbtypes.AddressInfo, err error) + func (pgb *ChainDBRPC) GetBlockVerboseByHash(hash string, verboseTx bool) *dcrjson.GetBlockVerboseResult + func (pgb *ChainDBRPC) GetChainWork(hash *chainhash.Hash) (string, error) + func (pgb *ChainDBRPC) GetRawTransaction(txid *chainhash.Hash) (*dcrjson.TxRawResult, error) + func (pgb *ChainDBRPC) GetTransactionHex(txid *chainhash.Hash) string + func (pgb *ChainDBRPC) GetTransactionsForBlockByHash(hash string) *apitypes.BlockTransactions + func (pgb *ChainDBRPC) InsightSearchRPCAddressTransactions(addr string, count, skip int) []*dcrjson.SearchRawTransactionsResult + func (pgb *ChainDBRPC) MissingSideChainBlocks() ([]dbtypes.SideChain, int, error) + func (pgb *ChainDBRPC) NewChainMonitor(ctx context.Context) *ChainMonitor + func (pgb *ChainDBRPC) SendRawTransaction(txhex string) (string, error) + func (pgb *ChainDBRPC) Store(blockData *blockdata.BlockData, msgBlock *wire.MsgBlock) error + func (pgb *ChainDBRPC) SyncChainDBAsync(ctx context.Context, res chan dbtypes.SyncResult, ...) + func (pgb *ChainDBRPC) UpdateChainState(blockChainInfo *dcrjson.GetBlockChainInfoResult) + type ChainDeployments struct + type ChainMonitor struct + ConnectingLock chan struct{} + DoneConnecting chan struct{} + func (p *ChainMonitor) ReorgHandler(reorg *txhelpers.ReorgData) (err error) + type CompatAction int8 + const Maintenance + const OK + const Rebuild + const TimeTravel + const Unknown + const Upgrade + func (v CompatAction) String() string + type CompatibilityAction int8 + func TableVersionCompatible(required, actual TableVersion) CompatibilityAction + func (v CompatibilityAction) String() string + type DBInfo struct + DBName string + Host string + Pass string + Port string + QueryTimeout time.Duration + User string + type DatabaseUpgrade struct + CurrentVer DatabaseVersion + RequiredVer DatabaseVersion + TableName string + UpgradeType CompatAction + func (s DatabaseUpgrade) String() string + type DatabaseVersion struct + func DBVersion(db *sql.DB) (ver DatabaseVersion, err error) + func NewDatabaseVersion(major, minor, patch uint32) DatabaseVersion + func (v *DatabaseVersion) NeededToReach(other *DatabaseVersion) CompatAction + func (v DatabaseVersion) String() string + type MsgBlockPG struct + Validators []string + WinningTickets []string + type PGSetting struct + Name string + Setting string + ShortDesc string + Source string + SourceFile string + SourceLine string + Unit string + type PGSettings map[string]PGSetting + func RetrieveSysSettingsConfFile(db *sql.DB) (PGSettings, error) + func RetrieveSysSettingsPerformance(db *sql.DB) (PGSettings, error) + func RetrieveSysSettingsServer(db *sql.DB) (PGSettings, error) + func (pgs PGSettings) String() string + type ProposalsFetcher interface + ProposalsHistory func() ([]*pitypes.History, error) + ProposalsHistorySince func(since time.Time) ([]*pitypes.History, error) + UpdateSignal func() <-chan struct{} + type SqlExecutor interface + Exec func(query string, args ...interface{}) (sql.Result, error) + type TableUpgrade struct + CurrentVer TableVersion + RequiredVer TableVersion + TableName string + UpgradeType CompatibilityAction + func TableUpgradesRequired(versions map[string]TableVersion) []TableUpgrade + func (s TableUpgrade) String() string + type TableUpgradeType struct + TableName string + type TableVersion struct + func NewTableVersion(major, minor, patch uint32) TableVersion + func (s TableVersion) String() string + type TicketTxnIDGetter struct + func NewTicketTxnIDGetter(db *sql.DB) *TicketTxnIDGetter + func (t *TicketTxnIDGetter) Set(txid string, txDbID uint64) + func (t *TicketTxnIDGetter) SetN(txid []string, txDbID []uint64) + func (t *TicketTxnIDGetter) TxnDbID(txid string, expire bool) (uint64, error) + type VinVoutTypeUpdateData struct + TxType stake.TxType + VinsDbIDs dbtypes.UInt64Array + VoutsDbIDs dbtypes.UInt64Array Other modules containing this package github.com/decred/dcrdata github.com/decred/dcrdata/db/dcrpg github.com/decred/dcrdata/db/dcrpg/v2 github.com/decred/dcrdata/db/dcrpg/v4 github.com/decred/dcrdata/db/dcrpg/v5 github.com/decred/dcrdata/db/dcrpg/v6 github.com/decred/dcrdata/db/dcrpg/v7 github.com/decred/dcrdata/v3 github.com/decred/dcrdata/v4