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
20,300
decred/dcrdata
stakedb/ticketpool.go
applyDiff
func (tp *TicketPool) applyDiff(in, out []chainhash.Hash) { initsize := len(tp.pool) for i := range in { tp.pool[in[i]] = struct{}{} } endsize := len(tp.pool) if endsize != initsize+len(in) { log.Warnf("pool grew by %d instead of %d", endsize-initsize, len(in)) } initsize = endsize for i := range out { ii...
go
func (tp *TicketPool) applyDiff(in, out []chainhash.Hash) { initsize := len(tp.pool) for i := range in { tp.pool[in[i]] = struct{}{} } endsize := len(tp.pool) if endsize != initsize+len(in) { log.Warnf("pool grew by %d instead of %d", endsize-initsize, len(in)) } initsize = endsize for i := range out { ii...
[ "func", "(", "tp", "*", "TicketPool", ")", "applyDiff", "(", "in", ",", "out", "[", "]", "chainhash", ".", "Hash", ")", "{", "initsize", ":=", "len", "(", "tp", ".", "pool", ")", "\n", "for", "i", ":=", "range", "in", "{", "tp", ".", "pool", "[...
// applyDiff adds and removes tickets from the pool map.
[ "applyDiff", "adds", "and", "removes", "tickets", "from", "the", "pool", "map", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/stakedb/ticketpool.go#L655-L676
20,301
decred/dcrdata
mempool/mempoolcache.go
GetHeight
func (c *MempoolDataCache) GetHeight() uint32 { c.mtx.RLock() defer c.mtx.RUnlock() return c.height }
go
func (c *MempoolDataCache) GetHeight() uint32 { c.mtx.RLock() defer c.mtx.RUnlock() return c.height }
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetHeight", "(", ")", "uint32", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "height", "\n", "}" ]
// GetHeight returns the mempool height
[ "GetHeight", "returns", "the", "mempool", "height" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L64-L68
20,302
decred/dcrdata
mempool/mempoolcache.go
GetNumTickets
func (c *MempoolDataCache) GetNumTickets() (uint32, uint32) { c.mtx.RLock() defer c.mtx.RUnlock() return c.height, c.numTickets }
go
func (c *MempoolDataCache) GetNumTickets() (uint32, uint32) { c.mtx.RLock() defer c.mtx.RUnlock() return c.height, c.numTickets }
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetNumTickets", "(", ")", "(", "uint32", ",", "uint32", ")", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "heigh...
// GetNumTickets returns the mempool height and number of tickets
[ "GetNumTickets", "returns", "the", "mempool", "height", "and", "number", "of", "tickets" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L71-L75
20,303
decred/dcrdata
mempool/mempoolcache.go
GetFeeInfo
func (c *MempoolDataCache) GetFeeInfo() (uint32, dcrjson.FeeInfoMempool) { c.mtx.RLock() defer c.mtx.RUnlock() return c.height, c.ticketFeeInfo }
go
func (c *MempoolDataCache) GetFeeInfo() (uint32, dcrjson.FeeInfoMempool) { c.mtx.RLock() defer c.mtx.RUnlock() return c.height, c.ticketFeeInfo }
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetFeeInfo", "(", ")", "(", "uint32", ",", "dcrjson", ".", "FeeInfoMempool", ")", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return...
// GetFeeInfo returns the mempool height and basic fee info
[ "GetFeeInfo", "returns", "the", "mempool", "height", "and", "basic", "fee", "info" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L78-L82
20,304
decred/dcrdata
mempool/mempoolcache.go
GetFeeInfoExtra
func (c *MempoolDataCache) GetFeeInfoExtra() (uint32, *apitypes.MempoolTicketFeeInfo) { c.mtx.RLock() defer c.mtx.RUnlock() feeInfo := apitypes.MempoolTicketFeeInfo{ Height: c.height, Time: c.timestamp.Unix(), FeeInfoMempool: c.ticketFeeInfo, LowestMineable: c.lowestMineableByFeeRate, } r...
go
func (c *MempoolDataCache) GetFeeInfoExtra() (uint32, *apitypes.MempoolTicketFeeInfo) { c.mtx.RLock() defer c.mtx.RUnlock() feeInfo := apitypes.MempoolTicketFeeInfo{ Height: c.height, Time: c.timestamp.Unix(), FeeInfoMempool: c.ticketFeeInfo, LowestMineable: c.lowestMineableByFeeRate, } r...
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetFeeInfoExtra", "(", ")", "(", "uint32", ",", "*", "apitypes", ".", "MempoolTicketFeeInfo", ")", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")"...
// GetFeeInfoExtra returns the mempool height and detailed fee info
[ "GetFeeInfoExtra", "returns", "the", "mempool", "height", "and", "detailed", "fee", "info" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L85-L95
20,305
decred/dcrdata
mempool/mempoolcache.go
GetFees
func (c *MempoolDataCache) GetFees(N int) (uint32, int, []float64) { c.mtx.RLock() defer c.mtx.RUnlock() numFees := len(c.allFees) //var fees []float64 fees := []float64{} // for consistency if N == 0 { return c.height, numFees, fees } if N < 0 || N >= numFees { fees = make([]float64, numFees) copy(fee...
go
func (c *MempoolDataCache) GetFees(N int) (uint32, int, []float64) { c.mtx.RLock() defer c.mtx.RUnlock() numFees := len(c.allFees) //var fees []float64 fees := []float64{} // for consistency if N == 0 { return c.height, numFees, fees } if N < 0 || N >= numFees { fees = make([]float64, numFees) copy(fee...
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetFees", "(", "N", "int", ")", "(", "uint32", ",", "int", ",", "[", "]", "float64", ")", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", ...
// GetFees returns the mempool height number of fees and an array of the fields
[ "GetFees", "returns", "the", "mempool", "height", "number", "of", "fees", "and", "an", "array", "of", "the", "fields" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L98-L121
20,306
decred/dcrdata
mempool/mempoolcache.go
GetFeeRates
func (c *MempoolDataCache) GetFeeRates(N int) (uint32, int64, int, []float64) { c.mtx.RLock() defer c.mtx.RUnlock() numFees := len(c.allFeeRates) //var fees []float64 fees := []float64{} if N == 0 { return c.height, c.timestamp.Unix(), numFees, fees } if N < 0 || N >= numFees { fees = make([]float64, num...
go
func (c *MempoolDataCache) GetFeeRates(N int) (uint32, int64, int, []float64) { c.mtx.RLock() defer c.mtx.RUnlock() numFees := len(c.allFeeRates) //var fees []float64 fees := []float64{} if N == 0 { return c.height, c.timestamp.Unix(), numFees, fees } if N < 0 || N >= numFees { fees = make([]float64, num...
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetFeeRates", "(", "N", "int", ")", "(", "uint32", ",", "int64", ",", "int", ",", "[", "]", "float64", ")", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUn...
// GetFeeRates returns the mempool height, time, number of fees and an array of // fee rates
[ "GetFeeRates", "returns", "the", "mempool", "height", "time", "number", "of", "fees", "and", "an", "array", "of", "fee", "rates" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L125-L148
20,307
decred/dcrdata
mempool/mempoolcache.go
GetTicketsDetails
func (c *MempoolDataCache) GetTicketsDetails(N int) (uint32, int64, int, TicketsDetails) { c.mtx.RLock() defer c.mtx.RUnlock() numSSTx := len(c.allTicketsDetails) //var details TicketsDetails details := TicketsDetails{} if N == 0 { return c.height, c.timestamp.Unix(), numSSTx, details } if N < 0 || N >= num...
go
func (c *MempoolDataCache) GetTicketsDetails(N int) (uint32, int64, int, TicketsDetails) { c.mtx.RLock() defer c.mtx.RUnlock() numSSTx := len(c.allTicketsDetails) //var details TicketsDetails details := TicketsDetails{} if N == 0 { return c.height, c.timestamp.Unix(), numSSTx, details } if N < 0 || N >= num...
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetTicketsDetails", "(", "N", "int", ")", "(", "uint32", ",", "int64", ",", "int", ",", "TicketsDetails", ")", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnl...
// GetTicketsDetails returns the mempool height, time, number of tickets and the // ticket details
[ "GetTicketsDetails", "returns", "the", "mempool", "height", "time", "number", "of", "tickets", "and", "the", "ticket", "details" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L152-L174
20,308
decred/dcrdata
mempool/mempoolcache.go
GetTicketPriceCountTime
func (c *MempoolDataCache) GetTicketPriceCountTime(feeAvgLength int) *apitypes.PriceCountTime { c.mtx.RLock() defer c.mtx.RUnlock() numFees := len(c.allFees) if numFees < feeAvgLength { feeAvgLength = numFees } var feeAvg float64 for i := 0; i < feeAvgLength; i++ { feeAvg += c.allFees[numFees-i-1] } feeAv...
go
func (c *MempoolDataCache) GetTicketPriceCountTime(feeAvgLength int) *apitypes.PriceCountTime { c.mtx.RLock() defer c.mtx.RUnlock() numFees := len(c.allFees) if numFees < feeAvgLength { feeAvgLength = numFees } var feeAvg float64 for i := 0; i < feeAvgLength; i++ { feeAvg += c.allFees[numFees-i-1] } feeAv...
[ "func", "(", "c", "*", "MempoolDataCache", ")", "GetTicketPriceCountTime", "(", "feeAvgLength", "int", ")", "*", "apitypes", ".", "PriceCountTime", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", ...
// GetTicketPriceCountTime gathers the nominal info for mempool tickets.
[ "GetTicketPriceCountTime", "gathers", "the", "nominal", "info", "for", "mempool", "tickets", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/mempoolcache.go#L177-L196
20,309
decred/dcrdata
api/insight/apiroutes.go
NewInsightApi
func NewInsightApi(client *rpcclient.Client, blockData *dcrpg.ChainDBRPC, params *chaincfg.Params, memPoolData rpcutils.MempoolAddressChecker, JSONIndent string, maxAddrs int, status *apitypes.Status) *InsightApi { newContext := InsightApi{ nodeClient: client, BlockData: blockData, params: par...
go
func NewInsightApi(client *rpcclient.Client, blockData *dcrpg.ChainDBRPC, params *chaincfg.Params, memPoolData rpcutils.MempoolAddressChecker, JSONIndent string, maxAddrs int, status *apitypes.Status) *InsightApi { newContext := InsightApi{ nodeClient: client, BlockData: blockData, params: par...
[ "func", "NewInsightApi", "(", "client", "*", "rpcclient", ".", "Client", ",", "blockData", "*", "dcrpg", ".", "ChainDBRPC", ",", "params", "*", "chaincfg", ".", "Params", ",", "memPoolData", "rpcutils", ".", "MempoolAddressChecker", ",", "JSONIndent", "string", ...
// NewInsightApi is the constructor for InsightApi.
[ "NewInsightApi", "is", "the", "constructor", "for", "InsightApi", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apiroutes.go#L46-L59
20,310
decred/dcrdata
db/dcrpg/insightapi.go
GetRawTransaction
func (pgb *ChainDBRPC) GetRawTransaction(txid *chainhash.Hash) (*dcrjson.TxRawResult, error) { txraw, err := rpcutils.GetTransactionVerboseByID(pgb.Client, txid) if err != nil { log.Errorf("GetRawTransactionVerbose failed for: %s", txid) return nil, err } return txraw, nil }
go
func (pgb *ChainDBRPC) GetRawTransaction(txid *chainhash.Hash) (*dcrjson.TxRawResult, error) { txraw, err := rpcutils.GetTransactionVerboseByID(pgb.Client, txid) if err != nil { log.Errorf("GetRawTransactionVerbose failed for: %s", txid) return nil, err } return txraw, nil }
[ "func", "(", "pgb", "*", "ChainDBRPC", ")", "GetRawTransaction", "(", "txid", "*", "chainhash", ".", "Hash", ")", "(", "*", "dcrjson", ".", "TxRawResult", ",", "error", ")", "{", "txraw", ",", "err", ":=", "rpcutils", ".", "GetTransactionVerboseByID", "(",...
// GetRawTransaction gets a dcrjson.TxRawResult for the specified transaction // hash.
[ "GetRawTransaction", "gets", "a", "dcrjson", ".", "TxRawResult", "for", "the", "specified", "transaction", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/insightapi.go#L23-L30
20,311
decred/dcrdata
db/dcrpg/insightapi.go
GetBlockHeight
func (pgb *ChainDB) GetBlockHeight(hash string) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() height, err := RetrieveBlockHeight(ctx, pgb.db, hash) if err != nil { log.Errorf("Unable to get block height for hash %s: %v", hash, err) return -1, pgb.replaceCancelErro...
go
func (pgb *ChainDB) GetBlockHeight(hash string) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() height, err := RetrieveBlockHeight(ctx, pgb.db, hash) if err != nil { log.Errorf("Unable to get block height for hash %s: %v", hash, err) return -1, pgb.replaceCancelErro...
[ "func", "(", "pgb", "*", "ChainDB", ")", "GetBlockHeight", "(", "hash", "string", ")", "(", "int64", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n"...
// GetBlockHeight returns the height of the block with the specified hash.
[ "GetBlockHeight", "returns", "the", "height", "of", "the", "block", "with", "the", "specified", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/insightapi.go#L33-L42
20,312
decred/dcrdata
db/dcrpg/insightapi.go
SendRawTransaction
func (pgb *ChainDBRPC) SendRawTransaction(txhex string) (string, error) { msg, err := txhelpers.MsgTxFromHex(txhex) if err != nil { log.Errorf("SendRawTransaction failed: could not decode hex") return "", err } hash, err := pgb.Client.SendRawTransaction(msg, true) if err != nil { log.Errorf("SendRawTransacti...
go
func (pgb *ChainDBRPC) SendRawTransaction(txhex string) (string, error) { msg, err := txhelpers.MsgTxFromHex(txhex) if err != nil { log.Errorf("SendRawTransaction failed: could not decode hex") return "", err } hash, err := pgb.Client.SendRawTransaction(msg, true) if err != nil { log.Errorf("SendRawTransacti...
[ "func", "(", "pgb", "*", "ChainDBRPC", ")", "SendRawTransaction", "(", "txhex", "string", ")", "(", "string", ",", "error", ")", "{", "msg", ",", "err", ":=", "txhelpers", ".", "MsgTxFromHex", "(", "txhex", ")", "\n", "if", "err", "!=", "nil", "{", "...
// SendRawTransaction attempts to decode the input serialized transaction, // passed as hex encoded string, and broadcast it, returning the tx hash.
[ "SendRawTransaction", "attempts", "to", "decode", "the", "input", "serialized", "transaction", "passed", "as", "hex", "encoded", "string", "and", "broadcast", "it", "returning", "the", "tx", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/insightapi.go#L46-L58
20,313
decred/dcrdata
db/dcrpg/insightapi.go
GetTransactionHex
func (pgb *ChainDBRPC) GetTransactionHex(txid *chainhash.Hash) string { txraw, err := rpcutils.GetTransactionVerboseByID(pgb.Client, txid) if err != nil { log.Errorf("GetRawTransactionVerbose failed for: %v", err) return "" } return txraw.Hex }
go
func (pgb *ChainDBRPC) GetTransactionHex(txid *chainhash.Hash) string { txraw, err := rpcutils.GetTransactionVerboseByID(pgb.Client, txid) if err != nil { log.Errorf("GetRawTransactionVerbose failed for: %v", err) return "" } return txraw.Hex }
[ "func", "(", "pgb", "*", "ChainDBRPC", ")", "GetTransactionHex", "(", "txid", "*", "chainhash", ".", "Hash", ")", "string", "{", "txraw", ",", "err", ":=", "rpcutils", ".", "GetTransactionVerboseByID", "(", "pgb", ".", "Client", ",", "txid", ")", "\n\n", ...
// GetTransactionHex returns the full serialized transaction for the specified // transaction hash as a hex encode string.
[ "GetTransactionHex", "returns", "the", "full", "serialized", "transaction", "for", "the", "specified", "transaction", "hash", "as", "a", "hex", "encode", "string", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/insightapi.go#L172-L181
20,314
decred/dcrdata
db/dcrpg/indexing.go
IndexVinTableOnVins
func IndexVinTableOnVins(db *sql.DB) (err error) { _, err = db.Exec(internal.IndexVinTableOnVins) return }
go
func IndexVinTableOnVins(db *sql.DB) (err error) { _, err = db.Exec(internal.IndexVinTableOnVins) return }
[ "func", "IndexVinTableOnVins", "(", "db", "*", "sql", ".", "DB", ")", "(", "err", "error", ")", "{", "_", ",", "err", "=", "db", ".", "Exec", "(", "internal", ".", "IndexVinTableOnVins", ")", "\n", "return", "\n", "}" ]
// Vins table indexes
[ "Vins", "table", "indexes" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L29-L32
20,315
decred/dcrdata
db/dcrpg/indexing.go
MissingIndexes
func (pgb *ChainDB) MissingIndexes() (missing, descs []string, err error) { for idxName, desc := range internal.IndexDescriptions { var exists bool exists, err = ExistsIndex(pgb.db, idxName) if err != nil { return } if !exists { missing = append(missing, idxName) descs = append(descs, desc) } } ...
go
func (pgb *ChainDB) MissingIndexes() (missing, descs []string, err error) { for idxName, desc := range internal.IndexDescriptions { var exists bool exists, err = ExistsIndex(pgb.db, idxName) if err != nil { return } if !exists { missing = append(missing, idxName) descs = append(descs, desc) } } ...
[ "func", "(", "pgb", "*", "ChainDB", ")", "MissingIndexes", "(", ")", "(", "missing", ",", "descs", "[", "]", "string", ",", "err", "error", ")", "{", "for", "idxName", ",", "desc", ":=", "range", "internal", ".", "IndexDescriptions", "{", "var", "exist...
// Indexes checks // MissingIndexes lists missing table indexes and their descriptions.
[ "Indexes", "checks", "MissingIndexes", "lists", "missing", "table", "indexes", "and", "their", "descriptions", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L364-L377
20,316
decred/dcrdata
db/dcrpg/indexing.go
MissingAddressIndexes
func (pgb *ChainDB) MissingAddressIndexes() (missing []string, descs []string, err error) { for _, idxName := range internal.AddressesIndexNames { var exists bool exists, err = ExistsIndex(pgb.db, idxName) if err != nil { return } if !exists { missing = append(missing, idxName) descs = append(descs,...
go
func (pgb *ChainDB) MissingAddressIndexes() (missing []string, descs []string, err error) { for _, idxName := range internal.AddressesIndexNames { var exists bool exists, err = ExistsIndex(pgb.db, idxName) if err != nil { return } if !exists { missing = append(missing, idxName) descs = append(descs,...
[ "func", "(", "pgb", "*", "ChainDB", ")", "MissingAddressIndexes", "(", ")", "(", "missing", "[", "]", "string", ",", "descs", "[", "]", "string", ",", "err", "error", ")", "{", "for", "_", ",", "idxName", ":=", "range", "internal", ".", "AddressesIndex...
// MissingAddressIndexes list missing addresses table indexes and their // descriptions.
[ "MissingAddressIndexes", "list", "missing", "addresses", "table", "indexes", "and", "their", "descriptions", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L381-L394
20,317
decred/dcrdata
db/dcrpg/indexing.go
indexDescription
func (pgb *ChainDB) indexDescription(indexName string) string { name, ok := internal.IndexDescriptions[indexName] if !ok { name = "unknown index" } return name }
go
func (pgb *ChainDB) indexDescription(indexName string) string { name, ok := internal.IndexDescriptions[indexName] if !ok { name = "unknown index" } return name }
[ "func", "(", "pgb", "*", "ChainDB", ")", "indexDescription", "(", "indexName", "string", ")", "string", "{", "name", ",", "ok", ":=", "internal", ".", "IndexDescriptions", "[", "indexName", "]", "\n", "if", "!", "ok", "{", "name", "=", "\"", "\"", "\n"...
// indexDescription gives the description of the named index.
[ "indexDescription", "gives", "the", "description", "of", "the", "named", "index", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L397-L403
20,318
decred/dcrdata
db/dcrpg/indexing.go
DeindexAll
func (pgb *ChainDB) DeindexAll() error { allDeIndexes := []deIndexingInfo{ // blocks table {DeindexBlockTableOnHash}, {DeindexBlockTableOnHeight}, // transactions table {DeindexTransactionTableOnHashes}, {DeindexTransactionTableOnBlockIn}, // vins table {DeindexVinTableOnVins}, {DeindexVinTableOnPr...
go
func (pgb *ChainDB) DeindexAll() error { allDeIndexes := []deIndexingInfo{ // blocks table {DeindexBlockTableOnHash}, {DeindexBlockTableOnHeight}, // transactions table {DeindexTransactionTableOnHashes}, {DeindexTransactionTableOnBlockIn}, // vins table {DeindexVinTableOnVins}, {DeindexVinTableOnPr...
[ "func", "(", "pgb", "*", "ChainDB", ")", "DeindexAll", "(", ")", "error", "{", "allDeIndexes", ":=", "[", "]", "deIndexingInfo", "{", "// blocks table", "{", "DeindexBlockTableOnHash", "}", ",", "{", "DeindexBlockTableOnHeight", "}", ",", "// transactions table", ...
// DeindexAll drops indexes in most tables.
[ "DeindexAll", "drops", "indexes", "in", "most", "tables", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L406-L466
20,319
decred/dcrdata
db/dcrpg/indexing.go
IndexTicketsTable
func (pgb *ChainDB) IndexTicketsTable(barLoad chan *dbtypes.ProgressBarLoad) error { ticketsTableIndexes := []indexingInfo{ {Msg: "ticket hash", IndexFunc: IndexTicketsTableOnHashes}, {Msg: "ticket pool status", IndexFunc: IndexTicketsTableOnPoolStatus}, {Msg: "transaction Db ID", IndexFunc: IndexTicketsTableOnT...
go
func (pgb *ChainDB) IndexTicketsTable(barLoad chan *dbtypes.ProgressBarLoad) error { ticketsTableIndexes := []indexingInfo{ {Msg: "ticket hash", IndexFunc: IndexTicketsTableOnHashes}, {Msg: "ticket pool status", IndexFunc: IndexTicketsTableOnPoolStatus}, {Msg: "transaction Db ID", IndexFunc: IndexTicketsTableOnT...
[ "func", "(", "pgb", "*", "ChainDB", ")", "IndexTicketsTable", "(", "barLoad", "chan", "*", "dbtypes", ".", "ProgressBarLoad", ")", "error", "{", "ticketsTableIndexes", ":=", "[", "]", "indexingInfo", "{", "{", "Msg", ":", "\"", "\"", ",", "IndexFunc", ":",...
// IndexTicketsTable creates indexes in the tickets table on ticket hash, // ticket pool status and tx DB ID columns.
[ "IndexTicketsTable", "creates", "indexes", "in", "the", "tickets", "table", "on", "ticket", "hash", "ticket", "pool", "status", "and", "tx", "DB", "ID", "columns", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L540-L563
20,320
decred/dcrdata
db/dcrpg/indexing.go
DeindexTicketsTable
func (pgb *ChainDB) DeindexTicketsTable() error { ticketsTablesDeIndexes := []deIndexingInfo{ {DeindexTicketsTableOnHashes}, {DeindexTicketsTableOnPoolStatus}, {DeindexTicketsTableOnTxDbID}, } var err error for _, val := range ticketsTablesDeIndexes { if err = val.DeIndexFunc(pgb.db); err != nil { warnU...
go
func (pgb *ChainDB) DeindexTicketsTable() error { ticketsTablesDeIndexes := []deIndexingInfo{ {DeindexTicketsTableOnHashes}, {DeindexTicketsTableOnPoolStatus}, {DeindexTicketsTableOnTxDbID}, } var err error for _, val := range ticketsTablesDeIndexes { if err = val.DeIndexFunc(pgb.db); err != nil { warnU...
[ "func", "(", "pgb", "*", "ChainDB", ")", "DeindexTicketsTable", "(", ")", "error", "{", "ticketsTablesDeIndexes", ":=", "[", "]", "deIndexingInfo", "{", "{", "DeindexTicketsTableOnHashes", "}", ",", "{", "DeindexTicketsTableOnPoolStatus", "}", ",", "{", "DeindexTi...
// DeindexTicketsTable drops indexes in the tickets table on ticket hash, // ticket pool status and tx DB ID columns.
[ "DeindexTicketsTable", "drops", "indexes", "in", "the", "tickets", "table", "on", "ticket", "hash", "ticket", "pool", "status", "and", "tx", "DB", "ID", "columns", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L567-L582
20,321
decred/dcrdata
db/dcrpg/indexing.go
IndexAddressTable
func (pgb *ChainDB) IndexAddressTable(barLoad chan *dbtypes.ProgressBarLoad) error { addressesTableIndexes := []indexingInfo{ {Msg: "address", IndexFunc: IndexAddressTableOnAddress}, {Msg: "matching tx hash", IndexFunc: IndexMatchingTxHashOnTableAddress}, {Msg: "block time", IndexFunc: IndexBlockTimeOnTableAddre...
go
func (pgb *ChainDB) IndexAddressTable(barLoad chan *dbtypes.ProgressBarLoad) error { addressesTableIndexes := []indexingInfo{ {Msg: "address", IndexFunc: IndexAddressTableOnAddress}, {Msg: "matching tx hash", IndexFunc: IndexMatchingTxHashOnTableAddress}, {Msg: "block time", IndexFunc: IndexBlockTimeOnTableAddre...
[ "func", "(", "pgb", "*", "ChainDB", ")", "IndexAddressTable", "(", "barLoad", "chan", "*", "dbtypes", ".", "ProgressBarLoad", ")", "error", "{", "addressesTableIndexes", ":=", "[", "]", "indexingInfo", "{", "{", "Msg", ":", "\"", "\"", ",", "IndexFunc", ":...
// IndexAddressTable creates the indexes on the address table on the vout ID, // block_time, matching_tx_hash and address columns.
[ "IndexAddressTable", "creates", "the", "indexes", "on", "the", "address", "table", "on", "the", "vout", "ID", "block_time", "matching_tx_hash", "and", "address", "columns", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L607-L632
20,322
decred/dcrdata
db/dcrpg/indexing.go
DeindexAddressTable
func (pgb *ChainDB) DeindexAddressTable() error { addressesDeindexes := []deIndexingInfo{ {DeindexAddressTableOnAddress}, {DeindexMatchingTxHashOnTableAddress}, {DeindexBlockTimeOnTableAddress}, {DeindexAddressTableOnVoutID}, //{DeindexAddressTableOnTxHash}, } var err error for _, val := range addressesD...
go
func (pgb *ChainDB) DeindexAddressTable() error { addressesDeindexes := []deIndexingInfo{ {DeindexAddressTableOnAddress}, {DeindexMatchingTxHashOnTableAddress}, {DeindexBlockTimeOnTableAddress}, {DeindexAddressTableOnVoutID}, //{DeindexAddressTableOnTxHash}, } var err error for _, val := range addressesD...
[ "func", "(", "pgb", "*", "ChainDB", ")", "DeindexAddressTable", "(", ")", "error", "{", "addressesDeindexes", ":=", "[", "]", "deIndexingInfo", "{", "{", "DeindexAddressTableOnAddress", "}", ",", "{", "DeindexMatchingTxHashOnTableAddress", "}", ",", "{", "DeindexB...
// DeindexAddressTable drops the vin ID, block_time, matching_tx_hash // and address column indexes for the address table.
[ "DeindexAddressTable", "drops", "the", "vin", "ID", "block_time", "matching_tx_hash", "and", "address", "column", "indexes", "for", "the", "address", "table", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/indexing.go#L636-L653
20,323
decred/dcrdata
txhelpers/staketree.go
TicketTxnsInBlock
func TicketTxnsInBlock(bl *dcrutil.Block) ([]chainhash.Hash, []*dcrutil.Tx) { tickets := make([]chainhash.Hash, 0) ticketTxns := make([]*dcrutil.Tx, 0) for _, stx := range bl.STransactions() { if stake.DetermineTxType(stx.MsgTx()) == stake.TxTypeSStx { h := stx.Hash() tickets = append(tickets, *h) ticketT...
go
func TicketTxnsInBlock(bl *dcrutil.Block) ([]chainhash.Hash, []*dcrutil.Tx) { tickets := make([]chainhash.Hash, 0) ticketTxns := make([]*dcrutil.Tx, 0) for _, stx := range bl.STransactions() { if stake.DetermineTxType(stx.MsgTx()) == stake.TxTypeSStx { h := stx.Hash() tickets = append(tickets, *h) ticketT...
[ "func", "TicketTxnsInBlock", "(", "bl", "*", "dcrutil", ".", "Block", ")", "(", "[", "]", "chainhash", ".", "Hash", ",", "[", "]", "*", "dcrutil", ".", "Tx", ")", "{", "tickets", ":=", "make", "(", "[", "]", "chainhash", ".", "Hash", ",", "0", ")...
// TicketTxnsInBlock finds all the new tickets in the block.
[ "TicketTxnsInBlock", "finds", "all", "the", "new", "tickets", "in", "the", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/staketree.go#L161-L173
20,324
decred/dcrdata
txhelpers/staketree.go
TicketsSpentInBlock
func TicketsSpentInBlock(bl *dcrutil.Block) []chainhash.Hash { tickets := make([]chainhash.Hash, 0) for _, stx := range bl.STransactions() { if stake.DetermineTxType(stx.MsgTx()) == stake.TxTypeSSGen { // Hash of the original STtx tickets = append(tickets, stx.MsgTx().TxIn[1].PreviousOutPoint.Hash) } } r...
go
func TicketsSpentInBlock(bl *dcrutil.Block) []chainhash.Hash { tickets := make([]chainhash.Hash, 0) for _, stx := range bl.STransactions() { if stake.DetermineTxType(stx.MsgTx()) == stake.TxTypeSSGen { // Hash of the original STtx tickets = append(tickets, stx.MsgTx().TxIn[1].PreviousOutPoint.Hash) } } r...
[ "func", "TicketsSpentInBlock", "(", "bl", "*", "dcrutil", ".", "Block", ")", "[", "]", "chainhash", ".", "Hash", "{", "tickets", ":=", "make", "(", "[", "]", "chainhash", ".", "Hash", ",", "0", ")", "\n", "for", "_", ",", "stx", ":=", "range", "bl"...
// TicketsSpentInBlock finds all the tickets spent in the block.
[ "TicketsSpentInBlock", "finds", "all", "the", "tickets", "spent", "in", "the", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/staketree.go#L176-L186
20,325
decred/dcrdata
txhelpers/staketree.go
VotesInBlock
func VotesInBlock(bl *dcrutil.Block) []chainhash.Hash { votes := make([]chainhash.Hash, 0) for _, stx := range bl.STransactions() { if stake.DetermineTxType(stx.MsgTx()) == stake.TxTypeSSGen { h := stx.Hash() votes = append(votes, *h) } } return votes }
go
func VotesInBlock(bl *dcrutil.Block) []chainhash.Hash { votes := make([]chainhash.Hash, 0) for _, stx := range bl.STransactions() { if stake.DetermineTxType(stx.MsgTx()) == stake.TxTypeSSGen { h := stx.Hash() votes = append(votes, *h) } } return votes }
[ "func", "VotesInBlock", "(", "bl", "*", "dcrutil", ".", "Block", ")", "[", "]", "chainhash", ".", "Hash", "{", "votes", ":=", "make", "(", "[", "]", "chainhash", ".", "Hash", ",", "0", ")", "\n", "for", "_", ",", "stx", ":=", "range", "bl", ".", ...
// VotesInBlock finds all the votes in the block.
[ "VotesInBlock", "finds", "all", "the", "votes", "in", "the", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/staketree.go#L189-L199
20,326
decred/dcrdata
pubsub/democlient/main.go
AnotInB
func AnotInB(sA []string, sB []string) (AnotB []string) { for _, s := range sA { if found, _ := strInSlice(sB, s); found { continue } AnotB = append(AnotB, s) } return }
go
func AnotInB(sA []string, sB []string) (AnotB []string) { for _, s := range sA { if found, _ := strInSlice(sB, s); found { continue } AnotB = append(AnotB, s) } return }
[ "func", "AnotInB", "(", "sA", "[", "]", "string", ",", "sB", "[", "]", "string", ")", "(", "AnotB", "[", "]", "string", ")", "{", "for", "_", ",", "s", ":=", "range", "sA", "{", "if", "found", ",", "_", ":=", "strInSlice", "(", "sB", ",", "s"...
// AnotInB returns strings in the slice sA that are not in slice sB.
[ "AnotInB", "returns", "strings", "in", "the", "slice", "sA", "that", "are", "not", "in", "slice", "sB", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/democlient/main.go#L237-L245
20,327
decred/dcrdata
db/dcrsqlite/sync.go
RewindStakeDB
func (db *WiredDB) RewindStakeDB(ctx context.Context, toHeight int64, quiet ...bool) (stakeDBHeight int64, err error) { // Target height must be non-negative. It is not possible to disconnect the // genesis block. if toHeight < 0 { toHeight = 0 } // Periodically log progress unless quiet[0]==true showProgress ...
go
func (db *WiredDB) RewindStakeDB(ctx context.Context, toHeight int64, quiet ...bool) (stakeDBHeight int64, err error) { // Target height must be non-negative. It is not possible to disconnect the // genesis block. if toHeight < 0 { toHeight = 0 } // Periodically log progress unless quiet[0]==true showProgress ...
[ "func", "(", "db", "*", "WiredDB", ")", "RewindStakeDB", "(", "ctx", "context", ".", "Context", ",", "toHeight", "int64", ",", "quiet", "...", "bool", ")", "(", "stakeDBHeight", "int64", ",", "err", "error", ")", "{", "// Target height must be non-negative. It...
// RewindStakeDB attempts to disconnect blocks from the stake database to reach // the specified height. A channel must be provided for signaling if the rewind // should abort. If the specified height is greater than the current stake DB // height, RewindStakeDB will exit without error, returning the current stake DB /...
[ "RewindStakeDB", "attempts", "to", "disconnect", "blocks", "from", "the", "stake", "database", "to", "reach", "the", "specified", "height", ".", "A", "channel", "must", "be", "provided", "for", "signaling", "if", "the", "rewind", "should", "abort", ".", "If", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/sync.go#L103-L148
20,328
decred/dcrdata
db/dcrsqlite/sync.go
ImportSideChains
func (db *WiredDB) ImportSideChains(collector *blockdata.Collector) error { tips, err := rpcutils.SideChains(db.client) if err != nil { return err } var hashlist []*chainhash.Hash for it := range tips { log.Tracef("Primary DB -> Getting base DB side chain with tip %s at %d.", tips[it].Hash, tips[it].Height) ...
go
func (db *WiredDB) ImportSideChains(collector *blockdata.Collector) error { tips, err := rpcutils.SideChains(db.client) if err != nil { return err } var hashlist []*chainhash.Hash for it := range tips { log.Tracef("Primary DB -> Getting base DB side chain with tip %s at %d.", tips[it].Hash, tips[it].Height) ...
[ "func", "(", "db", "*", "WiredDB", ")", "ImportSideChains", "(", "collector", "*", "blockdata", ".", "Collector", ")", "error", "{", "tips", ",", "err", ":=", "rpcutils", ".", "SideChains", "(", "db", ".", "client", ")", "\n", "if", "err", "!=", "nil",...
// ImportSideChains imports all side chains. Similar to pgblockchain.MissingSideChainBlocks // plus the rest from main.go
[ "ImportSideChains", "imports", "all", "side", "chains", ".", "Similar", "to", "pgblockchain", ".", "MissingSideChainBlocks", "plus", "the", "rest", "from", "main", ".", "go" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrsqlite/sync.go#L452-L497
20,329
decred/dcrdata
gov/agendas/deployments.go
NewAgendasDB
func NewAgendasDB(client DeploymentSource, dbPath string) (*AgendaDB, error) { if dbPath == "" { return nil, fmt.Errorf("empty db Path found") } if client == DeploymentSource(nil) { return nil, fmt.Errorf("invalid deployment source found") } _, err := os.Stat(dbPath) if err != nil && !os.IsNotExist(err) { ...
go
func NewAgendasDB(client DeploymentSource, dbPath string) (*AgendaDB, error) { if dbPath == "" { return nil, fmt.Errorf("empty db Path found") } if client == DeploymentSource(nil) { return nil, fmt.Errorf("invalid deployment source found") } _, err := os.Stat(dbPath) if err != nil && !os.IsNotExist(err) { ...
[ "func", "NewAgendasDB", "(", "client", "DeploymentSource", ",", "dbPath", "string", ")", "(", "*", "AgendaDB", ",", "error", ")", "{", "if", "dbPath", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}",...
// NewAgendasDB opens an existing database or create a new one using with the // specified file name. An initialized agendas db connection is returned. // It also checks the db version, Reindexes the db if need be and sets the // required db version.
[ "NewAgendasDB", "opens", "an", "existing", "database", "or", "create", "a", "new", "one", "using", "with", "the", "specified", "file", "name", ".", "An", "initialized", "agendas", "db", "connection", "is", "returned", ".", "It", "also", "checks", "the", "db"...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L66-L111
20,330
decred/dcrdata
gov/agendas/deployments.go
countProperties
func (db *AgendaDB) countProperties() error { numAgendas, err := db.sdb.Count(&AgendaTagged{}) if err != nil { log.Errorf("Agendas count failed: %v\n", err) return err } db.NumAgendas = numAgendas return nil }
go
func (db *AgendaDB) countProperties() error { numAgendas, err := db.sdb.Count(&AgendaTagged{}) if err != nil { log.Errorf("Agendas count failed: %v\n", err) return err } db.NumAgendas = numAgendas return nil }
[ "func", "(", "db", "*", "AgendaDB", ")", "countProperties", "(", ")", "error", "{", "numAgendas", ",", "err", ":=", "db", ".", "sdb", ".", "Count", "(", "&", "AgendaTagged", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", ...
// countProperties fetches the Agendas count and appends it to the AgendaDB // receiver.
[ "countProperties", "fetches", "the", "Agendas", "count", "and", "appends", "it", "to", "the", "AgendaDB", "receiver", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L115-L124
20,331
decred/dcrdata
gov/agendas/deployments.go
Close
func (db *AgendaDB) Close() error { if db == nil || db.sdb == nil { return nil } return db.sdb.Close() }
go
func (db *AgendaDB) Close() error { if db == nil || db.sdb == nil { return nil } return db.sdb.Close() }
[ "func", "(", "db", "*", "AgendaDB", ")", "Close", "(", ")", "error", "{", "if", "db", "==", "nil", "||", "db", ".", "sdb", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "db", ".", "sdb", ".", "Close", "(", ")", "\n", "}" ]
// Close should be called when you are done with the AgendaDB to close the // underlying database.
[ "Close", "should", "be", "called", "when", "you", "are", "done", "with", "the", "AgendaDB", "to", "close", "the", "underlying", "database", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L128-L133
20,332
decred/dcrdata
gov/agendas/deployments.go
loadAgenda
func (db *AgendaDB) loadAgenda(agendaID string) (*AgendaTagged, error) { agenda := new(AgendaTagged) if err := db.sdb.One("ID", agendaID, agenda); err != nil { return nil, err } return agenda, nil }
go
func (db *AgendaDB) loadAgenda(agendaID string) (*AgendaTagged, error) { agenda := new(AgendaTagged) if err := db.sdb.One("ID", agendaID, agenda); err != nil { return nil, err } return agenda, nil }
[ "func", "(", "db", "*", "AgendaDB", ")", "loadAgenda", "(", "agendaID", "string", ")", "(", "*", "AgendaTagged", ",", "error", ")", "{", "agenda", ":=", "new", "(", "AgendaTagged", ")", "\n", "if", "err", ":=", "db", ".", "sdb", ".", "One", "(", "\...
// loadAgenda retrieves an agenda corresponding to the specified unique agenda // ID, or returns nil if it does not exist.
[ "loadAgenda", "retrieves", "an", "agenda", "corresponding", "to", "the", "specified", "unique", "agenda", "ID", "or", "returns", "nil", "if", "it", "does", "not", "exist", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L137-L144
20,333
decred/dcrdata
gov/agendas/deployments.go
agendasForVoteVersion
func agendasForVoteVersion(ver uint32, client DeploymentSource) ([]AgendaTagged, error) { voteInfo, err := client.GetVoteInfo(ver) if err != nil { return nil, err } // Set the agendas slice capacity. agendas := make([]AgendaTagged, 0, len(voteInfo.Agendas)) for i := range voteInfo.Agendas { v := &voteInfo.Ag...
go
func agendasForVoteVersion(ver uint32, client DeploymentSource) ([]AgendaTagged, error) { voteInfo, err := client.GetVoteInfo(ver) if err != nil { return nil, err } // Set the agendas slice capacity. agendas := make([]AgendaTagged, 0, len(voteInfo.Agendas)) for i := range voteInfo.Agendas { v := &voteInfo.Ag...
[ "func", "agendasForVoteVersion", "(", "ver", "uint32", ",", "client", "DeploymentSource", ")", "(", "[", "]", "AgendaTagged", ",", "error", ")", "{", "voteInfo", ",", "err", ":=", "client", ".", "GetVoteInfo", "(", "ver", ")", "\n", "if", "err", "!=", "n...
// agendasForVoteVersion fetches the agendas using the vote versions provided.
[ "agendasForVoteVersion", "fetches", "the", "agendas", "using", "the", "vote", "versions", "provided", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L147-L171
20,334
decred/dcrdata
gov/agendas/deployments.go
updatedb
func (db *AgendaDB) updatedb(activeVersions map[uint32][]chaincfg.ConsensusDeployment) (int, error) { var agendas []AgendaTagged for voteVersion := range activeVersions { taggedAgendas, err := agendasForVoteVersion(voteVersion, db.rpcClient) if err != nil || len(taggedAgendas) == 0 { return -1, fmt.Errorf("vot...
go
func (db *AgendaDB) updatedb(activeVersions map[uint32][]chaincfg.ConsensusDeployment) (int, error) { var agendas []AgendaTagged for voteVersion := range activeVersions { taggedAgendas, err := agendasForVoteVersion(voteVersion, db.rpcClient) if err != nil || len(taggedAgendas) == 0 { return -1, fmt.Errorf("vot...
[ "func", "(", "db", "*", "AgendaDB", ")", "updatedb", "(", "activeVersions", "map", "[", "uint32", "]", "[", "]", "chaincfg", ".", "ConsensusDeployment", ")", "(", "int", ",", "error", ")", "{", "var", "agendas", "[", "]", "AgendaTagged", "\n", "for", "...
// updatedb checks if vote versions available in chaincfg.ConsensusDeployment // are already updated in the agendas db, if not yet their data is updated. // dcrjson.GetVoteInfoResult and chaincfg.ConsensusDeployment hold almost similar // data contents but chaincfg.Vote does not contain the important vote status // fie...
[ "updatedb", "checks", "if", "vote", "versions", "available", "in", "chaincfg", ".", "ConsensusDeployment", "are", "already", "updated", "in", "the", "agendas", "db", "if", "not", "yet", "their", "data", "is", "updated", ".", "dcrjson", ".", "GetVoteInfoResult", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L178-L200
20,335
decred/dcrdata
gov/agendas/deployments.go
storeAgenda
func (db *AgendaDB) storeAgenda(agenda *AgendaTagged) error { return db.sdb.Save(agenda) }
go
func (db *AgendaDB) storeAgenda(agenda *AgendaTagged) error { return db.sdb.Save(agenda) }
[ "func", "(", "db", "*", "AgendaDB", ")", "storeAgenda", "(", "agenda", "*", "AgendaTagged", ")", "error", "{", "return", "db", ".", "sdb", ".", "Save", "(", "agenda", ")", "\n", "}" ]
// storeAgenda saves an agenda in the database.
[ "storeAgenda", "saves", "an", "agenda", "in", "the", "database", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L203-L205
20,336
decred/dcrdata
gov/agendas/deployments.go
CheckAgendasUpdates
func (db *AgendaDB) CheckAgendasUpdates(activeVersions map[uint32][]chaincfg.ConsensusDeployment) error { if db == nil || db.sdb == nil { return errDefault } if len(activeVersions) == 0 { return nil } numRecords, err := db.updatedb(activeVersions) if err != nil { return fmt.Errorf("agendas.CheckAgendasUpd...
go
func (db *AgendaDB) CheckAgendasUpdates(activeVersions map[uint32][]chaincfg.ConsensusDeployment) error { if db == nil || db.sdb == nil { return errDefault } if len(activeVersions) == 0 { return nil } numRecords, err := db.updatedb(activeVersions) if err != nil { return fmt.Errorf("agendas.CheckAgendasUpd...
[ "func", "(", "db", "*", "AgendaDB", ")", "CheckAgendasUpdates", "(", "activeVersions", "map", "[", "uint32", "]", "[", "]", "chaincfg", ".", "ConsensusDeployment", ")", "error", "{", "if", "db", "==", "nil", "||", "db", ".", "sdb", "==", "nil", "{", "r...
// CheckAgendasUpdates checks for update at the start of the process and will // proceed to update when necessary.
[ "CheckAgendasUpdates", "checks", "for", "update", "at", "the", "start", "of", "the", "process", "and", "will", "proceed", "to", "update", "when", "necessary", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L209-L226
20,337
decred/dcrdata
gov/agendas/deployments.go
AgendaInfo
func (db *AgendaDB) AgendaInfo(agendaID string) (*AgendaTagged, error) { if db == nil || db.sdb == nil { return nil, errDefault } agenda, err := db.loadAgenda(agendaID) if err != nil { return nil, err } return agenda, nil }
go
func (db *AgendaDB) AgendaInfo(agendaID string) (*AgendaTagged, error) { if db == nil || db.sdb == nil { return nil, errDefault } agenda, err := db.loadAgenda(agendaID) if err != nil { return nil, err } return agenda, nil }
[ "func", "(", "db", "*", "AgendaDB", ")", "AgendaInfo", "(", "agendaID", "string", ")", "(", "*", "AgendaTagged", ",", "error", ")", "{", "if", "db", "==", "nil", "||", "db", ".", "sdb", "==", "nil", "{", "return", "nil", ",", "errDefault", "\n", "}...
// AgendaInfo fetches an agenda's details given it's agendaID.
[ "AgendaInfo", "fetches", "an", "agenda", "s", "details", "given", "it", "s", "agendaID", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L229-L240
20,338
decred/dcrdata
gov/agendas/deployments.go
AllAgendas
func (db *AgendaDB) AllAgendas() (agendas []*AgendaTagged, err error) { if db == nil || db.sdb == nil { return nil, errDefault } err = db.sdb.All(&agendas) if err != nil { log.Errorf("Failed to fetch data from Agendas DB: %v", err) } return }
go
func (db *AgendaDB) AllAgendas() (agendas []*AgendaTagged, err error) { if db == nil || db.sdb == nil { return nil, errDefault } err = db.sdb.All(&agendas) if err != nil { log.Errorf("Failed to fetch data from Agendas DB: %v", err) } return }
[ "func", "(", "db", "*", "AgendaDB", ")", "AllAgendas", "(", ")", "(", "agendas", "[", "]", "*", "AgendaTagged", ",", "err", "error", ")", "{", "if", "db", "==", "nil", "||", "db", ".", "sdb", "==", "nil", "{", "return", "nil", ",", "errDefault", ...
// AllAgendas returns all agendas and their info in the db.
[ "AllAgendas", "returns", "all", "agendas", "and", "their", "info", "in", "the", "db", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/agendas/deployments.go#L243-L253
20,339
decred/dcrdata
db/dbtypes/extraction.go
DevSubsidyAddress
func DevSubsidyAddress(params *chaincfg.Params) (string, error) { var devSubsidyAddress string var err error switch params.Name { case "testnet2": // TestNet2 uses an invalid organization PkScript devSubsidyAddress = "TccTkqj8wFqrUemmHMRSx8SYEueQYLmuuFk" err = fmt.Errorf("testnet2 has invalid project fund scr...
go
func DevSubsidyAddress(params *chaincfg.Params) (string, error) { var devSubsidyAddress string var err error switch params.Name { case "testnet2": // TestNet2 uses an invalid organization PkScript devSubsidyAddress = "TccTkqj8wFqrUemmHMRSx8SYEueQYLmuuFk" err = fmt.Errorf("testnet2 has invalid project fund scr...
[ "func", "DevSubsidyAddress", "(", "params", "*", "chaincfg", ".", "Params", ")", "(", "string", ",", "error", ")", "{", "var", "devSubsidyAddress", "string", "\n", "var", "err", "error", "\n", "switch", "params", ".", "Name", "{", "case", "\"", "\"", ":"...
// DevSubsidyAddress returns the development subsidy address for the specified // network.
[ "DevSubsidyAddress", "returns", "the", "development", "subsidy", "address", "for", "the", "specified", "network", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dbtypes/extraction.go#L17-L35
20,340
decred/dcrdata
db/dbtypes/extraction.go
ExtractBlockTransactions
func ExtractBlockTransactions(msgBlock *wire.MsgBlock, txTree int8, chainParams *chaincfg.Params, isValid, isMainchain bool) ([]*Tx, [][]*Vout, []VinTxPropertyARRAY) { dbTxs, dbTxVouts, dbTxVins := processTransactions(msgBlock, txTree, chainParams, isValid, isMainchain) if txTree != wire.TxTreeRegular && txTree !=...
go
func ExtractBlockTransactions(msgBlock *wire.MsgBlock, txTree int8, chainParams *chaincfg.Params, isValid, isMainchain bool) ([]*Tx, [][]*Vout, []VinTxPropertyARRAY) { dbTxs, dbTxVouts, dbTxVins := processTransactions(msgBlock, txTree, chainParams, isValid, isMainchain) if txTree != wire.TxTreeRegular && txTree !=...
[ "func", "ExtractBlockTransactions", "(", "msgBlock", "*", "wire", ".", "MsgBlock", ",", "txTree", "int8", ",", "chainParams", "*", "chaincfg", ".", "Params", ",", "isValid", ",", "isMainchain", "bool", ")", "(", "[", "]", "*", "Tx", ",", "[", "]", "[", ...
// ExtractBlockTransactions extracts transaction information from a // wire.MsgBlock and returns the processed information in slices of the dbtypes // Tx, Vout, and VinTxPropertyARRAY.
[ "ExtractBlockTransactions", "extracts", "transaction", "information", "from", "a", "wire", ".", "MsgBlock", "and", "returns", "the", "processed", "information", "in", "slices", "of", "the", "dbtypes", "Tx", "Vout", "and", "VinTxPropertyARRAY", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dbtypes/extraction.go#L40-L48
20,341
decred/dcrdata
gov/politeia/piclient/piclient.go
RetrieveAllProposals
func RetrieveAllProposals(client *http.Client, APIRootPath, URLParams string) ( *pitypes.Proposals, error) { // Constructs the full vetted proposals API URL URLpath := APIRootPath + piapi.RouteAllVetted + URLParams data, err := HandleGetRequests(client, URLpath) if err != nil { return nil, err } var publicPro...
go
func RetrieveAllProposals(client *http.Client, APIRootPath, URLParams string) ( *pitypes.Proposals, error) { // Constructs the full vetted proposals API URL URLpath := APIRootPath + piapi.RouteAllVetted + URLParams data, err := HandleGetRequests(client, URLpath) if err != nil { return nil, err } var publicPro...
[ "func", "RetrieveAllProposals", "(", "client", "*", "http", ".", "Client", ",", "APIRootPath", ",", "URLParams", "string", ")", "(", "*", "pitypes", ".", "Proposals", ",", "error", ")", "{", "// Constructs the full vetted proposals API URL", "URLpath", ":=", "APIR...
// RetrieveAllProposals returns a list of Proposals whose maximum count is defined // by piapi.ProposalListPageSize. Data returned is queried from Politeia API.
[ "RetrieveAllProposals", "returns", "a", "list", "of", "Proposals", "whose", "maximum", "count", "is", "defined", "by", "piapi", ".", "ProposalListPageSize", ".", "Data", "returned", "is", "queried", "from", "Politeia", "API", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/politeia/piclient/piclient.go#L54-L94
20,342
decred/dcrdata
gov/politeia/piclient/piclient.go
RetrieveProposalByToken
func RetrieveProposalByToken(client *http.Client, APIRootPath, token string) (*pitypes.Proposal, error) { // Constructs the full proposal's URl and fetch is data. proposalRoute := APIRootPath + DropURLRegex(piapi.RouteProposalDetails, token) data, err := HandleGetRequests(client, proposalRoute) if err != nil { re...
go
func RetrieveProposalByToken(client *http.Client, APIRootPath, token string) (*pitypes.Proposal, error) { // Constructs the full proposal's URl and fetch is data. proposalRoute := APIRootPath + DropURLRegex(piapi.RouteProposalDetails, token) data, err := HandleGetRequests(client, proposalRoute) if err != nil { re...
[ "func", "RetrieveProposalByToken", "(", "client", "*", "http", ".", "Client", ",", "APIRootPath", ",", "token", "string", ")", "(", "*", "pitypes", ".", "Proposal", ",", "error", ")", "{", "// Constructs the full proposal's URl and fetch is data.", "proposalRoute", ...
// RetrieveProposalByToken returns a single proposal identified by the token // hash provided if it exists. Data returned is queried from Politeia API.
[ "RetrieveProposalByToken", "returns", "a", "single", "proposal", "identified", "by", "the", "token", "hash", "provided", "if", "it", "exists", ".", "Data", "returned", "is", "queried", "from", "Politeia", "API", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/politeia/piclient/piclient.go#L98-L130
20,343
decred/dcrdata
explorer/syncstatus.go
ShowingSyncStatusPage
func (exp *explorerUI) ShowingSyncStatusPage() bool { display, ok := exp.displaySyncStatusPage.Load().(bool) return ok && display }
go
func (exp *explorerUI) ShowingSyncStatusPage() bool { display, ok := exp.displaySyncStatusPage.Load().(bool) return ok && display }
[ "func", "(", "exp", "*", "explorerUI", ")", "ShowingSyncStatusPage", "(", ")", "bool", "{", "display", ",", "ok", ":=", "exp", ".", "displaySyncStatusPage", ".", "Load", "(", ")", ".", "(", "bool", ")", "\n", "return", "ok", "&&", "display", "\n", "}" ...
// ShowingSyncStatusPage is a thread-safe way to fetch the // displaySyncStatusPage.
[ "ShowingSyncStatusPage", "is", "a", "thread", "-", "safe", "way", "to", "fetch", "the", "displaySyncStatusPage", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/syncstatus.go#L50-L53
20,344
decred/dcrdata
explorer/syncstatus.go
BeginSyncStatusUpdates
func (exp *explorerUI) BeginSyncStatusUpdates(barLoad chan *dbtypes.ProgressBarLoad) { // Do not start listening for updates if channel is nil. if barLoad == nil { log.Warnf("Not updating sync status page.") return } // stopTimer allows safe exit of the goroutine that triggers periodic // websocket progress u...
go
func (exp *explorerUI) BeginSyncStatusUpdates(barLoad chan *dbtypes.ProgressBarLoad) { // Do not start listening for updates if channel is nil. if barLoad == nil { log.Warnf("Not updating sync status page.") return } // stopTimer allows safe exit of the goroutine that triggers periodic // websocket progress u...
[ "func", "(", "exp", "*", "explorerUI", ")", "BeginSyncStatusUpdates", "(", "barLoad", "chan", "*", "dbtypes", ".", "ProgressBarLoad", ")", "{", "// Do not start listening for updates if channel is nil.", "if", "barLoad", "==", "nil", "{", "log", ".", "Warnf", "(", ...
// BeginSyncStatusUpdates receives the progress updates and and updates the // blockchainSyncStatus.ProgressBars.
[ "BeginSyncStatusUpdates", "receives", "the", "progress", "updates", "and", "and", "updates", "the", "blockchainSyncStatus", ".", "ProgressBars", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/syncstatus.go#L62-L152
20,345
decred/dcrdata
pubsub/pubsubhub.go
NewPubSubHub
func NewPubSubHub(dataSource wsDataSource) (*PubSubHub, error) { psh := new(PubSubHub) psh.sourceBase = dataSource // Allocate Mempool fields. psh.invs = new(exptypes.MempoolInfo) // Retrieve chain parameters. params := psh.sourceBase.GetChainParams() psh.params = params // Development subsidy address of the...
go
func NewPubSubHub(dataSource wsDataSource) (*PubSubHub, error) { psh := new(PubSubHub) psh.sourceBase = dataSource // Allocate Mempool fields. psh.invs = new(exptypes.MempoolInfo) // Retrieve chain parameters. params := psh.sourceBase.GetChainParams() psh.params = params // Development subsidy address of the...
[ "func", "NewPubSubHub", "(", "dataSource", "wsDataSource", ")", "(", "*", "PubSubHub", ",", "error", ")", "{", "psh", ":=", "new", "(", "PubSubHub", ")", "\n", "psh", ".", "sourceBase", "=", "dataSource", "\n\n", "// Allocate Mempool fields.", "psh", ".", "i...
// NewPubSubHub constructs a PubSubHub given a primary and auxiliary data // source. The primary data source is required, while the aux. source may be // nil, which indicates a "lite" mode of operation. The WebSocketHub is // automatically started.
[ "NewPubSubHub", "constructs", "a", "PubSubHub", "given", "a", "primary", "and", "auxiliary", "data", "source", ".", "The", "primary", "data", "source", "is", "required", "while", "the", "aux", ".", "source", "may", "be", "nil", "which", "indicates", "a", "li...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/pubsubhub.go#L89-L127
20,346
decred/dcrdata
pubsub/pubsubhub.go
StopWebsocketHub
func (psh *PubSubHub) StopWebsocketHub() { if psh == nil { return } log.Info("Stopping websocket hub.") psh.wsHub.Stop() }
go
func (psh *PubSubHub) StopWebsocketHub() { if psh == nil { return } log.Info("Stopping websocket hub.") psh.wsHub.Stop() }
[ "func", "(", "psh", "*", "PubSubHub", ")", "StopWebsocketHub", "(", ")", "{", "if", "psh", "==", "nil", "{", "return", "\n", "}", "\n", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "psh", ".", "wsHub", ".", "Stop", "(", ")", "\n", "}" ]
// StopWebsocketHub stops the websocket hub.
[ "StopWebsocketHub", "stops", "the", "websocket", "hub", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/pubsubhub.go#L130-L136
20,347
decred/dcrdata
pubsub/pubsubhub.go
closeWS
func closeWS(ws *websocket.Conn) { err := ws.Close() // Do not log error if connection is just closed if err != nil && !pstypes.IsWSClosedErr(err) && !pstypes.IsIOTimeoutErr(err) { log.Errorf("Failed to close websocket: %v", err) } }
go
func closeWS(ws *websocket.Conn) { err := ws.Close() // Do not log error if connection is just closed if err != nil && !pstypes.IsWSClosedErr(err) && !pstypes.IsIOTimeoutErr(err) { log.Errorf("Failed to close websocket: %v", err) } }
[ "func", "closeWS", "(", "ws", "*", "websocket", ".", "Conn", ")", "{", "err", ":=", "ws", ".", "Close", "(", ")", "\n", "// Do not log error if connection is just closed", "if", "err", "!=", "nil", "&&", "!", "pstypes", ".", "IsWSClosedErr", "(", "err", ")...
// closeWS attempts to close a websocket.Conn, logging errors other than those // with messages containing ErrWsClosed.
[ "closeWS", "attempts", "to", "close", "a", "websocket", ".", "Conn", "logging", "errors", "other", "than", "those", "with", "messages", "containing", "ErrWsClosed", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/pubsubhub.go#L163-L169
20,348
decred/dcrdata
pubsub/websocket.go
Ready
func (wsh *WebsocketHub) Ready() bool { syncing, ok := wsh.ready.Load().(bool) return ok && syncing }
go
func (wsh *WebsocketHub) Ready() bool { syncing, ok := wsh.ready.Load().(bool) return ok && syncing }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "Ready", "(", ")", "bool", "{", "syncing", ",", "ok", ":=", "wsh", ".", "ready", ".", "Load", "(", ")", ".", "(", "bool", ")", "\n", "return", "ok", "&&", "syncing", "\n", "}" ]
// Ready is a thread-safe way to fetch the boolean in ready.
[ "Ready", "is", "a", "thread", "-", "safe", "way", "to", "fetch", "the", "boolean", "in", "ready", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/websocket.go#L92-L95
20,349
decred/dcrdata
pubsub/websocket.go
NewWebsocketHub
func NewWebsocketHub() *WebsocketHub { return &WebsocketHub{ clients: make(map[*hubSpoke]*client), Register: make(chan *clientHubSpoke), Unregister: make(chan *hubSpoke), HubRelay: make(chan pstypes.HubMessage), bufferTickerChan: make(chan int, clientSignalSize), quitWSHandle...
go
func NewWebsocketHub() *WebsocketHub { return &WebsocketHub{ clients: make(map[*hubSpoke]*client), Register: make(chan *clientHubSpoke), Unregister: make(chan *hubSpoke), HubRelay: make(chan pstypes.HubMessage), bufferTickerChan: make(chan int, clientSignalSize), quitWSHandle...
[ "func", "NewWebsocketHub", "(", ")", "*", "WebsocketHub", "{", "return", "&", "WebsocketHub", "{", "clients", ":", "make", "(", "map", "[", "*", "hubSpoke", "]", "*", "client", ")", ",", "Register", ":", "make", "(", "chan", "*", "clientHubSpoke", ")", ...
// NewWebsocketHub creates a new WebsocketHub.
[ "NewWebsocketHub", "creates", "a", "new", "WebsocketHub", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/websocket.go#L189-L199
20,350
decred/dcrdata
pubsub/websocket.go
NewClientHubSpoke
func (wsh *WebsocketHub) NewClientHubSpoke() *clientHubSpoke { c := make(hubSpoke, 16) ch := &clientHubSpoke{ cl: newClient(), c: &c, } wsh.Register <- ch return ch }
go
func (wsh *WebsocketHub) NewClientHubSpoke() *clientHubSpoke { c := make(hubSpoke, 16) ch := &clientHubSpoke{ cl: newClient(), c: &c, } wsh.Register <- ch return ch }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "NewClientHubSpoke", "(", ")", "*", "clientHubSpoke", "{", "c", ":=", "make", "(", "hubSpoke", ",", "16", ")", "\n", "ch", ":=", "&", "clientHubSpoke", "{", "cl", ":", "newClient", "(", ")", ",", "c", ":"...
// NewClientHubSpoke registers a connection with the hub, and returns a pointer // to the new client data object. Use UnregisterClient on this object to stop // signaling messages, and close the signal channel.
[ "NewClientHubSpoke", "registers", "a", "connection", "with", "the", "hub", "and", "returns", "a", "pointer", "to", "the", "new", "client", "data", "object", ".", "Use", "UnregisterClient", "on", "this", "object", "to", "stop", "signaling", "messages", "and", "...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/websocket.go#L211-L219
20,351
decred/dcrdata
pubsub/websocket.go
registerClient
func (wsh *WebsocketHub) registerClient(ch *clientHubSpoke) { wsh.clients[ch.c] = ch.cl wsh.setNumClients(len(wsh.clients)) log.Debugf("Registered new websocket client (%d).", wsh.NumClients()) }
go
func (wsh *WebsocketHub) registerClient(ch *clientHubSpoke) { wsh.clients[ch.c] = ch.cl wsh.setNumClients(len(wsh.clients)) log.Debugf("Registered new websocket client (%d).", wsh.NumClients()) }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "registerClient", "(", "ch", "*", "clientHubSpoke", ")", "{", "wsh", ".", "clients", "[", "ch", ".", "c", "]", "=", "ch", ".", "cl", "\n", "wsh", ".", "setNumClients", "(", "len", "(", "wsh", ".", "clie...
// registerClient should only be called from the run loop.
[ "registerClient", "should", "only", "be", "called", "from", "the", "run", "loop", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/websocket.go#L233-L237
20,352
decred/dcrdata
pubsub/websocket.go
addTxToBuffer
func (wsh *WebsocketHub) addTxToBuffer(tx *exptypes.MempoolTx) (someReadyToSend bool) { for _, client := range wsh.clients { someReadyToSend = client.newTxs.addTxToBuffer(tx) } return }
go
func (wsh *WebsocketHub) addTxToBuffer(tx *exptypes.MempoolTx) (someReadyToSend bool) { for _, client := range wsh.clients { someReadyToSend = client.newTxs.addTxToBuffer(tx) } return }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "addTxToBuffer", "(", "tx", "*", "exptypes", ".", "MempoolTx", ")", "(", "someReadyToSend", "bool", ")", "{", "for", "_", ",", "client", ":=", "range", "wsh", ".", "clients", "{", "someReadyToSend", "=", "cli...
// addTxToBuffer adds a tx to each client's tx buffer. The return boolean value // indicates if at least one buffer is ready to be sent.
[ "addTxToBuffer", "adds", "a", "tx", "to", "each", "client", "s", "tx", "buffer", ".", "The", "return", "boolean", "value", "indicates", "if", "at", "least", "one", "buffer", "is", "ready", "to", "be", "sent", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/websocket.go#L465-L470
20,353
decred/dcrdata
pubsub/websocket.go
periodicTxBufferSend
func (wsh *WebsocketHub) periodicTxBufferSend() { ticker := time.NewTicker(bufferTickerInterval * time.Second) for { select { case <-ticker.C: wsh.SetTimeToSendTxBuffer(true) case sig := <-wsh.bufferTickerChan: switch sig { case tickerSigReset: ticker.Stop() ticker = time.NewTicker(bufferTicker...
go
func (wsh *WebsocketHub) periodicTxBufferSend() { ticker := time.NewTicker(bufferTickerInterval * time.Second) for { select { case <-ticker.C: wsh.SetTimeToSendTxBuffer(true) case sig := <-wsh.bufferTickerChan: switch sig { case tickerSigReset: ticker.Stop() ticker = time.NewTicker(bufferTicker...
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "periodicTxBufferSend", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "bufferTickerInterval", "*", "time", ".", "Second", ")", "\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C"...
// periodicTxBufferSend initiates a transaction buffer send via sendTxBufferChan // every bufferTickerInterval seconds.
[ "periodicTxBufferSend", "initiates", "a", "transaction", "buffer", "send", "via", "sendTxBufferChan", "every", "bufferTickerInterval", "seconds", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/pubsub/websocket.go#L474-L491
20,354
decred/dcrdata
txhelpers/txhelpers.go
HashInSlice
func HashInSlice(h chainhash.Hash, list []chainhash.Hash) bool { for _, hash := range list { if h == hash { return true } } return false }
go
func HashInSlice(h chainhash.Hash, list []chainhash.Hash) bool { for _, hash := range list { if h == hash { return true } } return false }
[ "func", "HashInSlice", "(", "h", "chainhash", ".", "Hash", ",", "list", "[", "]", "chainhash", ".", "Hash", ")", "bool", "{", "for", "_", ",", "hash", ":=", "range", "list", "{", "if", "h", "==", "hash", "{", "return", "true", "\n", "}", "\n", "}...
// HashInSlice determines if a hash exists in a slice of hashes.
[ "HashInSlice", "determines", "if", "a", "hash", "exists", "in", "a", "slice", "of", "hashes", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L100-L107
20,355
decred/dcrdata
txhelpers/txhelpers.go
IncludesStakeTx
func IncludesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) { blockTxs := block.STransactions() if tx := TxhashInSlice(blockTxs, txHash); tx != nil { return tx.Index(), tx.Tree() } return -1, -1 }
go
func IncludesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) { blockTxs := block.STransactions() if tx := TxhashInSlice(blockTxs, txHash); tx != nil { return tx.Index(), tx.Tree() } return -1, -1 }
[ "func", "IncludesStakeTx", "(", "txHash", "*", "chainhash", ".", "Hash", ",", "block", "*", "dcrutil", ".", "Block", ")", "(", "int", ",", "int8", ")", "{", "blockTxs", ":=", "block", ".", "STransactions", "(", ")", "\n\n", "if", "tx", ":=", "TxhashInS...
// IncludesStakeTx checks if a block contains a stake transaction hash
[ "IncludesStakeTx", "checks", "if", "a", "block", "contains", "a", "stake", "transaction", "hash" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L126-L133
20,356
decred/dcrdata
txhelpers/txhelpers.go
IncludesTx
func IncludesTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) { blockTxs := block.Transactions() if tx := TxhashInSlice(blockTxs, txHash); tx != nil { return tx.Index(), tx.Tree() } return -1, -1 }
go
func IncludesTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) { blockTxs := block.Transactions() if tx := TxhashInSlice(blockTxs, txHash); tx != nil { return tx.Index(), tx.Tree() } return -1, -1 }
[ "func", "IncludesTx", "(", "txHash", "*", "chainhash", ".", "Hash", ",", "block", "*", "dcrutil", ".", "Block", ")", "(", "int", ",", "int8", ")", "{", "blockTxs", ":=", "block", ".", "Transactions", "(", ")", "\n\n", "if", "tx", ":=", "TxhashInSlice",...
// IncludesTx checks if a block contains a transaction hash
[ "IncludesTx", "checks", "if", "a", "block", "contains", "a", "transaction", "hash" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L136-L143
20,357
decred/dcrdata
txhelpers/txhelpers.go
Update
func (a *AddressOutpoints) Update(txns []*TxWithBlockData, outpoints []*wire.OutPoint, prevOutpoint []PrevOut) { // Relevant outpoints a.Outpoints = append(a.Outpoints, outpoints...) // Previous outpoints (inputs) a.PrevOuts = append(a.PrevOuts, prevOutpoint...) // Referenced transactions for _, t := range txn...
go
func (a *AddressOutpoints) Update(txns []*TxWithBlockData, outpoints []*wire.OutPoint, prevOutpoint []PrevOut) { // Relevant outpoints a.Outpoints = append(a.Outpoints, outpoints...) // Previous outpoints (inputs) a.PrevOuts = append(a.PrevOuts, prevOutpoint...) // Referenced transactions for _, t := range txn...
[ "func", "(", "a", "*", "AddressOutpoints", ")", "Update", "(", "txns", "[", "]", "*", "TxWithBlockData", ",", "outpoints", "[", "]", "*", "wire", ".", "OutPoint", ",", "prevOutpoint", "[", "]", "PrevOut", ")", "{", "// Relevant outpoints", "a", ".", "Out...
// Update appends the provided outpoints, and merges the transactions.
[ "Update", "appends", "the", "provided", "outpoints", "and", "merges", "the", "transactions", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L209-L221
20,358
decred/dcrdata
txhelpers/txhelpers.go
Merge
func (a *AddressOutpoints) Merge(ao *AddressOutpoints) { // Relevant outpoints a.Outpoints = append(a.Outpoints, ao.Outpoints...) // Previous outpoints (inputs) a.PrevOuts = append(a.PrevOuts, ao.PrevOuts...) // Referenced transactions for h, t := range ao.TxnsStore { a.TxnsStore[h] = t } }
go
func (a *AddressOutpoints) Merge(ao *AddressOutpoints) { // Relevant outpoints a.Outpoints = append(a.Outpoints, ao.Outpoints...) // Previous outpoints (inputs) a.PrevOuts = append(a.PrevOuts, ao.PrevOuts...) // Referenced transactions for h, t := range ao.TxnsStore { a.TxnsStore[h] = t } }
[ "func", "(", "a", "*", "AddressOutpoints", ")", "Merge", "(", "ao", "*", "AddressOutpoints", ")", "{", "// Relevant outpoints", "a", ".", "Outpoints", "=", "append", "(", "a", ".", "Outpoints", ",", "ao", ".", "Outpoints", "...", ")", "\n\n", "// Previous ...
// Merge concatenates the outpoints of two AddressOutpoints, and merges the // transactions.
[ "Merge", "concatenates", "the", "outpoints", "of", "two", "AddressOutpoints", "and", "merges", "the", "transactions", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L225-L236
20,359
decred/dcrdata
txhelpers/txhelpers.go
TxInvolvesAddress
func TxInvolvesAddress(msgTx *wire.MsgTx, addr string, c VerboseTransactionGetter, params *chaincfg.Params) (outpoints []*wire.OutPoint, prevOuts []PrevOut, prevTxs []*TxWithBlockData) { // The outpoints of this transaction paying to the address outpoints = TxPaysToAddress(msgTx, addr, params) // The inputs of thi...
go
func TxInvolvesAddress(msgTx *wire.MsgTx, addr string, c VerboseTransactionGetter, params *chaincfg.Params) (outpoints []*wire.OutPoint, prevOuts []PrevOut, prevTxs []*TxWithBlockData) { // The outpoints of this transaction paying to the address outpoints = TxPaysToAddress(msgTx, addr, params) // The inputs of thi...
[ "func", "TxInvolvesAddress", "(", "msgTx", "*", "wire", ".", "MsgTx", ",", "addr", "string", ",", "c", "VerboseTransactionGetter", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "outpoints", "[", "]", "*", "wire", ".", "OutPoint", ",", "prevOuts"...
// TxInvolvesAddress checks the inputs and outputs of a transaction for // involvement of the given address.
[ "TxInvolvesAddress", "checks", "the", "inputs", "and", "outputs", "of", "a", "transaction", "for", "involvement", "of", "the", "given", "address", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L240-L249
20,360
decred/dcrdata
txhelpers/txhelpers.go
TxOutpointsByAddr
func TxOutpointsByAddr(txAddrOuts MempoolAddressStore, msgTx *wire.MsgTx, params *chaincfg.Params) (newOuts int, addrs map[string]bool) { if txAddrOuts == nil { panic("TxAddressOutpoints: input map must be initialized: map[string]*AddressOutpoints") } // Check the addresses associated with the PkScript of each Tx...
go
func TxOutpointsByAddr(txAddrOuts MempoolAddressStore, msgTx *wire.MsgTx, params *chaincfg.Params) (newOuts int, addrs map[string]bool) { if txAddrOuts == nil { panic("TxAddressOutpoints: input map must be initialized: map[string]*AddressOutpoints") } // Check the addresses associated with the PkScript of each Tx...
[ "func", "TxOutpointsByAddr", "(", "txAddrOuts", "MempoolAddressStore", ",", "msgTx", "*", "wire", ".", "MsgTx", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "newOuts", "int", ",", "addrs", "map", "[", "string", "]", "bool", ")", "{", "if", "t...
// TxOutpointsByAddr sets the Outpoints field for the AddressOutpoints stored in // the input MempoolAddressStore. For addresses not yet present in the // MempoolAddressStore, a new AddressOutpoints is added to the store. The // provided MempoolAddressStore must be initialized. The number of msgTx outputs // that pay t...
[ "TxOutpointsByAddr", "sets", "the", "Outpoints", "field", "for", "the", "AddressOutpoints", "stored", "in", "the", "input", "MempoolAddressStore", ".", "For", "addresses", "not", "yet", "present", "in", "the", "MempoolAddressStore", "a", "new", "AddressOutpoints", "...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L264-L308
20,361
decred/dcrdata
txhelpers/txhelpers.go
TxPrevOutsByAddr
func TxPrevOutsByAddr(txAddrOuts MempoolAddressStore, txnsStore TxnsStore, msgTx *wire.MsgTx, c VerboseTransactionGetter, params *chaincfg.Params) (newPrevOuts int, addrs map[string]bool) { if txAddrOuts == nil { panic("TxPrevOutAddresses: input map must be initialized: map[string]*AddressOutpoints") } if txnsStor...
go
func TxPrevOutsByAddr(txAddrOuts MempoolAddressStore, txnsStore TxnsStore, msgTx *wire.MsgTx, c VerboseTransactionGetter, params *chaincfg.Params) (newPrevOuts int, addrs map[string]bool) { if txAddrOuts == nil { panic("TxPrevOutAddresses: input map must be initialized: map[string]*AddressOutpoints") } if txnsStor...
[ "func", "TxPrevOutsByAddr", "(", "txAddrOuts", "MempoolAddressStore", ",", "txnsStore", "TxnsStore", ",", "msgTx", "*", "wire", ".", "MsgTx", ",", "c", "VerboseTransactionGetter", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "newPrevOuts", "int", ","...
// TxPrevOutsByAddr sets the PrevOuts field for the AddressOutpoints stored in // the MempoolAddressStore. For addresses not yet present in the // MempoolAddressStore, a new AddressOutpoints is added to the store. The // provided MempoolAddressStore must be initialized. A VerboseTransactionGetter // is required to retr...
[ "TxPrevOutsByAddr", "sets", "the", "PrevOuts", "field", "for", "the", "AddressOutpoints", "stored", "in", "the", "MempoolAddressStore", ".", "For", "addresses", "not", "yet", "present", "in", "the", "MempoolAddressStore", "a", "new", "AddressOutpoints", "is", "added...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L319-L436
20,362
decred/dcrdata
txhelpers/txhelpers.go
TxConsumesOutpointWithAddress
func TxConsumesOutpointWithAddress(msgTx *wire.MsgTx, addr string, c VerboseTransactionGetter, params *chaincfg.Params) (prevOuts []PrevOut, prevTxs []*TxWithBlockData) { // Send all the raw transaction requests type promiseGetRawTransaction struct { result rpcclient.FutureGetRawTransactionVerboseResult inIdx i...
go
func TxConsumesOutpointWithAddress(msgTx *wire.MsgTx, addr string, c VerboseTransactionGetter, params *chaincfg.Params) (prevOuts []PrevOut, prevTxs []*TxWithBlockData) { // Send all the raw transaction requests type promiseGetRawTransaction struct { result rpcclient.FutureGetRawTransactionVerboseResult inIdx i...
[ "func", "TxConsumesOutpointWithAddress", "(", "msgTx", "*", "wire", ".", "MsgTx", ",", "addr", "string", ",", "c", "VerboseTransactionGetter", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "prevOuts", "[", "]", "PrevOut", ",", "prevTxs", "[", "]",...
// TxConsumesOutpointWithAddress checks a transaction for inputs that spend an // outpoint paying to the given address. Returned are the identified input // indexes and the corresponding previous outpoints determined.
[ "TxConsumesOutpointWithAddress", "checks", "a", "transaction", "for", "inputs", "that", "spend", "an", "outpoint", "paying", "to", "the", "given", "address", ".", "Returned", "are", "the", "identified", "input", "indexes", "and", "the", "corresponding", "previous", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L441-L518
20,363
decred/dcrdata
txhelpers/txhelpers.go
BlockConsumesOutpointWithAddresses
func BlockConsumesOutpointWithAddresses(block *dcrutil.Block, addrs map[string]TxAction, c RawTransactionGetter, params *chaincfg.Params) map[string][]*dcrutil.Tx { addrMap := make(map[string][]*dcrutil.Tx) checkForOutpointAddr := func(blockTxs []*dcrutil.Tx) { for _, tx := range blockTxs { for _, txIn := rang...
go
func BlockConsumesOutpointWithAddresses(block *dcrutil.Block, addrs map[string]TxAction, c RawTransactionGetter, params *chaincfg.Params) map[string][]*dcrutil.Tx { addrMap := make(map[string][]*dcrutil.Tx) checkForOutpointAddr := func(blockTxs []*dcrutil.Tx) { for _, tx := range blockTxs { for _, txIn := rang...
[ "func", "BlockConsumesOutpointWithAddresses", "(", "block", "*", "dcrutil", ".", "Block", ",", "addrs", "map", "[", "string", "]", "TxAction", ",", "c", "RawTransactionGetter", ",", "params", "*", "chaincfg", ".", "Params", ")", "map", "[", "string", "]", "[...
// BlockConsumesOutpointWithAddresses checks the specified block to see if it // includes transactions that spend from outputs created using any of the // addresses in addrs. The TxAction for each address is not important, but it // would logically be TxMined. Both regular and stake transactions are checked. // The RPC...
[ "BlockConsumesOutpointWithAddresses", "checks", "the", "specified", "block", "to", "see", "if", "it", "includes", "transactions", "that", "spend", "from", "outputs", "created", "using", "any", "of", "the", "addresses", "in", "addrs", ".", "The", "TxAction", "for",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L527-L574
20,364
decred/dcrdata
txhelpers/txhelpers.go
TxPaysToAddress
func TxPaysToAddress(msgTx *wire.MsgTx, addr string, params *chaincfg.Params) (outpoints []*wire.OutPoint) { // Check the addresses associated with the PkScript of each TxOut txTree := TxTree(msgTx) hash := msgTx.TxHash() for outIndex, txOut := range msgTx.TxOut { _, txOutAddrs, _, err := txscript.ExtractPkScrip...
go
func TxPaysToAddress(msgTx *wire.MsgTx, addr string, params *chaincfg.Params) (outpoints []*wire.OutPoint) { // Check the addresses associated with the PkScript of each TxOut txTree := TxTree(msgTx) hash := msgTx.TxHash() for outIndex, txOut := range msgTx.TxOut { _, txOutAddrs, _, err := txscript.ExtractPkScrip...
[ "func", "TxPaysToAddress", "(", "msgTx", "*", "wire", ".", "MsgTx", ",", "addr", "string", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "outpoints", "[", "]", "*", "wire", ".", "OutPoint", ")", "{", "// Check the addresses associated with the PkScr...
// TxPaysToAddress returns a slice of outpoints of a transaction which pay to // specified address.
[ "TxPaysToAddress", "returns", "a", "slice", "of", "outpoints", "of", "a", "transaction", "which", "pay", "to", "specified", "address", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L578-L601
20,365
decred/dcrdata
txhelpers/txhelpers.go
BlockReceivesToAddresses
func BlockReceivesToAddresses(block *dcrutil.Block, addrs map[string]TxAction, params *chaincfg.Params) map[string][]*dcrutil.Tx { addrMap := make(map[string][]*dcrutil.Tx) checkForAddrOut := func(blockTxs []*dcrutil.Tx) { for _, tx := range blockTxs { // Check the addresses associated with the PkScript of eac...
go
func BlockReceivesToAddresses(block *dcrutil.Block, addrs map[string]TxAction, params *chaincfg.Params) map[string][]*dcrutil.Tx { addrMap := make(map[string][]*dcrutil.Tx) checkForAddrOut := func(blockTxs []*dcrutil.Tx) { for _, tx := range blockTxs { // Check the addresses associated with the PkScript of eac...
[ "func", "BlockReceivesToAddresses", "(", "block", "*", "dcrutil", ".", "Block", ",", "addrs", "map", "[", "string", "]", "TxAction", ",", "params", "*", "chaincfg", ".", "Params", ")", "map", "[", "string", "]", "[", "]", "*", "dcrutil", ".", "Tx", "{"...
// BlockReceivesToAddresses checks a block for transactions paying to the // specified addresses, and creates a map of addresses to a slice of dcrutil.Tx // involving the address.
[ "BlockReceivesToAddresses", "checks", "a", "block", "for", "transactions", "paying", "to", "the", "specified", "addresses", "and", "creates", "a", "map", "of", "addresses", "to", "a", "slice", "of", "dcrutil", ".", "Tx", "involving", "the", "address", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L606-L639
20,366
decred/dcrdata
txhelpers/txhelpers.go
OutPointAddresses
func OutPointAddresses(outPoint *wire.OutPoint, c RawTransactionGetter, params *chaincfg.Params) ([]string, dcrutil.Amount, error) { // The addresses are encoded in the pkScript, so we need to get the // raw transaction, and the TxOut that contains the pkScript. prevTx, err := c.GetRawTransaction(&outPoint.Hash) i...
go
func OutPointAddresses(outPoint *wire.OutPoint, c RawTransactionGetter, params *chaincfg.Params) ([]string, dcrutil.Amount, error) { // The addresses are encoded in the pkScript, so we need to get the // raw transaction, and the TxOut that contains the pkScript. prevTx, err := c.GetRawTransaction(&outPoint.Hash) i...
[ "func", "OutPointAddresses", "(", "outPoint", "*", "wire", ".", "OutPoint", ",", "c", "RawTransactionGetter", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "[", "]", "string", ",", "dcrutil", ".", "Amount", ",", "error", ")", "{", "// The addres...
// OutPointAddresses gets the addresses paid to by a transaction output.
[ "OutPointAddresses", "gets", "the", "addresses", "paid", "to", "by", "a", "transaction", "output", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L642-L671
20,367
decred/dcrdata
txhelpers/txhelpers.go
OutPointAddressesFromString
func OutPointAddressesFromString(txid string, index uint32, tree int8, c RawTransactionGetter, params *chaincfg.Params) ([]string, error) { hash, err := chainhash.NewHashFromStr(txid) if err != nil { return nil, fmt.Errorf("Invalid hash %s", txid) } outPoint := wire.NewOutPoint(hash, index, tree) outPointAddre...
go
func OutPointAddressesFromString(txid string, index uint32, tree int8, c RawTransactionGetter, params *chaincfg.Params) ([]string, error) { hash, err := chainhash.NewHashFromStr(txid) if err != nil { return nil, fmt.Errorf("Invalid hash %s", txid) } outPoint := wire.NewOutPoint(hash, index, tree) outPointAddre...
[ "func", "OutPointAddressesFromString", "(", "txid", "string", ",", "index", "uint32", ",", "tree", "int8", ",", "c", "RawTransactionGetter", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "[", "]", "string", ",", "error", ")", "{", "hash", ",", ...
// OutPointAddressesFromString is the same as OutPointAddresses, but it takes // the outpoint as the tx string, vout index, and tree.
[ "OutPointAddressesFromString", "is", "the", "same", "as", "OutPointAddresses", "but", "it", "takes", "the", "outpoint", "as", "the", "tx", "string", "vout", "index", "and", "tree", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L675-L685
20,368
decred/dcrdata
txhelpers/txhelpers.go
MedianAmount
func MedianAmount(s []dcrutil.Amount) dcrutil.Amount { if len(s) == 0 { return 0 } sort.Sort(dcrutil.AmountSorter(s)) middle := len(s) / 2 if len(s) == 0 { return 0 } else if (len(s) % 2) != 0 { return s[middle] } return (s[middle] + s[middle-1]) / 2 }
go
func MedianAmount(s []dcrutil.Amount) dcrutil.Amount { if len(s) == 0 { return 0 } sort.Sort(dcrutil.AmountSorter(s)) middle := len(s) / 2 if len(s) == 0 { return 0 } else if (len(s) % 2) != 0 { return s[middle] } return (s[middle] + s[middle-1]) / 2 }
[ "func", "MedianAmount", "(", "s", "[", "]", "dcrutil", ".", "Amount", ")", "dcrutil", ".", "Amount", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "0", "\n", "}", "\n\n", "sort", ".", "Sort", "(", "dcrutil", ".", "AmountSorter", "(", ...
// MedianAmount gets the median Amount from a slice of Amounts
[ "MedianAmount", "gets", "the", "median", "Amount", "from", "a", "slice", "of", "Amounts" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L688-L703
20,369
decred/dcrdata
txhelpers/txhelpers.go
MedianCoin
func MedianCoin(s []float64) float64 { if len(s) == 0 { return 0 } sort.Float64s(s) middle := len(s) / 2 if len(s) == 0 { return 0 } else if (len(s) % 2) != 0 { return s[middle] } return (s[middle] + s[middle-1]) / 2 }
go
func MedianCoin(s []float64) float64 { if len(s) == 0 { return 0 } sort.Float64s(s) middle := len(s) / 2 if len(s) == 0 { return 0 } else if (len(s) % 2) != 0 { return s[middle] } return (s[middle] + s[middle-1]) / 2 }
[ "func", "MedianCoin", "(", "s", "[", "]", "float64", ")", "float64", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "0", "\n", "}", "\n\n", "sort", ".", "Float64s", "(", "s", ")", "\n\n", "middle", ":=", "len", "(", "s", ")", "/", ...
// MedianCoin gets the median DCR from a slice of float64s
[ "MedianCoin", "gets", "the", "median", "DCR", "from", "a", "slice", "of", "float64s" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L706-L721
20,370
decred/dcrdata
txhelpers/txhelpers.go
GetDifficultyRatio
func GetDifficultyRatio(bits uint32, params *chaincfg.Params) float64 { // The minimum difficulty is the max possible proof-of-work limit bits // converted back to a number. Note this is not the same as the proof of // work limit directly because the block difficulty is encoded in a block // with the compact form ...
go
func GetDifficultyRatio(bits uint32, params *chaincfg.Params) float64 { // The minimum difficulty is the max possible proof-of-work limit bits // converted back to a number. Note this is not the same as the proof of // work limit directly because the block difficulty is encoded in a block // with the compact form ...
[ "func", "GetDifficultyRatio", "(", "bits", "uint32", ",", "params", "*", "chaincfg", ".", "Params", ")", "float64", "{", "// The minimum difficulty is the max possible proof-of-work limit bits", "// converted back to a number. Note this is not the same as the proof of", "// work lim...
// GetDifficultyRatio returns the proof-of-work difficulty as a multiple of the // minimum difficulty using the passed bits field from the header of a block.
[ "GetDifficultyRatio", "returns", "the", "proof", "-", "of", "-", "work", "difficulty", "as", "a", "multiple", "of", "the", "minimum", "difficulty", "using", "the", "passed", "bits", "field", "from", "the", "header", "of", "a", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L725-L741
20,371
decred/dcrdata
txhelpers/txhelpers.go
SSTXInBlock
func SSTXInBlock(block *dcrutil.Block) []*dcrutil.Tx { _, txns := TicketTxnsInBlock(block) return txns }
go
func SSTXInBlock(block *dcrutil.Block) []*dcrutil.Tx { _, txns := TicketTxnsInBlock(block) return txns }
[ "func", "SSTXInBlock", "(", "block", "*", "dcrutil", ".", "Block", ")", "[", "]", "*", "dcrutil", ".", "Tx", "{", "_", ",", "txns", ":=", "TicketTxnsInBlock", "(", "block", ")", "\n", "return", "txns", "\n", "}" ]
// SSTXInBlock gets a slice containing all of the SSTX mined in a block
[ "SSTXInBlock", "gets", "a", "slice", "containing", "all", "of", "the", "SSTX", "mined", "in", "a", "block" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L744-L747
20,372
decred/dcrdata
txhelpers/txhelpers.go
VoteBitsInBlock
func VoteBitsInBlock(block *dcrutil.Block) []stake.VoteVersionTuple { var voteBits []stake.VoteVersionTuple for _, stx := range block.MsgBlock().STransactions { if !stake.IsSSGen(stx) { continue } voteBits = append(voteBits, stake.VoteVersionTuple{ Version: stake.SSGenVersion(stx), Bits: stake.SSGe...
go
func VoteBitsInBlock(block *dcrutil.Block) []stake.VoteVersionTuple { var voteBits []stake.VoteVersionTuple for _, stx := range block.MsgBlock().STransactions { if !stake.IsSSGen(stx) { continue } voteBits = append(voteBits, stake.VoteVersionTuple{ Version: stake.SSGenVersion(stx), Bits: stake.SSGe...
[ "func", "VoteBitsInBlock", "(", "block", "*", "dcrutil", ".", "Block", ")", "[", "]", "stake", ".", "VoteVersionTuple", "{", "var", "voteBits", "[", "]", "stake", ".", "VoteVersionTuple", "\n", "for", "_", ",", "stx", ":=", "range", "block", ".", "MsgBlo...
// VoteBitsInBlock returns a list of vote bits for the votes in a block
[ "VoteBitsInBlock", "returns", "a", "list", "of", "vote", "bits", "for", "the", "votes", "in", "a", "block" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L769-L783
20,373
decred/dcrdata
txhelpers/txhelpers.go
VoteVersion
func VoteVersion(pkScript []byte) uint32 { if len(pkScript) < 8 { return stake.VoteConsensusVersionAbsent } return binary.LittleEndian.Uint32(pkScript[4:8]) }
go
func VoteVersion(pkScript []byte) uint32 { if len(pkScript) < 8 { return stake.VoteConsensusVersionAbsent } return binary.LittleEndian.Uint32(pkScript[4:8]) }
[ "func", "VoteVersion", "(", "pkScript", "[", "]", "byte", ")", "uint32", "{", "if", "len", "(", "pkScript", ")", "<", "8", "{", "return", "stake", ".", "VoteConsensusVersionAbsent", "\n", "}", "\n\n", "return", "binary", ".", "LittleEndian", ".", "Uint32",...
// VoteVersion extracts the vote version from the input pubkey script.
[ "VoteVersion", "extracts", "the", "vote", "version", "from", "the", "input", "pubkey", "script", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L840-L846
20,374
decred/dcrdata
txhelpers/txhelpers.go
FeeInfoBlock
func FeeInfoBlock(block *dcrutil.Block) *dcrjson.FeeInfoBlock { feeInfo := new(dcrjson.FeeInfoBlock) _, sstxMsgTxns := TicketsInBlock(block) feeInfo.Height = uint32(block.Height()) feeInfo.Number = uint32(len(sstxMsgTxns)) var minFee, maxFee, meanFee float64 minFee = math.MaxFloat64 fees := make([]float64, fee...
go
func FeeInfoBlock(block *dcrutil.Block) *dcrjson.FeeInfoBlock { feeInfo := new(dcrjson.FeeInfoBlock) _, sstxMsgTxns := TicketsInBlock(block) feeInfo.Height = uint32(block.Height()) feeInfo.Number = uint32(len(sstxMsgTxns)) var minFee, maxFee, meanFee float64 minFee = math.MaxFloat64 fees := make([]float64, fee...
[ "func", "FeeInfoBlock", "(", "block", "*", "dcrutil", ".", "Block", ")", "*", "dcrjson", ".", "FeeInfoBlock", "{", "feeInfo", ":=", "new", "(", "dcrjson", ".", "FeeInfoBlock", ")", "\n", "_", ",", "sstxMsgTxns", ":=", "TicketsInBlock", "(", "block", ")", ...
// FeeInfoBlock computes ticket fee statistics for the tickets included in the // specified block.
[ "FeeInfoBlock", "computes", "ticket", "fee", "statistics", "for", "the", "tickets", "included", "in", "the", "specified", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L889-L938
20,375
decred/dcrdata
txhelpers/txhelpers.go
MsgTxFromHex
func MsgTxFromHex(txhex string) (*wire.MsgTx, error) { msgTx := wire.NewMsgTx() if err := msgTx.Deserialize(hex.NewDecoder(strings.NewReader(txhex))); err != nil { return nil, err } return msgTx, nil }
go
func MsgTxFromHex(txhex string) (*wire.MsgTx, error) { msgTx := wire.NewMsgTx() if err := msgTx.Deserialize(hex.NewDecoder(strings.NewReader(txhex))); err != nil { return nil, err } return msgTx, nil }
[ "func", "MsgTxFromHex", "(", "txhex", "string", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "msgTx", ":=", "wire", ".", "NewMsgTx", "(", ")", "\n", "if", "err", ":=", "msgTx", ".", "Deserialize", "(", "hex", ".", "NewDecoder", "(", ...
// MsgTxFromHex returns a wire.MsgTx struct built from the transaction hex string.
[ "MsgTxFromHex", "returns", "a", "wire", ".", "MsgTx", "struct", "built", "from", "the", "transaction", "hex", "string", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L993-L999
20,376
decred/dcrdata
txhelpers/txhelpers.go
DetermineTxTypeString
func DetermineTxTypeString(msgTx *wire.MsgTx) string { switch stake.DetermineTxType(msgTx) { case stake.TxTypeSSGen: return "Vote" case stake.TxTypeSStx: return "Ticket" case stake.TxTypeSSRtx: return "Revocation" default: return "Regular" } }
go
func DetermineTxTypeString(msgTx *wire.MsgTx) string { switch stake.DetermineTxType(msgTx) { case stake.TxTypeSSGen: return "Vote" case stake.TxTypeSStx: return "Ticket" case stake.TxTypeSSRtx: return "Revocation" default: return "Regular" } }
[ "func", "DetermineTxTypeString", "(", "msgTx", "*", "wire", ".", "MsgTx", ")", "string", "{", "switch", "stake", ".", "DetermineTxType", "(", "msgTx", ")", "{", "case", "stake", ".", "TxTypeSSGen", ":", "return", "\"", "\"", "\n", "case", "stake", ".", "...
// DetermineTxTypeString returns a string representing the transaction type given // a wire.MsgTx struct
[ "DetermineTxTypeString", "returns", "a", "string", "representing", "the", "transaction", "type", "given", "a", "wire", ".", "MsgTx", "struct" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1003-L1014
20,377
decred/dcrdata
txhelpers/txhelpers.go
TxTypeToString
func TxTypeToString(txType int) string { switch stake.TxType(txType) { case stake.TxTypeSSGen: return "Vote" case stake.TxTypeSStx: return "Ticket" case stake.TxTypeSSRtx: return "Revocation" default: return "Regular" } }
go
func TxTypeToString(txType int) string { switch stake.TxType(txType) { case stake.TxTypeSSGen: return "Vote" case stake.TxTypeSStx: return "Ticket" case stake.TxTypeSSRtx: return "Revocation" default: return "Regular" } }
[ "func", "TxTypeToString", "(", "txType", "int", ")", "string", "{", "switch", "stake", ".", "TxType", "(", "txType", ")", "{", "case", "stake", ".", "TxTypeSSGen", ":", "return", "\"", "\"", "\n", "case", "stake", ".", "TxTypeSStx", ":", "return", "\"", ...
// TxTypeToString returns a string representation of the provided transaction // type, which corresponds to the txn types defined for stake.TxType type.
[ "TxTypeToString", "returns", "a", "string", "representation", "of", "the", "provided", "transaction", "type", "which", "corresponds", "to", "the", "txn", "types", "defined", "for", "stake", ".", "TxType", "type", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1018-L1029
20,378
decred/dcrdata
txhelpers/txhelpers.go
IsStakeTx
func IsStakeTx(msgTx *wire.MsgTx) bool { switch stake.DetermineTxType(msgTx) { case stake.TxTypeSSGen: fallthrough case stake.TxTypeSStx: fallthrough case stake.TxTypeSSRtx: return true default: return false } }
go
func IsStakeTx(msgTx *wire.MsgTx) bool { switch stake.DetermineTxType(msgTx) { case stake.TxTypeSSGen: fallthrough case stake.TxTypeSStx: fallthrough case stake.TxTypeSSRtx: return true default: return false } }
[ "func", "IsStakeTx", "(", "msgTx", "*", "wire", ".", "MsgTx", ")", "bool", "{", "switch", "stake", ".", "DetermineTxType", "(", "msgTx", ")", "{", "case", "stake", ".", "TxTypeSSGen", ":", "fallthrough", "\n", "case", "stake", ".", "TxTypeSStx", ":", "fa...
// IsStakeTx indicates if the input MsgTx is a stake transaction.
[ "IsStakeTx", "indicates", "if", "the", "input", "MsgTx", "is", "a", "stake", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1053-L1064
20,379
decred/dcrdata
txhelpers/txhelpers.go
TxTree
func TxTree(msgTx *wire.MsgTx) int8 { if IsStakeTx(msgTx) { return wire.TxTreeStake } return wire.TxTreeRegular }
go
func TxTree(msgTx *wire.MsgTx) int8 { if IsStakeTx(msgTx) { return wire.TxTreeStake } return wire.TxTreeRegular }
[ "func", "TxTree", "(", "msgTx", "*", "wire", ".", "MsgTx", ")", "int8", "{", "if", "IsStakeTx", "(", "msgTx", ")", "{", "return", "wire", ".", "TxTreeStake", "\n", "}", "\n", "return", "wire", ".", "TxTreeRegular", "\n", "}" ]
// TxTree returns for a wire.MsgTx either wire.TxTreeStake or wire.TxTreeRegular // depending on the type of transaction.
[ "TxTree", "returns", "for", "a", "wire", ".", "MsgTx", "either", "wire", ".", "TxTreeStake", "or", "wire", ".", "TxTreeRegular", "depending", "on", "the", "type", "of", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1068-L1073
20,380
decred/dcrdata
txhelpers/txhelpers.go
TxFee
func TxFee(msgTx *wire.MsgTx) dcrutil.Amount { var amtIn int64 for iv := range msgTx.TxIn { amtIn += msgTx.TxIn[iv].ValueIn } var amtOut int64 for iv := range msgTx.TxOut { amtOut += msgTx.TxOut[iv].Value } return dcrutil.Amount(amtIn - amtOut) }
go
func TxFee(msgTx *wire.MsgTx) dcrutil.Amount { var amtIn int64 for iv := range msgTx.TxIn { amtIn += msgTx.TxIn[iv].ValueIn } var amtOut int64 for iv := range msgTx.TxOut { amtOut += msgTx.TxOut[iv].Value } return dcrutil.Amount(amtIn - amtOut) }
[ "func", "TxFee", "(", "msgTx", "*", "wire", ".", "MsgTx", ")", "dcrutil", ".", "Amount", "{", "var", "amtIn", "int64", "\n", "for", "iv", ":=", "range", "msgTx", ".", "TxIn", "{", "amtIn", "+=", "msgTx", ".", "TxIn", "[", "iv", "]", ".", "ValueIn",...
// TxFee computes and returns the fee for a given tx
[ "TxFee", "computes", "and", "returns", "the", "fee", "for", "a", "given", "tx" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1076-L1086
20,381
decred/dcrdata
txhelpers/txhelpers.go
TotalOutFromMsgTx
func TotalOutFromMsgTx(msgTx *wire.MsgTx) dcrutil.Amount { var amtOut int64 for _, v := range msgTx.TxOut { amtOut += v.Value } return dcrutil.Amount(amtOut) }
go
func TotalOutFromMsgTx(msgTx *wire.MsgTx) dcrutil.Amount { var amtOut int64 for _, v := range msgTx.TxOut { amtOut += v.Value } return dcrutil.Amount(amtOut) }
[ "func", "TotalOutFromMsgTx", "(", "msgTx", "*", "wire", ".", "MsgTx", ")", "dcrutil", ".", "Amount", "{", "var", "amtOut", "int64", "\n", "for", "_", ",", "v", ":=", "range", "msgTx", ".", "TxOut", "{", "amtOut", "+=", "v", ".", "Value", "\n", "}", ...
// TotalOutFromMsgTx computes the total value out of a MsgTx
[ "TotalOutFromMsgTx", "computes", "the", "total", "value", "out", "of", "a", "MsgTx" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1115-L1121
20,382
decred/dcrdata
txhelpers/txhelpers.go
TotalVout
func TotalVout(vouts []dcrjson.Vout) dcrutil.Amount { var total dcrutil.Amount for _, v := range vouts { a, err := dcrutil.NewAmount(v.Value) if err != nil { continue } total += a } return total }
go
func TotalVout(vouts []dcrjson.Vout) dcrutil.Amount { var total dcrutil.Amount for _, v := range vouts { a, err := dcrutil.NewAmount(v.Value) if err != nil { continue } total += a } return total }
[ "func", "TotalVout", "(", "vouts", "[", "]", "dcrjson", ".", "Vout", ")", "dcrutil", ".", "Amount", "{", "var", "total", "dcrutil", ".", "Amount", "\n", "for", "_", ",", "v", ":=", "range", "vouts", "{", "a", ",", "err", ":=", "dcrutil", ".", "NewA...
// TotalVout computes the total value of a slice of dcrjson.Vout
[ "TotalVout", "computes", "the", "total", "value", "of", "a", "slice", "of", "dcrjson", ".", "Vout" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1124-L1134
20,383
decred/dcrdata
txhelpers/txhelpers.go
GenesisTxHash
func GenesisTxHash(params *chaincfg.Params) chainhash.Hash { return params.GenesisBlock.Transactions[0].TxHash() }
go
func GenesisTxHash(params *chaincfg.Params) chainhash.Hash { return params.GenesisBlock.Transactions[0].TxHash() }
[ "func", "GenesisTxHash", "(", "params", "*", "chaincfg", ".", "Params", ")", "chainhash", ".", "Hash", "{", "return", "params", ".", "GenesisBlock", ".", "Transactions", "[", "0", "]", ".", "TxHash", "(", ")", "\n", "}" ]
// GenesisTxHash returns the hash of the single coinbase transaction in the // genesis block of the specified network. This transaction is hard coded, and // the pubkey script for its one output only decodes for simnet.
[ "GenesisTxHash", "returns", "the", "hash", "of", "the", "single", "coinbase", "transaction", "in", "the", "genesis", "block", "of", "the", "specified", "network", ".", "This", "transaction", "is", "hard", "coded", "and", "the", "pubkey", "script", "for", "its"...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1139-L1141
20,384
decred/dcrdata
txhelpers/txhelpers.go
ValidateNetworkAddress
func ValidateNetworkAddress(address dcrutil.Address, p *chaincfg.Params) bool { return address.IsForNet(p) }
go
func ValidateNetworkAddress(address dcrutil.Address, p *chaincfg.Params) bool { return address.IsForNet(p) }
[ "func", "ValidateNetworkAddress", "(", "address", "dcrutil", ".", "Address", ",", "p", "*", "chaincfg", ".", "Params", ")", "bool", "{", "return", "address", ".", "IsForNet", "(", "p", ")", "\n", "}" ]
// ValidateNetworkAddress checks if the given address is valid on the given // network.
[ "ValidateNetworkAddress", "checks", "if", "the", "given", "address", "is", "valid", "on", "the", "given", "network", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1168-L1170
20,385
decred/dcrdata
txhelpers/txhelpers.go
AddressValidation
func AddressValidation(address string, params *chaincfg.Params) (dcrutil.Address, AddressType, AddressError) { // Decode and validate the address. addr, err := dcrutil.DecodeAddress(address) if err != nil { return nil, AddressTypeUnknown, AddressErrorDecodeFailed } // Detect when an address belonging to a diffe...
go
func AddressValidation(address string, params *chaincfg.Params) (dcrutil.Address, AddressType, AddressError) { // Decode and validate the address. addr, err := dcrutil.DecodeAddress(address) if err != nil { return nil, AddressTypeUnknown, AddressErrorDecodeFailed } // Detect when an address belonging to a diffe...
[ "func", "AddressValidation", "(", "address", "string", ",", "params", "*", "chaincfg", ".", "Params", ")", "(", "dcrutil", ".", "Address", ",", "AddressType", ",", "AddressError", ")", "{", "// Decode and validate the address.", "addr", ",", "err", ":=", "dcruti...
// AddressValidation performs several validation checks on the given address // string. Initially, decoding as a Decred address is attempted. If it fails to // decode, AddressErrorDecodeFailed is returned with AddressTypeUnknown. // If the address decoded successfully as a Decred address, it is checked // against the s...
[ "AddressValidation", "performs", "several", "validation", "checks", "on", "the", "given", "address", "string", ".", "Initially", "decoding", "as", "a", "Decred", "address", "is", "attempted", ".", "If", "it", "fails", "to", "decode", "AddressErrorDecodeFailed", "i...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/txhelpers/txhelpers.go#L1205-L1243
20,386
decred/dcrdata
db/dcrpg/internal/stakestmts.go
MakeVoteInsertStatement
func MakeVoteInsertStatement(checked, updateOnConflict bool) string { if !checked { return InsertVoteRow } if updateOnConflict { return UpsertVoteRow } return InsertVoteRowOnConflictDoNothing }
go
func MakeVoteInsertStatement(checked, updateOnConflict bool) string { if !checked { return InsertVoteRow } if updateOnConflict { return UpsertVoteRow } return InsertVoteRowOnConflictDoNothing }
[ "func", "MakeVoteInsertStatement", "(", "checked", ",", "updateOnConflict", "bool", ")", "string", "{", "if", "!", "checked", "{", "return", "InsertVoteRow", "\n", "}", "\n", "if", "updateOnConflict", "{", "return", "UpsertVoteRow", "\n", "}", "\n", "return", ...
// MakeVoteInsertStatement returns the appropriate votes insert statement for // the desired conflict checking and handling behavior. See the description of // MakeTicketInsertStatement for details.
[ "MakeVoteInsertStatement", "returns", "the", "appropriate", "votes", "insert", "statement", "for", "the", "desired", "conflict", "checking", "and", "handling", "behavior", ".", "See", "the", "description", "of", "MakeTicketInsertStatement", "for", "details", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/internal/stakestmts.go#L532-L540
20,387
decred/dcrdata
db/dcrpg/internal/stakestmts.go
MakeMissInsertStatement
func MakeMissInsertStatement(checked, updateOnConflict bool) string { if !checked { return InsertMissRow } if updateOnConflict { return UpsertMissRow } return InsertMissRowOnConflictDoNothing }
go
func MakeMissInsertStatement(checked, updateOnConflict bool) string { if !checked { return InsertMissRow } if updateOnConflict { return UpsertMissRow } return InsertMissRowOnConflictDoNothing }
[ "func", "MakeMissInsertStatement", "(", "checked", ",", "updateOnConflict", "bool", ")", "string", "{", "if", "!", "checked", "{", "return", "InsertMissRow", "\n", "}", "\n", "if", "updateOnConflict", "{", "return", "UpsertMissRow", "\n", "}", "\n", "return", ...
// MakeMissInsertStatement returns the appropriate misses insert statement for // the desired conflict checking and handling behavior. See the description of // MakeTicketInsertStatement for details.
[ "MakeMissInsertStatement", "returns", "the", "appropriate", "misses", "insert", "statement", "for", "the", "desired", "conflict", "checking", "and", "handling", "behavior", ".", "See", "the", "description", "of", "MakeTicketInsertStatement", "for", "details", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/internal/stakestmts.go#L545-L553
20,388
nanomsg/mangos-v1
examples/websocket/subclient.go
subClient
func subClient(port int) { sock, err := sub.NewSocket() if err != nil { die("cannot make req socket: %v", err) } sock.AddTransport(ws.NewTransport()) if err = sock.SetOption(mangos.OptionSubscribe, []byte{}); err != nil { die("cannot set subscription: %v", err) } url := fmt.Sprintf("ws://127.0.0.1:%d/sub", p...
go
func subClient(port int) { sock, err := sub.NewSocket() if err != nil { die("cannot make req socket: %v", err) } sock.AddTransport(ws.NewTransport()) if err = sock.SetOption(mangos.OptionSubscribe, []byte{}); err != nil { die("cannot set subscription: %v", err) } url := fmt.Sprintf("ws://127.0.0.1:%d/sub", p...
[ "func", "subClient", "(", "port", "int", ")", "{", "sock", ",", "err", ":=", "sub", ".", "NewSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "die", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "sock", ".", "AddTransport", "(", "ws...
// subClient implements the client for SUB.
[ "subClient", "implements", "the", "client", "for", "SUB", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/examples/websocket/subclient.go#L26-L44
20,389
nanomsg/mangos-v1
protocol.go
ProtocolName
func ProtocolName(number uint16) string { names := map[uint16]string{ ProtoPair: "pair", ProtoPub: "pub", ProtoSub: "sub", ProtoReq: "req", ProtoRep: "rep", ProtoPush: "push", ProtoPull: "pull", ProtoSurveyor: "surveyor", ProtoRespondent: "respondent", ...
go
func ProtocolName(number uint16) string { names := map[uint16]string{ ProtoPair: "pair", ProtoPub: "pub", ProtoSub: "sub", ProtoReq: "req", ProtoRep: "rep", ProtoPush: "push", ProtoPull: "pull", ProtoSurveyor: "surveyor", ProtoRespondent: "respondent", ...
[ "func", "ProtocolName", "(", "number", "uint16", ")", "string", "{", "names", ":=", "map", "[", "uint16", "]", "string", "{", "ProtoPair", ":", "\"", "\"", ",", "ProtoPub", ":", "\"", "\"", ",", "ProtoSub", ":", "\"", "\"", ",", "ProtoReq", ":", "\""...
// ProtocolName returns the name corresponding to a given protocol number. // This is useful for transports like WebSocket, which use a text name // rather than the number in the handshake.
[ "ProtocolName", "returns", "the", "name", "corresponding", "to", "a", "given", "protocol", "number", ".", "This", "is", "useful", "for", "transports", "like", "WebSocket", "which", "use", "a", "text", "name", "rather", "than", "the", "number", "in", "the", "...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol.go#L180-L193
20,390
nanomsg/mangos-v1
protocol.go
ValidPeers
func ValidPeers(p1, p2 Protocol) bool { if p1.Number() != p2.PeerNumber() { return false } if p2.Number() != p1.PeerNumber() { return false } return true }
go
func ValidPeers(p1, p2 Protocol) bool { if p1.Number() != p2.PeerNumber() { return false } if p2.Number() != p1.PeerNumber() { return false } return true }
[ "func", "ValidPeers", "(", "p1", ",", "p2", "Protocol", ")", "bool", "{", "if", "p1", ".", "Number", "(", ")", "!=", "p2", ".", "PeerNumber", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "p2", ".", "Number", "(", ")", "!=", "p1", "....
// ValidPeers returns true if the two sockets are capable of // peering to one another. For example, REQ can peer with REP, // but not with BUS.
[ "ValidPeers", "returns", "true", "if", "the", "two", "sockets", "are", "capable", "of", "peering", "to", "one", "another", ".", "For", "example", "REQ", "can", "peer", "with", "REP", "but", "not", "with", "BUS", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol.go#L198-L206
20,391
nanomsg/mangos-v1
transport/all/all.go
AddTransports
func AddTransports(sock mangos.Socket) { sock.AddTransport(tcp.NewTransport()) sock.AddTransport(inproc.NewTransport()) sock.AddTransport(ipc.NewTransport()) sock.AddTransport(tlstcp.NewTransport()) sock.AddTransport(ws.NewTransport()) sock.AddTransport(wss.NewTransport()) }
go
func AddTransports(sock mangos.Socket) { sock.AddTransport(tcp.NewTransport()) sock.AddTransport(inproc.NewTransport()) sock.AddTransport(ipc.NewTransport()) sock.AddTransport(tlstcp.NewTransport()) sock.AddTransport(ws.NewTransport()) sock.AddTransport(wss.NewTransport()) }
[ "func", "AddTransports", "(", "sock", "mangos", ".", "Socket", ")", "{", "sock", ".", "AddTransport", "(", "tcp", ".", "NewTransport", "(", ")", ")", "\n", "sock", ".", "AddTransport", "(", "inproc", ".", "NewTransport", "(", ")", ")", "\n", "sock", "....
// AddTransports adds all known transports to the given socket.
[ "AddTransports", "adds", "all", "known", "transports", "to", "the", "given", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/all/all.go#L31-L38
20,392
nanomsg/mangos-v1
transport/tcp/tcp.go
get
func (o options) get(name string) (interface{}, error) { v, ok := o[name] if !ok { return nil, mangos.ErrBadOption } return v, nil }
go
func (o options) get(name string) (interface{}, error) { v, ok := o[name] if !ok { return nil, mangos.ErrBadOption } return v, nil }
[ "func", "(", "o", "options", ")", "get", "(", "name", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "v", ",", "ok", ":=", "o", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "mangos", ".", "ErrBadOption...
// GetOption retrieves an option value.
[ "GetOption", "retrieves", "an", "option", "value", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/tcp/tcp.go#L29-L35
20,393
nanomsg/mangos-v1
transport/ws/ws.go
set
func (o options) set(name string, val interface{}) error { switch name { case mangos.OptionNoDelay: fallthrough case mangos.OptionKeepAlive: switch v := val.(type) { case bool: o[name] = v return nil default: return mangos.ErrBadValue } case mangos.OptionTLSConfig: switch v := val.(type) { ca...
go
func (o options) set(name string, val interface{}) error { switch name { case mangos.OptionNoDelay: fallthrough case mangos.OptionKeepAlive: switch v := val.(type) { case bool: o[name] = v return nil default: return mangos.ErrBadValue } case mangos.OptionTLSConfig: switch v := val.(type) { ca...
[ "func", "(", "o", "options", ")", "set", "(", "name", "string", ",", "val", "interface", "{", "}", ")", "error", "{", "switch", "name", "{", "case", "mangos", ".", "OptionNoDelay", ":", "fallthrough", "\n", "case", "mangos", ".", "OptionKeepAlive", ":", ...
// SetOption sets an option. We have none, so just ErrBadOption.
[ "SetOption", "sets", "an", "option", ".", "We", "have", "none", "so", "just", "ErrBadOption", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/ws/ws.go#L91-L121
20,394
nanomsg/mangos-v1
protocol/req/req.go
nextID
func (r *req) nextID() uint32 { // The high order bit is "special", and must always be set. (This is // how the peer will detect the end of the backtrace.) v := r.nextid | 0x80000000 r.nextid++ return v }
go
func (r *req) nextID() uint32 { // The high order bit is "special", and must always be set. (This is // how the peer will detect the end of the backtrace.) v := r.nextid | 0x80000000 r.nextid++ return v }
[ "func", "(", "r", "*", "req", ")", "nextID", "(", ")", "uint32", "{", "// The high order bit is \"special\", and must always be set. (This is", "// how the peer will detect the end of the backtrace.)", "v", ":=", "r", ".", "nextid", "|", "0x80000000", "\n", "r", ".", "...
// nextID returns the next request ID.
[ "nextID", "returns", "the", "next", "request", "ID", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol/req/req.go#L68-L74
20,395
nanomsg/mangos-v1
protocol/req/req.go
resender
func (r *req) resender() { defer r.w.Done() cq := r.sock.CloseChannel() for { select { case <-r.waker.C: case <-cq: return } r.Lock() m := r.reqmsg if m == nil { r.Unlock() continue } m = m.Dup() r.Unlock() r.resend <- m r.Lock() if r.retry > 0 { r.waker.Reset(r.retry) } e...
go
func (r *req) resender() { defer r.w.Done() cq := r.sock.CloseChannel() for { select { case <-r.waker.C: case <-cq: return } r.Lock() m := r.reqmsg if m == nil { r.Unlock() continue } m = m.Dup() r.Unlock() r.resend <- m r.Lock() if r.retry > 0 { r.waker.Reset(r.retry) } e...
[ "func", "(", "r", "*", "req", ")", "resender", "(", ")", "{", "defer", "r", ".", "w", ".", "Done", "(", ")", "\n", "cq", ":=", "r", ".", "sock", ".", "CloseChannel", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "r", ".", "waker"...
// resend sends the request message again, after a timer has expired.
[ "resend", "sends", "the", "request", "message", "again", "after", "a", "timer", "has", "expired", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol/req/req.go#L77-L107
20,396
nanomsg/mangos-v1
protocol/bus/bus.go
Init
func (x *bus) Init(sock mangos.ProtocolSocket) { x.sock = sock x.peers = make(map[uint32]*busEp) x.w.Init() x.w.Add() go x.sender() }
go
func (x *bus) Init(sock mangos.ProtocolSocket) { x.sock = sock x.peers = make(map[uint32]*busEp) x.w.Init() x.w.Add() go x.sender() }
[ "func", "(", "x", "*", "bus", ")", "Init", "(", "sock", "mangos", ".", "ProtocolSocket", ")", "{", "x", ".", "sock", "=", "sock", "\n", "x", ".", "peers", "=", "make", "(", "map", "[", "uint32", "]", "*", "busEp", ")", "\n", "x", ".", "w", "....
// Init implements the Protocol Init method.
[ "Init", "implements", "the", "Protocol", "Init", "method", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol/bus/bus.go#L44-L50
20,397
nanomsg/mangos-v1
protocol/bus/bus.go
peerSender
func (pe *busEp) peerSender() { for { m := <-pe.q if m == nil { return } if pe.ep.SendMsg(m) != nil { m.Free() return } } }
go
func (pe *busEp) peerSender() { for { m := <-pe.q if m == nil { return } if pe.ep.SendMsg(m) != nil { m.Free() return } } }
[ "func", "(", "pe", "*", "busEp", ")", "peerSender", "(", ")", "{", "for", "{", "m", ":=", "<-", "pe", ".", "q", "\n", "if", "m", "==", "nil", "{", "return", "\n", "}", "\n", "if", "pe", ".", "ep", ".", "SendMsg", "(", "m", ")", "!=", "nil",...
// Bottom sender.
[ "Bottom", "sender", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol/bus/bus.go#L69-L80
20,398
nanomsg/mangos-v1
compat/compat.go
NewSocket
func NewSocket(d Domain, p Protocol) (*Socket, error) { var s Socket var err error s.proto = p s.dom = d switch p { case PUB: s.sock, err = pub.NewSocket() case SUB: s.sock, err = sub.NewSocket() case PUSH: s.sock, err = push.NewSocket() case PULL: s.sock, err = pull.NewSocket() case REQ: s.sock,...
go
func NewSocket(d Domain, p Protocol) (*Socket, error) { var s Socket var err error s.proto = p s.dom = d switch p { case PUB: s.sock, err = pub.NewSocket() case SUB: s.sock, err = sub.NewSocket() case PUSH: s.sock, err = push.NewSocket() case PULL: s.sock, err = pull.NewSocket() case REQ: s.sock,...
[ "func", "NewSocket", "(", "d", "Domain", ",", "p", "Protocol", ")", "(", "*", "Socket", ",", "error", ")", "{", "var", "s", "Socket", "\n", "var", "err", "error", "\n\n", "s", ".", "proto", "=", "p", "\n", "s", ".", "dom", "=", "d", "\n\n", "sw...
// NewSocket allocates a new Socket. The Socket is the handle used to // access the underlying library.
[ "NewSocket", "allocates", "a", "new", "Socket", ".", "The", "Socket", "is", "the", "handle", "used", "to", "access", "the", "underlying", "library", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L113-L172
20,399
nanomsg/mangos-v1
compat/compat.go
Close
func (s *Socket) Close() error { if s.sock != nil { s.sock.Close() } return nil }
go
func (s *Socket) Close() error { if s.sock != nil { s.sock.Close() } return nil }
[ "func", "(", "s", "*", "Socket", ")", "Close", "(", ")", "error", "{", "if", "s", ".", "sock", "!=", "nil", "{", "s", ".", "sock", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Close shuts down the socket.
[ "Close", "shuts", "down", "the", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L175-L180