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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
163,300 | btcsuite/btcd | btcec/signature.go | ParseDERSignature | func ParseDERSignature(sigStr []byte, curve elliptic.Curve) (*Signature, error) {
return parseSig(sigStr, curve, true)
} | go | func ParseDERSignature(sigStr []byte, curve elliptic.Curve) (*Signature, error) {
return parseSig(sigStr, curve, true)
} | [
"func",
"ParseDERSignature",
"(",
"sigStr",
"[",
"]",
"byte",
",",
"curve",
"elliptic",
".",
"Curve",
")",
"(",
"*",
"Signature",
",",
"error",
")",
"{",
"return",
"parseSig",
"(",
"sigStr",
",",
"curve",
",",
"true",
")",
"\n",
"}"
] | // ParseDERSignature parses a signature in DER format for the curve type
// `curve` into a Signature type. If parsing according to the less strict
// BER format is needed, use ParseSignature. | [
"ParseDERSignature",
"parses",
"a",
"signature",
"in",
"DER",
"format",
"for",
"the",
"curve",
"type",
"curve",
"into",
"a",
"Signature",
"type",
".",
"If",
"parsing",
"according",
"to",
"the",
"less",
"strict",
"BER",
"format",
"is",
"needed",
"use",
"Parse... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcec/signature.go#L218-L220 |
163,301 | btcsuite/btcd | btcec/signature.go | canonicalizeInt | func canonicalizeInt(val *big.Int) []byte {
b := val.Bytes()
if len(b) == 0 {
b = []byte{0x00}
}
if b[0]&0x80 != 0 {
paddedBytes := make([]byte, len(b)+1)
copy(paddedBytes[1:], b)
b = paddedBytes
}
return b
} | go | func canonicalizeInt(val *big.Int) []byte {
b := val.Bytes()
if len(b) == 0 {
b = []byte{0x00}
}
if b[0]&0x80 != 0 {
paddedBytes := make([]byte, len(b)+1)
copy(paddedBytes[1:], b)
b = paddedBytes
}
return b
} | [
"func",
"canonicalizeInt",
"(",
"val",
"*",
"big",
".",
"Int",
")",
"[",
"]",
"byte",
"{",
"b",
":=",
"val",
".",
"Bytes",
"(",
")",
"\n",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"b",
"=",
"[",
"]",
"byte",
"{",
"0x00",
"}",
"\n",
"}",
... | // canonicalizeInt returns the bytes for the passed big integer adjusted as
// necessary to ensure that a big-endian encoded integer can't possibly be
// misinterpreted as a negative number. This can happen when the most
// significant bit is set, so it is padded by a leading zero byte in this case.
// Also, the retur... | [
"canonicalizeInt",
"returns",
"the",
"bytes",
"for",
"the",
"passed",
"big",
"integer",
"adjusted",
"as",
"necessary",
"to",
"ensure",
"that",
"a",
"big",
"-",
"endian",
"encoded",
"integer",
"can",
"t",
"possibly",
"be",
"misinterpreted",
"as",
"a",
"negative... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcec/signature.go#L228-L239 |
163,302 | btcsuite/btcd | btcec/signature.go | RecoverCompact | func RecoverCompact(curve *KoblitzCurve, signature,
hash []byte) (*PublicKey, bool, error) {
bitlen := (curve.BitSize + 7) / 8
if len(signature) != 1+bitlen*2 {
return nil, false, errors.New("invalid compact signature size")
}
iteration := int((signature[0] - 27) & ^byte(4))
// format is <header byte><bitlen ... | go | func RecoverCompact(curve *KoblitzCurve, signature,
hash []byte) (*PublicKey, bool, error) {
bitlen := (curve.BitSize + 7) / 8
if len(signature) != 1+bitlen*2 {
return nil, false, errors.New("invalid compact signature size")
}
iteration := int((signature[0] - 27) & ^byte(4))
// format is <header byte><bitlen ... | [
"func",
"RecoverCompact",
"(",
"curve",
"*",
"KoblitzCurve",
",",
"signature",
",",
"hash",
"[",
"]",
"byte",
")",
"(",
"*",
"PublicKey",
",",
"bool",
",",
"error",
")",
"{",
"bitlen",
":=",
"(",
"curve",
".",
"BitSize",
"+",
"7",
")",
"/",
"8",
"\... | // RecoverCompact verifies the compact signature "signature" of "hash" for the
// Koblitz curve in "curve". If the signature matches then the recovered public
// key will be returned as well as a boolen if the original key was compressed
// or not, else an error will be returned. | [
"RecoverCompact",
"verifies",
"the",
"compact",
"signature",
"signature",
"of",
"hash",
"for",
"the",
"Koblitz",
"curve",
"in",
"curve",
".",
"If",
"the",
"signature",
"matches",
"then",
"the",
"recovered",
"public",
"key",
"will",
"be",
"returned",
"as",
"wel... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcec/signature.go#L398-L419 |
163,303 | btcsuite/btcd | btcec/signature.go | signRFC6979 | func signRFC6979(privateKey *PrivateKey, hash []byte) (*Signature, error) {
privkey := privateKey.ToECDSA()
N := S256().N
halfOrder := S256().halfOrder
k := nonceRFC6979(privkey.D, hash)
inv := new(big.Int).ModInverse(k, N)
r, _ := privkey.Curve.ScalarBaseMult(k.Bytes())
r.Mod(r, N)
if r.Sign() == 0 {
retur... | go | func signRFC6979(privateKey *PrivateKey, hash []byte) (*Signature, error) {
privkey := privateKey.ToECDSA()
N := S256().N
halfOrder := S256().halfOrder
k := nonceRFC6979(privkey.D, hash)
inv := new(big.Int).ModInverse(k, N)
r, _ := privkey.Curve.ScalarBaseMult(k.Bytes())
r.Mod(r, N)
if r.Sign() == 0 {
retur... | [
"func",
"signRFC6979",
"(",
"privateKey",
"*",
"PrivateKey",
",",
"hash",
"[",
"]",
"byte",
")",
"(",
"*",
"Signature",
",",
"error",
")",
"{",
"privkey",
":=",
"privateKey",
".",
"ToECDSA",
"(",
")",
"\n",
"N",
":=",
"S256",
"(",
")",
".",
"N",
"\... | // signRFC6979 generates a deterministic ECDSA signature according to RFC 6979 and BIP 62. | [
"signRFC6979",
"generates",
"a",
"deterministic",
"ECDSA",
"signature",
"according",
"to",
"RFC",
"6979",
"and",
"BIP",
"62",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcec/signature.go#L422-L449 |
163,304 | btcsuite/btcd | btcec/signature.go | mac | func mac(alg func() hash.Hash, k, m []byte) []byte {
h := hmac.New(alg, k)
h.Write(m)
return h.Sum(nil)
} | go | func mac(alg func() hash.Hash, k, m []byte) []byte {
h := hmac.New(alg, k)
h.Write(m)
return h.Sum(nil)
} | [
"func",
"mac",
"(",
"alg",
"func",
"(",
")",
"hash",
".",
"Hash",
",",
"k",
",",
"m",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"h",
":=",
"hmac",
".",
"New",
"(",
"alg",
",",
"k",
")",
"\n",
"h",
".",
"Write",
"(",
"m",
")",
"\n",
... | // mac returns an HMAC of the given key and message. | [
"mac",
"returns",
"an",
"HMAC",
"of",
"the",
"given",
"key",
"and",
"message",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcec/signature.go#L505-L509 |
163,305 | btcsuite/btcd | mining/mining.go | Less | func (pq *txPriorityQueue) Less(i, j int) bool {
return pq.lessFunc(pq, i, j)
} | go | func (pq *txPriorityQueue) Less(i, j int) bool {
return pq.lessFunc(pq, i, j)
} | [
"func",
"(",
"pq",
"*",
"txPriorityQueue",
")",
"Less",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"pq",
".",
"lessFunc",
"(",
"pq",
",",
"i",
",",
"j",
")",
"\n",
"}"
] | // Less returns whether the item in the priority queue with index i should sort
// before the item with index j by deferring to the assigned less function. It
// is part of the heap.Interface implementation. | [
"Less",
"returns",
"whether",
"the",
"item",
"in",
"the",
"priority",
"queue",
"with",
"index",
"i",
"should",
"sort",
"before",
"the",
"item",
"with",
"index",
"j",
"by",
"deferring",
"to",
"the",
"assigned",
"less",
"function",
".",
"It",
"is",
"part",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L111-L113 |
163,306 | btcsuite/btcd | mining/mining.go | Swap | func (pq *txPriorityQueue) Swap(i, j int) {
pq.items[i], pq.items[j] = pq.items[j], pq.items[i]
} | go | func (pq *txPriorityQueue) Swap(i, j int) {
pq.items[i], pq.items[j] = pq.items[j], pq.items[i]
} | [
"func",
"(",
"pq",
"*",
"txPriorityQueue",
")",
"Swap",
"(",
"i",
",",
"j",
"int",
")",
"{",
"pq",
".",
"items",
"[",
"i",
"]",
",",
"pq",
".",
"items",
"[",
"j",
"]",
"=",
"pq",
".",
"items",
"[",
"j",
"]",
",",
"pq",
".",
"items",
"[",
... | // Swap swaps the items at the passed indices in the priority queue. It is
// part of the heap.Interface implementation. | [
"Swap",
"swaps",
"the",
"items",
"at",
"the",
"passed",
"indices",
"in",
"the",
"priority",
"queue",
".",
"It",
"is",
"part",
"of",
"the",
"heap",
".",
"Interface",
"implementation",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L117-L119 |
163,307 | btcsuite/btcd | mining/mining.go | Push | func (pq *txPriorityQueue) Push(x interface{}) {
pq.items = append(pq.items, x.(*txPrioItem))
} | go | func (pq *txPriorityQueue) Push(x interface{}) {
pq.items = append(pq.items, x.(*txPrioItem))
} | [
"func",
"(",
"pq",
"*",
"txPriorityQueue",
")",
"Push",
"(",
"x",
"interface",
"{",
"}",
")",
"{",
"pq",
".",
"items",
"=",
"append",
"(",
"pq",
".",
"items",
",",
"x",
".",
"(",
"*",
"txPrioItem",
")",
")",
"\n",
"}"
] | // Push pushes the passed item onto the priority queue. It is part of the
// heap.Interface implementation. | [
"Push",
"pushes",
"the",
"passed",
"item",
"onto",
"the",
"priority",
"queue",
".",
"It",
"is",
"part",
"of",
"the",
"heap",
".",
"Interface",
"implementation",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L123-L125 |
163,308 | btcsuite/btcd | mining/mining.go | txPQByPriority | func txPQByPriority(pq *txPriorityQueue, i, j int) bool {
// Using > here so that pop gives the highest priority item as opposed
// to the lowest. Sort by priority first, then fee.
if pq.items[i].priority == pq.items[j].priority {
return pq.items[i].feePerKB > pq.items[j].feePerKB
}
return pq.items[i].priority ... | go | func txPQByPriority(pq *txPriorityQueue, i, j int) bool {
// Using > here so that pop gives the highest priority item as opposed
// to the lowest. Sort by priority first, then fee.
if pq.items[i].priority == pq.items[j].priority {
return pq.items[i].feePerKB > pq.items[j].feePerKB
}
return pq.items[i].priority ... | [
"func",
"txPQByPriority",
"(",
"pq",
"*",
"txPriorityQueue",
",",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"// Using > here so that pop gives the highest priority item as opposed",
"// to the lowest. Sort by priority first, then fee.",
"if",
"pq",
".",
"items",
"[",
"i",
... | // txPQByPriority sorts a txPriorityQueue by transaction priority and then fees
// per kilobyte. | [
"txPQByPriority",
"sorts",
"a",
"txPriorityQueue",
"by",
"transaction",
"priority",
"and",
"then",
"fees",
"per",
"kilobyte",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L147-L155 |
163,309 | btcsuite/btcd | mining/mining.go | mergeUtxoView | func mergeUtxoView(viewA *blockchain.UtxoViewpoint, viewB *blockchain.UtxoViewpoint) {
viewAEntries := viewA.Entries()
for outpoint, entryB := range viewB.Entries() {
if entryA, exists := viewAEntries[outpoint]; !exists ||
entryA == nil || entryA.IsSpent() {
viewAEntries[outpoint] = entryB
}
}
} | go | func mergeUtxoView(viewA *blockchain.UtxoViewpoint, viewB *blockchain.UtxoViewpoint) {
viewAEntries := viewA.Entries()
for outpoint, entryB := range viewB.Entries() {
if entryA, exists := viewAEntries[outpoint]; !exists ||
entryA == nil || entryA.IsSpent() {
viewAEntries[outpoint] = entryB
}
}
} | [
"func",
"mergeUtxoView",
"(",
"viewA",
"*",
"blockchain",
".",
"UtxoViewpoint",
",",
"viewB",
"*",
"blockchain",
".",
"UtxoViewpoint",
")",
"{",
"viewAEntries",
":=",
"viewA",
".",
"Entries",
"(",
")",
"\n",
"for",
"outpoint",
",",
"entryB",
":=",
"range",
... | // mergeUtxoView adds all of the entries in viewB to viewA. The result is that
// viewA will contain all of its original entries plus all of the entries
// in viewB. It will replace any entries in viewB which also exist in viewA
// if the entry in viewA is spent. | [
"mergeUtxoView",
"adds",
"all",
"of",
"the",
"entries",
"in",
"viewB",
"to",
"viewA",
".",
"The",
"result",
"is",
"that",
"viewA",
"will",
"contain",
"all",
"of",
"its",
"original",
"entries",
"plus",
"all",
"of",
"the",
"entries",
"in",
"viewB",
".",
"I... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L226-L235 |
163,310 | btcsuite/btcd | mining/mining.go | standardCoinbaseScript | func standardCoinbaseScript(nextBlockHeight int32, extraNonce uint64) ([]byte, error) {
return txscript.NewScriptBuilder().AddInt64(int64(nextBlockHeight)).
AddInt64(int64(extraNonce)).AddData([]byte(CoinbaseFlags)).
Script()
} | go | func standardCoinbaseScript(nextBlockHeight int32, extraNonce uint64) ([]byte, error) {
return txscript.NewScriptBuilder().AddInt64(int64(nextBlockHeight)).
AddInt64(int64(extraNonce)).AddData([]byte(CoinbaseFlags)).
Script()
} | [
"func",
"standardCoinbaseScript",
"(",
"nextBlockHeight",
"int32",
",",
"extraNonce",
"uint64",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"txscript",
".",
"NewScriptBuilder",
"(",
")",
".",
"AddInt64",
"(",
"int64",
"(",
"nextBlockHeight",
... | // standardCoinbaseScript returns a standard script suitable for use as the
// signature script of the coinbase transaction of a new block. In particular,
// it starts with the block height that is required by version 2 blocks and adds
// the extra nonce as well as additional coinbase flags. | [
"standardCoinbaseScript",
"returns",
"a",
"standard",
"script",
"suitable",
"for",
"use",
"as",
"the",
"signature",
"script",
"of",
"the",
"coinbase",
"transaction",
"of",
"a",
"new",
"block",
".",
"In",
"particular",
"it",
"starts",
"with",
"the",
"block",
"h... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L241-L245 |
163,311 | btcsuite/btcd | mining/mining.go | createCoinbaseTx | func createCoinbaseTx(params *chaincfg.Params, coinbaseScript []byte, nextBlockHeight int32, addr btcutil.Address) (*btcutil.Tx, error) {
// Create the script to pay to the provided payment address if one was
// specified. Otherwise create a script that allows the coinbase to be
// redeemable by anyone.
var pkScri... | go | func createCoinbaseTx(params *chaincfg.Params, coinbaseScript []byte, nextBlockHeight int32, addr btcutil.Address) (*btcutil.Tx, error) {
// Create the script to pay to the provided payment address if one was
// specified. Otherwise create a script that allows the coinbase to be
// redeemable by anyone.
var pkScri... | [
"func",
"createCoinbaseTx",
"(",
"params",
"*",
"chaincfg",
".",
"Params",
",",
"coinbaseScript",
"[",
"]",
"byte",
",",
"nextBlockHeight",
"int32",
",",
"addr",
"btcutil",
".",
"Address",
")",
"(",
"*",
"btcutil",
".",
"Tx",
",",
"error",
")",
"{",
"// ... | // createCoinbaseTx returns a coinbase transaction paying an appropriate subsidy
// based on the passed block height to the provided address. When the address
// is nil, the coinbase transaction will instead be redeemable by anyone.
//
// See the comment for NewBlockTemplate for more information about why the nil
// a... | [
"createCoinbaseTx",
"returns",
"a",
"coinbase",
"transaction",
"paying",
"an",
"appropriate",
"subsidy",
"based",
"on",
"the",
"passed",
"block",
"height",
"to",
"the",
"provided",
"address",
".",
"When",
"the",
"address",
"is",
"nil",
"the",
"coinbase",
"transa... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L253-L287 |
163,312 | btcsuite/btcd | mining/mining.go | spendTransaction | func spendTransaction(utxoView *blockchain.UtxoViewpoint, tx *btcutil.Tx, height int32) error {
for _, txIn := range tx.MsgTx().TxIn {
entry := utxoView.LookupEntry(txIn.PreviousOutPoint)
if entry != nil {
entry.Spend()
}
}
utxoView.AddTxOuts(tx, height)
return nil
} | go | func spendTransaction(utxoView *blockchain.UtxoViewpoint, tx *btcutil.Tx, height int32) error {
for _, txIn := range tx.MsgTx().TxIn {
entry := utxoView.LookupEntry(txIn.PreviousOutPoint)
if entry != nil {
entry.Spend()
}
}
utxoView.AddTxOuts(tx, height)
return nil
} | [
"func",
"spendTransaction",
"(",
"utxoView",
"*",
"blockchain",
".",
"UtxoViewpoint",
",",
"tx",
"*",
"btcutil",
".",
"Tx",
",",
"height",
"int32",
")",
"error",
"{",
"for",
"_",
",",
"txIn",
":=",
"range",
"tx",
".",
"MsgTx",
"(",
")",
".",
"TxIn",
... | // spendTransaction updates the passed view by marking the inputs to the passed
// transaction as spent. It also adds all outputs in the passed transaction
// which are not provably unspendable as available unspent transaction outputs. | [
"spendTransaction",
"updates",
"the",
"passed",
"view",
"by",
"marking",
"the",
"inputs",
"to",
"the",
"passed",
"transaction",
"as",
"spent",
".",
"It",
"also",
"adds",
"all",
"outputs",
"in",
"the",
"passed",
"transaction",
"which",
"are",
"not",
"provably",... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L292-L302 |
163,313 | btcsuite/btcd | mining/mining.go | logSkippedDeps | func logSkippedDeps(tx *btcutil.Tx, deps map[chainhash.Hash]*txPrioItem) {
if deps == nil {
return
}
for _, item := range deps {
log.Tracef("Skipping tx %s since it depends on %s\n",
item.tx.Hash(), tx.Hash())
}
} | go | func logSkippedDeps(tx *btcutil.Tx, deps map[chainhash.Hash]*txPrioItem) {
if deps == nil {
return
}
for _, item := range deps {
log.Tracef("Skipping tx %s since it depends on %s\n",
item.tx.Hash(), tx.Hash())
}
} | [
"func",
"logSkippedDeps",
"(",
"tx",
"*",
"btcutil",
".",
"Tx",
",",
"deps",
"map",
"[",
"chainhash",
".",
"Hash",
"]",
"*",
"txPrioItem",
")",
"{",
"if",
"deps",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"item",
":=",
"range"... | // logSkippedDeps logs any dependencies which are also skipped as a result of
// skipping a transaction while generating a block template at the trace level. | [
"logSkippedDeps",
"logs",
"any",
"dependencies",
"which",
"are",
"also",
"skipped",
"as",
"a",
"result",
"of",
"skipping",
"a",
"transaction",
"while",
"generating",
"a",
"block",
"template",
"at",
"the",
"trace",
"level",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L306-L315 |
163,314 | btcsuite/btcd | mining/mining.go | MinimumMedianTime | func MinimumMedianTime(chainState *blockchain.BestState) time.Time {
return chainState.MedianTime.Add(time.Second)
} | go | func MinimumMedianTime(chainState *blockchain.BestState) time.Time {
return chainState.MedianTime.Add(time.Second)
} | [
"func",
"MinimumMedianTime",
"(",
"chainState",
"*",
"blockchain",
".",
"BestState",
")",
"time",
".",
"Time",
"{",
"return",
"chainState",
".",
"MedianTime",
".",
"Add",
"(",
"time",
".",
"Second",
")",
"\n",
"}"
] | // MinimumMedianTime returns the minimum allowed timestamp for a block building
// on the end of the provided best chain. In particular, it is one second after
// the median timestamp of the last several blocks per the chain consensus
// rules. | [
"MinimumMedianTime",
"returns",
"the",
"minimum",
"allowed",
"timestamp",
"for",
"a",
"block",
"building",
"on",
"the",
"end",
"of",
"the",
"provided",
"best",
"chain",
".",
"In",
"particular",
"it",
"is",
"one",
"second",
"after",
"the",
"median",
"timestamp"... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L321-L323 |
163,315 | btcsuite/btcd | mining/mining.go | medianAdjustedTime | func medianAdjustedTime(chainState *blockchain.BestState, timeSource blockchain.MedianTimeSource) time.Time {
// The timestamp for the block must not be before the median timestamp
// of the last several blocks. Thus, choose the maximum between the
// current time and one second after the past median time. The cur... | go | func medianAdjustedTime(chainState *blockchain.BestState, timeSource blockchain.MedianTimeSource) time.Time {
// The timestamp for the block must not be before the median timestamp
// of the last several blocks. Thus, choose the maximum between the
// current time and one second after the past median time. The cur... | [
"func",
"medianAdjustedTime",
"(",
"chainState",
"*",
"blockchain",
".",
"BestState",
",",
"timeSource",
"blockchain",
".",
"MedianTimeSource",
")",
"time",
".",
"Time",
"{",
"// The timestamp for the block must not be before the median timestamp",
"// of the last several block... | // medianAdjustedTime returns the current time adjusted to ensure it is at least
// one second after the median timestamp of the last several blocks per the
// chain consensus rules. | [
"medianAdjustedTime",
"returns",
"the",
"current",
"time",
"adjusted",
"to",
"ensure",
"it",
"is",
"at",
"least",
"one",
"second",
"after",
"the",
"median",
"timestamp",
"of",
"the",
"last",
"several",
"blocks",
"per",
"the",
"chain",
"consensus",
"rules",
"."... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L328-L342 |
163,316 | btcsuite/btcd | mining/mining.go | NewBlkTmplGenerator | func NewBlkTmplGenerator(policy *Policy, params *chaincfg.Params,
txSource TxSource, chain *blockchain.BlockChain,
timeSource blockchain.MedianTimeSource,
sigCache *txscript.SigCache,
hashCache *txscript.HashCache) *BlkTmplGenerator {
return &BlkTmplGenerator{
policy: policy,
chainParams: params,
txSou... | go | func NewBlkTmplGenerator(policy *Policy, params *chaincfg.Params,
txSource TxSource, chain *blockchain.BlockChain,
timeSource blockchain.MedianTimeSource,
sigCache *txscript.SigCache,
hashCache *txscript.HashCache) *BlkTmplGenerator {
return &BlkTmplGenerator{
policy: policy,
chainParams: params,
txSou... | [
"func",
"NewBlkTmplGenerator",
"(",
"policy",
"*",
"Policy",
",",
"params",
"*",
"chaincfg",
".",
"Params",
",",
"txSource",
"TxSource",
",",
"chain",
"*",
"blockchain",
".",
"BlockChain",
",",
"timeSource",
"blockchain",
".",
"MedianTimeSource",
",",
"sigCache"... | // NewBlkTmplGenerator returns a new block template generator for the given
// policy using transactions from the provided transaction source.
//
// The additional state-related fields are required in order to ensure the
// templates are built on top of the current best chain and adhere to the
// consensus rules. | [
"NewBlkTmplGenerator",
"returns",
"a",
"new",
"block",
"template",
"generator",
"for",
"the",
"given",
"policy",
"using",
"transactions",
"from",
"the",
"provided",
"transaction",
"source",
".",
"The",
"additional",
"state",
"-",
"related",
"fields",
"are",
"requi... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L364-L379 |
163,317 | btcsuite/btcd | mining/mining.go | UpdateBlockTime | func (g *BlkTmplGenerator) UpdateBlockTime(msgBlock *wire.MsgBlock) error {
// The new timestamp is potentially adjusted to ensure it comes after
// the median time of the last several blocks per the chain consensus
// rules.
newTime := medianAdjustedTime(g.chain.BestSnapshot(), g.timeSource)
msgBlock.Header.Times... | go | func (g *BlkTmplGenerator) UpdateBlockTime(msgBlock *wire.MsgBlock) error {
// The new timestamp is potentially adjusted to ensure it comes after
// the median time of the last several blocks per the chain consensus
// rules.
newTime := medianAdjustedTime(g.chain.BestSnapshot(), g.timeSource)
msgBlock.Header.Times... | [
"func",
"(",
"g",
"*",
"BlkTmplGenerator",
")",
"UpdateBlockTime",
"(",
"msgBlock",
"*",
"wire",
".",
"MsgBlock",
")",
"error",
"{",
"// The new timestamp is potentially adjusted to ensure it comes after",
"// the median time of the last several blocks per the chain consensus",
"... | // UpdateBlockTime updates the timestamp in the header of the passed block to
// the current time while taking into account the median time of the last
// several blocks to ensure the new time is after that time per the chain
// consensus rules. Finally, it will update the target difficulty if needed
// based on the n... | [
"UpdateBlockTime",
"updates",
"the",
"timestamp",
"in",
"the",
"header",
"of",
"the",
"passed",
"block",
"to",
"the",
"current",
"time",
"while",
"taking",
"into",
"account",
"the",
"median",
"time",
"of",
"the",
"last",
"several",
"blocks",
"to",
"ensure",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L904-L921 |
163,318 | btcsuite/btcd | mining/mining.go | UpdateExtraNonce | func (g *BlkTmplGenerator) UpdateExtraNonce(msgBlock *wire.MsgBlock, blockHeight int32, extraNonce uint64) error {
coinbaseScript, err := standardCoinbaseScript(blockHeight, extraNonce)
if err != nil {
return err
}
if len(coinbaseScript) > blockchain.MaxCoinbaseScriptLen {
return fmt.Errorf("coinbase transactio... | go | func (g *BlkTmplGenerator) UpdateExtraNonce(msgBlock *wire.MsgBlock, blockHeight int32, extraNonce uint64) error {
coinbaseScript, err := standardCoinbaseScript(blockHeight, extraNonce)
if err != nil {
return err
}
if len(coinbaseScript) > blockchain.MaxCoinbaseScriptLen {
return fmt.Errorf("coinbase transactio... | [
"func",
"(",
"g",
"*",
"BlkTmplGenerator",
")",
"UpdateExtraNonce",
"(",
"msgBlock",
"*",
"wire",
".",
"MsgBlock",
",",
"blockHeight",
"int32",
",",
"extraNonce",
"uint64",
")",
"error",
"{",
"coinbaseScript",
",",
"err",
":=",
"standardCoinbaseScript",
"(",
"... | // UpdateExtraNonce updates the extra nonce in the coinbase script of the passed
// block by regenerating the coinbase script with the passed value and block
// height. It also recalculates and updates the new merkle root that results
// from changing the coinbase script. | [
"UpdateExtraNonce",
"updates",
"the",
"extra",
"nonce",
"in",
"the",
"coinbase",
"script",
"of",
"the",
"passed",
"block",
"by",
"regenerating",
"the",
"coinbase",
"script",
"with",
"the",
"passed",
"value",
"and",
"block",
"height",
".",
"It",
"also",
"recalc... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/mining/mining.go#L927-L949 |
163,319 | btcsuite/btcd | rpcserverhelp.go | rpcMethodHelp | func (c *helpCacher) rpcMethodHelp(method string) (string, error) {
c.Lock()
defer c.Unlock()
// Return the cached method help if it exists.
if help, exists := c.methodHelp[method]; exists {
return help, nil
}
// Look up the result types for the method.
resultTypes, ok := rpcResultTypes[method]
if !ok {
r... | go | func (c *helpCacher) rpcMethodHelp(method string) (string, error) {
c.Lock()
defer c.Unlock()
// Return the cached method help if it exists.
if help, exists := c.methodHelp[method]; exists {
return help, nil
}
// Look up the result types for the method.
resultTypes, ok := rpcResultTypes[method]
if !ok {
r... | [
"func",
"(",
"c",
"*",
"helpCacher",
")",
"rpcMethodHelp",
"(",
"method",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n\n",
"// Return the cached method help if it exists.... | // rpcMethodHelp returns an RPC help string for the provided method.
//
// This function is safe for concurrent access. | [
"rpcMethodHelp",
"returns",
"an",
"RPC",
"help",
"string",
"for",
"the",
"provided",
"method",
".",
"This",
"function",
"is",
"safe",
"for",
"concurrent",
"access",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcserverhelp.go#L750-L773 |
163,320 | btcsuite/btcd | rpcserverhelp.go | rpcUsage | func (c *helpCacher) rpcUsage(includeWebsockets bool) (string, error) {
c.Lock()
defer c.Unlock()
// Return the cached usage if it is available.
if c.usage != "" {
return c.usage, nil
}
// Generate a list of one-line usage for every command.
usageTexts := make([]string, 0, len(rpcHandlers))
for k := range r... | go | func (c *helpCacher) rpcUsage(includeWebsockets bool) (string, error) {
c.Lock()
defer c.Unlock()
// Return the cached usage if it is available.
if c.usage != "" {
return c.usage, nil
}
// Generate a list of one-line usage for every command.
usageTexts := make([]string, 0, len(rpcHandlers))
for k := range r... | [
"func",
"(",
"c",
"*",
"helpCacher",
")",
"rpcUsage",
"(",
"includeWebsockets",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n\n",
"// Return the cached usage if it is availa... | // rpcUsage returns one-line usage for all support RPC commands.
//
// This function is safe for concurrent access. | [
"rpcUsage",
"returns",
"one",
"-",
"line",
"usage",
"for",
"all",
"support",
"RPC",
"commands",
".",
"This",
"function",
"is",
"safe",
"for",
"concurrent",
"access",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcserverhelp.go#L778-L811 |
163,321 | btcsuite/btcd | blockchain/indexers/manager.go | dbFetchIndexerTip | func dbFetchIndexerTip(dbTx database.Tx, idxKey []byte) (*chainhash.Hash, int32, error) {
indexesBucket := dbTx.Metadata().Bucket(indexTipsBucketName)
serialized := indexesBucket.Get(idxKey)
if len(serialized) < chainhash.HashSize+4 {
return nil, 0, database.Error{
ErrorCode: database.ErrCorruption,
Descript... | go | func dbFetchIndexerTip(dbTx database.Tx, idxKey []byte) (*chainhash.Hash, int32, error) {
indexesBucket := dbTx.Metadata().Bucket(indexTipsBucketName)
serialized := indexesBucket.Get(idxKey)
if len(serialized) < chainhash.HashSize+4 {
return nil, 0, database.Error{
ErrorCode: database.ErrCorruption,
Descript... | [
"func",
"dbFetchIndexerTip",
"(",
"dbTx",
"database",
".",
"Tx",
",",
"idxKey",
"[",
"]",
"byte",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"int32",
",",
"error",
")",
"{",
"indexesBucket",
":=",
"dbTx",
".",
"Metadata",
"(",
")",
".",
"Bucket",
... | // dbFetchIndexerTip uses an existing database transaction to retrieve the
// hash and height of the current tip for the provided index. | [
"dbFetchIndexerTip",
"uses",
"an",
"existing",
"database",
"transaction",
"to",
"retrieve",
"the",
"hash",
"and",
"height",
"of",
"the",
"current",
"tip",
"for",
"the",
"provided",
"index",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L50-L65 |
163,322 | btcsuite/btcd | blockchain/indexers/manager.go | dbIndexConnectBlock | func dbIndexConnectBlock(dbTx database.Tx, indexer Indexer, block *btcutil.Block,
stxo []blockchain.SpentTxOut) error {
// Assert that the block being connected properly connects to the
// current tip of the index.
idxKey := indexer.Key()
curTipHash, _, err := dbFetchIndexerTip(dbTx, idxKey)
if err != nil {
re... | go | func dbIndexConnectBlock(dbTx database.Tx, indexer Indexer, block *btcutil.Block,
stxo []blockchain.SpentTxOut) error {
// Assert that the block being connected properly connects to the
// current tip of the index.
idxKey := indexer.Key()
curTipHash, _, err := dbFetchIndexerTip(dbTx, idxKey)
if err != nil {
re... | [
"func",
"dbIndexConnectBlock",
"(",
"dbTx",
"database",
".",
"Tx",
",",
"indexer",
"Indexer",
",",
"block",
"*",
"btcutil",
".",
"Block",
",",
"stxo",
"[",
"]",
"blockchain",
".",
"SpentTxOut",
")",
"error",
"{",
"// Assert that the block being connected properly ... | // dbIndexConnectBlock adds all of the index entries associated with the
// given block using the provided indexer and updates the tip of the indexer
// accordingly. An error will be returned if the current tip for the indexer is
// not the previous block for the passed block. | [
"dbIndexConnectBlock",
"adds",
"all",
"of",
"the",
"index",
"entries",
"associated",
"with",
"the",
"given",
"block",
"using",
"the",
"provided",
"indexer",
"and",
"updates",
"the",
"tip",
"of",
"the",
"indexer",
"accordingly",
".",
"An",
"error",
"will",
"be"... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L71-L95 |
163,323 | btcsuite/btcd | blockchain/indexers/manager.go | indexDropKey | func indexDropKey(idxKey []byte) []byte {
dropKey := make([]byte, len(idxKey)+1)
dropKey[0] = 'd'
copy(dropKey[1:], idxKey)
return dropKey
} | go | func indexDropKey(idxKey []byte) []byte {
dropKey := make([]byte, len(idxKey)+1)
dropKey[0] = 'd'
copy(dropKey[1:], idxKey)
return dropKey
} | [
"func",
"indexDropKey",
"(",
"idxKey",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"dropKey",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"idxKey",
")",
"+",
"1",
")",
"\n",
"dropKey",
"[",
"0",
"]",
"=",
"'d'",
"\n",
"copy",
"(",
... | // indexDropKey returns the key for an index which indicates it is in the
// process of being dropped. | [
"indexDropKey",
"returns",
"the",
"key",
"for",
"an",
"index",
"which",
"indicates",
"it",
"is",
"in",
"the",
"process",
"of",
"being",
"dropped",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L142-L147 |
163,324 | btcsuite/btcd | blockchain/indexers/manager.go | maybeFinishDrops | func (m *Manager) maybeFinishDrops(interrupt <-chan struct{}) error {
indexNeedsDrop := make([]bool, len(m.enabledIndexes))
err := m.db.View(func(dbTx database.Tx) error {
// None of the indexes needs to be dropped if the index tips
// bucket hasn't been created yet.
indexesBucket := dbTx.Metadata().Bucket(inde... | go | func (m *Manager) maybeFinishDrops(interrupt <-chan struct{}) error {
indexNeedsDrop := make([]bool, len(m.enabledIndexes))
err := m.db.View(func(dbTx database.Tx) error {
// None of the indexes needs to be dropped if the index tips
// bucket hasn't been created yet.
indexesBucket := dbTx.Metadata().Bucket(inde... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"maybeFinishDrops",
"(",
"interrupt",
"<-",
"chan",
"struct",
"{",
"}",
")",
"error",
"{",
"indexNeedsDrop",
":=",
"make",
"(",
"[",
"]",
"bool",
",",
"len",
"(",
"m",
".",
"enabledIndexes",
")",
")",
"\n",
"err... | // maybeFinishDrops determines if each of the enabled indexes are in the middle
// of being dropped and finishes dropping them when the are. This is necessary
// because dropping and index has to be done in several atomic steps rather than
// one big atomic step due to the massive number of entries. | [
"maybeFinishDrops",
"determines",
"if",
"each",
"of",
"the",
"enabled",
"indexes",
"are",
"in",
"the",
"middle",
"of",
"being",
"dropped",
"and",
"finishes",
"dropping",
"them",
"when",
"the",
"are",
".",
"This",
"is",
"necessary",
"because",
"dropping",
"and"... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L153-L197 |
163,325 | btcsuite/btcd | blockchain/indexers/manager.go | maybeCreateIndexes | func (m *Manager) maybeCreateIndexes(dbTx database.Tx) error {
indexesBucket := dbTx.Metadata().Bucket(indexTipsBucketName)
for _, indexer := range m.enabledIndexes {
// Nothing to do if the index tip already exists.
idxKey := indexer.Key()
if indexesBucket.Get(idxKey) != nil {
continue
}
// The tip for... | go | func (m *Manager) maybeCreateIndexes(dbTx database.Tx) error {
indexesBucket := dbTx.Metadata().Bucket(indexTipsBucketName)
for _, indexer := range m.enabledIndexes {
// Nothing to do if the index tip already exists.
idxKey := indexer.Key()
if indexesBucket.Get(idxKey) != nil {
continue
}
// The tip for... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"maybeCreateIndexes",
"(",
"dbTx",
"database",
".",
"Tx",
")",
"error",
"{",
"indexesBucket",
":=",
"dbTx",
".",
"Metadata",
"(",
")",
".",
"Bucket",
"(",
"indexTipsBucketName",
")",
"\n",
"for",
"_",
",",
"indexer"... | // maybeCreateIndexes determines if each of the enabled indexes have already
// been created and creates them if not. | [
"maybeCreateIndexes",
"determines",
"if",
"each",
"of",
"the",
"enabled",
"indexes",
"have",
"already",
"been",
"created",
"and",
"creates",
"them",
"if",
"not",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L201-L226 |
163,326 | btcsuite/btcd | blockchain/indexers/manager.go | indexNeedsInputs | func indexNeedsInputs(index Indexer) bool {
if idx, ok := index.(NeedsInputser); ok {
return idx.NeedsInputs()
}
return false
} | go | func indexNeedsInputs(index Indexer) bool {
if idx, ok := index.(NeedsInputser); ok {
return idx.NeedsInputs()
}
return false
} | [
"func",
"indexNeedsInputs",
"(",
"index",
"Indexer",
")",
"bool",
"{",
"if",
"idx",
",",
"ok",
":=",
"index",
".",
"(",
"NeedsInputser",
")",
";",
"ok",
"{",
"return",
"idx",
".",
"NeedsInputs",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"... | // indexNeedsInputs returns whether or not the index needs access to the txouts
// referenced by the transaction inputs being indexed. | [
"indexNeedsInputs",
"returns",
"whether",
"or",
"not",
"the",
"index",
"needs",
"access",
"to",
"the",
"txouts",
"referenced",
"by",
"the",
"transaction",
"inputs",
"being",
"indexed",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L461-L467 |
163,327 | btcsuite/btcd | blockchain/indexers/manager.go | dbFetchTx | func dbFetchTx(dbTx database.Tx, hash *chainhash.Hash) (*wire.MsgTx, error) {
// Look up the location of the transaction.
blockRegion, err := dbFetchTxIndexEntry(dbTx, hash)
if err != nil {
return nil, err
}
if blockRegion == nil {
return nil, fmt.Errorf("transaction %v not found", hash)
}
// Load the raw t... | go | func dbFetchTx(dbTx database.Tx, hash *chainhash.Hash) (*wire.MsgTx, error) {
// Look up the location of the transaction.
blockRegion, err := dbFetchTxIndexEntry(dbTx, hash)
if err != nil {
return nil, err
}
if blockRegion == nil {
return nil, fmt.Errorf("transaction %v not found", hash)
}
// Load the raw t... | [
"func",
"dbFetchTx",
"(",
"dbTx",
"database",
".",
"Tx",
",",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"wire",
".",
"MsgTx",
",",
"error",
")",
"{",
"// Look up the location of the transaction.",
"blockRegion",
",",
"err",
":=",
"dbFetchTxIndexEnt... | // dbFetchTx looks up the passed transaction hash in the transaction index and
// loads it from the database. | [
"dbFetchTx",
"looks",
"up",
"the",
"passed",
"transaction",
"hash",
"in",
"the",
"transaction",
"index",
"and",
"loads",
"it",
"from",
"the",
"database",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L471-L495 |
163,328 | btcsuite/btcd | blockchain/indexers/manager.go | ConnectBlock | func (m *Manager) ConnectBlock(dbTx database.Tx, block *btcutil.Block,
stxos []blockchain.SpentTxOut) error {
// Call each of the currently active optional indexes with the block
// being connected so they can update accordingly.
for _, index := range m.enabledIndexes {
err := dbIndexConnectBlock(dbTx, index, bl... | go | func (m *Manager) ConnectBlock(dbTx database.Tx, block *btcutil.Block,
stxos []blockchain.SpentTxOut) error {
// Call each of the currently active optional indexes with the block
// being connected so they can update accordingly.
for _, index := range m.enabledIndexes {
err := dbIndexConnectBlock(dbTx, index, bl... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"ConnectBlock",
"(",
"dbTx",
"database",
".",
"Tx",
",",
"block",
"*",
"btcutil",
".",
"Block",
",",
"stxos",
"[",
"]",
"blockchain",
".",
"SpentTxOut",
")",
"error",
"{",
"// Call each of the currently active optional in... | // ConnectBlock must be invoked when a block is extending the main chain. It
// keeps track of the state of each index it is managing, performs some sanity
// checks, and invokes each indexer.
//
// This is part of the blockchain.IndexManager interface. | [
"ConnectBlock",
"must",
"be",
"invoked",
"when",
"a",
"block",
"is",
"extending",
"the",
"main",
"chain",
".",
"It",
"keeps",
"track",
"of",
"the",
"state",
"of",
"each",
"index",
"it",
"is",
"managing",
"performs",
"some",
"sanity",
"checks",
"and",
"invo... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L502-L514 |
163,329 | btcsuite/btcd | blockchain/indexers/manager.go | DisconnectBlock | func (m *Manager) DisconnectBlock(dbTx database.Tx, block *btcutil.Block,
stxo []blockchain.SpentTxOut) error {
// Call each of the currently active optional indexes with the block
// being disconnected so they can update accordingly.
for _, index := range m.enabledIndexes {
err := dbIndexDisconnectBlock(dbTx, i... | go | func (m *Manager) DisconnectBlock(dbTx database.Tx, block *btcutil.Block,
stxo []blockchain.SpentTxOut) error {
// Call each of the currently active optional indexes with the block
// being disconnected so they can update accordingly.
for _, index := range m.enabledIndexes {
err := dbIndexDisconnectBlock(dbTx, i... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"DisconnectBlock",
"(",
"dbTx",
"database",
".",
"Tx",
",",
"block",
"*",
"btcutil",
".",
"Block",
",",
"stxo",
"[",
"]",
"blockchain",
".",
"SpentTxOut",
")",
"error",
"{",
"// Call each of the currently active optional ... | // DisconnectBlock must be invoked when a block is being disconnected from the
// end of the main chain. It keeps track of the state of each index it is
// managing, performs some sanity checks, and invokes each indexer to remove
// the index entries associated with the block.
//
// This is part of the blockchain.Inde... | [
"DisconnectBlock",
"must",
"be",
"invoked",
"when",
"a",
"block",
"is",
"being",
"disconnected",
"from",
"the",
"end",
"of",
"the",
"main",
"chain",
".",
"It",
"keeps",
"track",
"of",
"the",
"state",
"of",
"each",
"index",
"it",
"is",
"managing",
"performs... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L522-L534 |
163,330 | btcsuite/btcd | blockchain/indexers/manager.go | NewManager | func NewManager(db database.DB, enabledIndexes []Indexer) *Manager {
return &Manager{
db: db,
enabledIndexes: enabledIndexes,
}
} | go | func NewManager(db database.DB, enabledIndexes []Indexer) *Manager {
return &Manager{
db: db,
enabledIndexes: enabledIndexes,
}
} | [
"func",
"NewManager",
"(",
"db",
"database",
".",
"DB",
",",
"enabledIndexes",
"[",
"]",
"Indexer",
")",
"*",
"Manager",
"{",
"return",
"&",
"Manager",
"{",
"db",
":",
"db",
",",
"enabledIndexes",
":",
"enabledIndexes",
",",
"}",
"\n",
"}"
] | // NewManager returns a new index manager with the provided indexes enabled.
//
// The manager returned satisfies the blockchain.IndexManager interface and thus
// cleanly plugs into the normal blockchain processing path. | [
"NewManager",
"returns",
"a",
"new",
"index",
"manager",
"with",
"the",
"provided",
"indexes",
"enabled",
".",
"The",
"manager",
"returned",
"satisfies",
"the",
"blockchain",
".",
"IndexManager",
"interface",
"and",
"thus",
"cleanly",
"plugs",
"into",
"the",
"no... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/indexers/manager.go#L540-L545 |
163,331 | btcsuite/btcd | rpcclient/rawrequest.go | RawRequestAsync | func (c *Client) RawRequestAsync(method string, params []json.RawMessage) FutureRawResult {
// Method may not be empty.
if method == "" {
return newFutureError(errors.New("no method"))
}
// Marshal parameters as "[]" instead of "null" when no parameters
// are passed.
if params == nil {
params = []json.RawMe... | go | func (c *Client) RawRequestAsync(method string, params []json.RawMessage) FutureRawResult {
// Method may not be empty.
if method == "" {
return newFutureError(errors.New("no method"))
}
// Marshal parameters as "[]" instead of "null" when no parameters
// are passed.
if params == nil {
params = []json.RawMe... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RawRequestAsync",
"(",
"method",
"string",
",",
"params",
"[",
"]",
"json",
".",
"RawMessage",
")",
"FutureRawResult",
"{",
"// Method may not be empty.",
"if",
"method",
"==",
"\"",
"\"",
"{",
"return",
"newFutureError",... | // RawRequestAsync returns an instance of a type that can be used to get the
// result of a custom RPC request at some future time by invoking the Receive
// function on the returned instance.
//
// See RawRequest for the blocking version and more details. | [
"RawRequestAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"a",
"custom",
"RPC",
"request",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the"... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawrequest.go#L29-L69 |
163,332 | btcsuite/btcd | rpcclient/rawrequest.go | RawRequest | func (c *Client) RawRequest(method string, params []json.RawMessage) (json.RawMessage, error) {
return c.RawRequestAsync(method, params).Receive()
} | go | func (c *Client) RawRequest(method string, params []json.RawMessage) (json.RawMessage, error) {
return c.RawRequestAsync(method, params).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RawRequest",
"(",
"method",
"string",
",",
"params",
"[",
"]",
"json",
".",
"RawMessage",
")",
"(",
"json",
".",
"RawMessage",
",",
"error",
")",
"{",
"return",
"c",
".",
"RawRequestAsync",
"(",
"method",
",",
"... | // RawRequest allows the caller to send a raw or custom request to the server.
// This method may be used to send and receive requests and responses for
// requests that are not handled by this client package, or to proxy partially
// unmarshaled requests to another JSON-RPC server if a request cannot be
// handled dir... | [
"RawRequest",
"allows",
"the",
"caller",
"to",
"send",
"a",
"raw",
"or",
"custom",
"request",
"to",
"the",
"server",
".",
"This",
"method",
"may",
"be",
"used",
"to",
"send",
"and",
"receive",
"requests",
"and",
"responses",
"for",
"requests",
"that",
"are... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawrequest.go#L76-L78 |
163,333 | btcsuite/btcd | blockchain/validate.go | isNullOutpoint | func isNullOutpoint(outpoint *wire.OutPoint) bool {
if outpoint.Index == math.MaxUint32 && outpoint.Hash == zeroHash {
return true
}
return false
} | go | func isNullOutpoint(outpoint *wire.OutPoint) bool {
if outpoint.Index == math.MaxUint32 && outpoint.Hash == zeroHash {
return true
}
return false
} | [
"func",
"isNullOutpoint",
"(",
"outpoint",
"*",
"wire",
".",
"OutPoint",
")",
"bool",
"{",
"if",
"outpoint",
".",
"Index",
"==",
"math",
".",
"MaxUint32",
"&&",
"outpoint",
".",
"Hash",
"==",
"zeroHash",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
... | // isNullOutpoint determines whether or not a previous transaction output point
// is set. | [
"isNullOutpoint",
"determines",
"whether",
"or",
"not",
"a",
"previous",
"transaction",
"output",
"point",
"is",
"set",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L65-L70 |
163,334 | btcsuite/btcd | blockchain/validate.go | IsCoinBaseTx | func IsCoinBaseTx(msgTx *wire.MsgTx) bool {
// A coin base must only have one transaction input.
if len(msgTx.TxIn) != 1 {
return false
}
// The previous output of a coin base must have a max value index and
// a zero hash.
prevOut := &msgTx.TxIn[0].PreviousOutPoint
if prevOut.Index != math.MaxUint32 || prevO... | go | func IsCoinBaseTx(msgTx *wire.MsgTx) bool {
// A coin base must only have one transaction input.
if len(msgTx.TxIn) != 1 {
return false
}
// The previous output of a coin base must have a max value index and
// a zero hash.
prevOut := &msgTx.TxIn[0].PreviousOutPoint
if prevOut.Index != math.MaxUint32 || prevO... | [
"func",
"IsCoinBaseTx",
"(",
"msgTx",
"*",
"wire",
".",
"MsgTx",
")",
"bool",
"{",
"// A coin base must only have one transaction input.",
"if",
"len",
"(",
"msgTx",
".",
"TxIn",
")",
"!=",
"1",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// The previous output ... | // IsCoinBaseTx determines whether or not a transaction is a coinbase. A coinbase
// is a special transaction created by miners that has no inputs. This is
// represented in the block chain by a transaction with a single input that has
// a previous output transaction index set to the maximum value along with a
// ze... | [
"IsCoinBaseTx",
"determines",
"whether",
"or",
"not",
"a",
"transaction",
"is",
"a",
"coinbase",
".",
"A",
"coinbase",
"is",
"a",
"special",
"transaction",
"created",
"by",
"miners",
"that",
"has",
"no",
"inputs",
".",
"This",
"is",
"represented",
"in",
"the... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L89-L103 |
163,335 | btcsuite/btcd | blockchain/validate.go | SequenceLockActive | func SequenceLockActive(sequenceLock *SequenceLock, blockHeight int32,
medianTimePast time.Time) bool {
// If either the seconds, or height relative-lock time has not yet
// reached, then the transaction is not yet mature according to its
// sequence locks.
if sequenceLock.Seconds >= medianTimePast.Unix() ||
se... | go | func SequenceLockActive(sequenceLock *SequenceLock, blockHeight int32,
medianTimePast time.Time) bool {
// If either the seconds, or height relative-lock time has not yet
// reached, then the transaction is not yet mature according to its
// sequence locks.
if sequenceLock.Seconds >= medianTimePast.Unix() ||
se... | [
"func",
"SequenceLockActive",
"(",
"sequenceLock",
"*",
"SequenceLock",
",",
"blockHeight",
"int32",
",",
"medianTimePast",
"time",
".",
"Time",
")",
"bool",
"{",
"// If either the seconds, or height relative-lock time has not yet",
"// reached, then the transaction is not yet ma... | // SequenceLockActive determines if a transaction's sequence locks have been
// met, meaning that all the inputs of a given transaction have reached a
// height or time sufficient for their relative lock-time maturity. | [
"SequenceLockActive",
"determines",
"if",
"a",
"transaction",
"s",
"sequence",
"locks",
"have",
"been",
"met",
"meaning",
"that",
"all",
"the",
"inputs",
"of",
"a",
"given",
"transaction",
"have",
"reached",
"a",
"height",
"or",
"time",
"sufficient",
"for",
"t... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L120-L132 |
163,336 | btcsuite/btcd | blockchain/validate.go | IsFinalizedTransaction | func IsFinalizedTransaction(tx *btcutil.Tx, blockHeight int32, blockTime time.Time) bool {
msgTx := tx.MsgTx()
// Lock time of zero means the transaction is finalized.
lockTime := msgTx.LockTime
if lockTime == 0 {
return true
}
// The lock time field of a transaction is either a block height at
// which the ... | go | func IsFinalizedTransaction(tx *btcutil.Tx, blockHeight int32, blockTime time.Time) bool {
msgTx := tx.MsgTx()
// Lock time of zero means the transaction is finalized.
lockTime := msgTx.LockTime
if lockTime == 0 {
return true
}
// The lock time field of a transaction is either a block height at
// which the ... | [
"func",
"IsFinalizedTransaction",
"(",
"tx",
"*",
"btcutil",
".",
"Tx",
",",
"blockHeight",
"int32",
",",
"blockTime",
"time",
".",
"Time",
")",
"bool",
"{",
"msgTx",
":=",
"tx",
".",
"MsgTx",
"(",
")",
"\n\n",
"// Lock time of zero means the transaction is fina... | // IsFinalizedTransaction determines whether or not a transaction is finalized. | [
"IsFinalizedTransaction",
"determines",
"whether",
"or",
"not",
"a",
"transaction",
"is",
"finalized",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L135-L167 |
163,337 | btcsuite/btcd | blockchain/validate.go | isBIP0030Node | func isBIP0030Node(node *blockNode) bool {
if node.height == 91842 && node.hash.IsEqual(block91842Hash) {
return true
}
if node.height == 91880 && node.hash.IsEqual(block91880Hash) {
return true
}
return false
} | go | func isBIP0030Node(node *blockNode) bool {
if node.height == 91842 && node.hash.IsEqual(block91842Hash) {
return true
}
if node.height == 91880 && node.hash.IsEqual(block91880Hash) {
return true
}
return false
} | [
"func",
"isBIP0030Node",
"(",
"node",
"*",
"blockNode",
")",
"bool",
"{",
"if",
"node",
".",
"height",
"==",
"91842",
"&&",
"node",
".",
"hash",
".",
"IsEqual",
"(",
"block91842Hash",
")",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"node",
".",
... | // isBIP0030Node returns whether or not the passed node represents one of the
// two blocks that violate the BIP0030 rule which prevents transactions from
// overwriting old ones. | [
"isBIP0030Node",
"returns",
"whether",
"or",
"not",
"the",
"passed",
"node",
"represents",
"one",
"of",
"the",
"two",
"blocks",
"that",
"violate",
"the",
"BIP0030",
"rule",
"which",
"prevents",
"transactions",
"from",
"overwriting",
"old",
"ones",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L172-L182 |
163,338 | btcsuite/btcd | blockchain/validate.go | CheckTransactionSanity | func CheckTransactionSanity(tx *btcutil.Tx) error {
// A transaction must have at least one input.
msgTx := tx.MsgTx()
if len(msgTx.TxIn) == 0 {
return ruleError(ErrNoTxInputs, "transaction has no inputs")
}
// A transaction must have at least one output.
if len(msgTx.TxOut) == 0 {
return ruleError(ErrNoTxOu... | go | func CheckTransactionSanity(tx *btcutil.Tx) error {
// A transaction must have at least one input.
msgTx := tx.MsgTx()
if len(msgTx.TxIn) == 0 {
return ruleError(ErrNoTxInputs, "transaction has no inputs")
}
// A transaction must have at least one output.
if len(msgTx.TxOut) == 0 {
return ruleError(ErrNoTxOu... | [
"func",
"CheckTransactionSanity",
"(",
"tx",
"*",
"btcutil",
".",
"Tx",
")",
"error",
"{",
"// A transaction must have at least one input.",
"msgTx",
":=",
"tx",
".",
"MsgTx",
"(",
")",
"\n",
"if",
"len",
"(",
"msgTx",
".",
"TxIn",
")",
"==",
"0",
"{",
"re... | // CheckTransactionSanity performs some preliminary checks on a transaction to
// ensure it is sane. These checks are context free. | [
"CheckTransactionSanity",
"performs",
"some",
"preliminary",
"checks",
"on",
"a",
"transaction",
"to",
"ensure",
"it",
"is",
"sane",
".",
"These",
"checks",
"are",
"context",
"free",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L205-L298 |
163,339 | btcsuite/btcd | blockchain/validate.go | CountSigOps | func CountSigOps(tx *btcutil.Tx) int {
msgTx := tx.MsgTx()
// Accumulate the number of signature operations in all transaction
// inputs.
totalSigOps := 0
for _, txIn := range msgTx.TxIn {
numSigOps := txscript.GetSigOpCount(txIn.SignatureScript)
totalSigOps += numSigOps
}
// Accumulate the number of signa... | go | func CountSigOps(tx *btcutil.Tx) int {
msgTx := tx.MsgTx()
// Accumulate the number of signature operations in all transaction
// inputs.
totalSigOps := 0
for _, txIn := range msgTx.TxIn {
numSigOps := txscript.GetSigOpCount(txIn.SignatureScript)
totalSigOps += numSigOps
}
// Accumulate the number of signa... | [
"func",
"CountSigOps",
"(",
"tx",
"*",
"btcutil",
".",
"Tx",
")",
"int",
"{",
"msgTx",
":=",
"tx",
".",
"MsgTx",
"(",
")",
"\n\n",
"// Accumulate the number of signature operations in all transaction",
"// inputs.",
"totalSigOps",
":=",
"0",
"\n",
"for",
"_",
",... | // CountSigOps returns the number of signature operations for all transaction
// input and output scripts in the provided transaction. This uses the
// quicker, but imprecise, signature operation counting mechanism from
// txscript. | [
"CountSigOps",
"returns",
"the",
"number",
"of",
"signature",
"operations",
"for",
"all",
"transaction",
"input",
"and",
"output",
"scripts",
"in",
"the",
"provided",
"transaction",
".",
"This",
"uses",
"the",
"quicker",
"but",
"imprecise",
"signature",
"operation... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L350-L369 |
163,340 | btcsuite/btcd | blockchain/validate.go | CountP2SHSigOps | func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint) (int, error) {
// Coinbase transactions have no interesting inputs.
if isCoinBaseTx {
return 0, nil
}
// Accumulate the number of signature operations in all transaction
// inputs.
msgTx := tx.MsgTx()
totalSigOps := 0
for txInIn... | go | func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint) (int, error) {
// Coinbase transactions have no interesting inputs.
if isCoinBaseTx {
return 0, nil
}
// Accumulate the number of signature operations in all transaction
// inputs.
msgTx := tx.MsgTx()
totalSigOps := 0
for txInIn... | [
"func",
"CountP2SHSigOps",
"(",
"tx",
"*",
"btcutil",
".",
"Tx",
",",
"isCoinBaseTx",
"bool",
",",
"utxoView",
"*",
"UtxoViewpoint",
")",
"(",
"int",
",",
"error",
")",
"{",
"// Coinbase transactions have no interesting inputs.",
"if",
"isCoinBaseTx",
"{",
"return... | // CountP2SHSigOps returns the number of signature operations for all input
// transactions which are of the pay-to-script-hash type. This uses the
// precise, signature operation counting mechanism from the script engine which
// requires access to the input transaction scripts. | [
"CountP2SHSigOps",
"returns",
"the",
"number",
"of",
"signature",
"operations",
"for",
"all",
"input",
"transactions",
"which",
"are",
"of",
"the",
"pay",
"-",
"to",
"-",
"script",
"-",
"hash",
"type",
".",
"This",
"uses",
"the",
"precise",
"signature",
"ope... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L375-L422 |
163,341 | btcsuite/btcd | blockchain/validate.go | checkBlockHeaderSanity | func checkBlockHeaderSanity(header *wire.BlockHeader, powLimit *big.Int, timeSource MedianTimeSource, flags BehaviorFlags) error {
// Ensure the proof of work bits in the block header is in min/max range
// and the block hash is less than the target value described by the
// bits.
err := checkProofOfWork(header, po... | go | func checkBlockHeaderSanity(header *wire.BlockHeader, powLimit *big.Int, timeSource MedianTimeSource, flags BehaviorFlags) error {
// Ensure the proof of work bits in the block header is in min/max range
// and the block hash is less than the target value described by the
// bits.
err := checkProofOfWork(header, po... | [
"func",
"checkBlockHeaderSanity",
"(",
"header",
"*",
"wire",
".",
"BlockHeader",
",",
"powLimit",
"*",
"big",
".",
"Int",
",",
"timeSource",
"MedianTimeSource",
",",
"flags",
"BehaviorFlags",
")",
"error",
"{",
"// Ensure the proof of work bits in the block header is i... | // checkBlockHeaderSanity performs some preliminary checks on a block header to
// ensure it is sane before continuing with processing. These checks are
// context free.
//
// The flags do not modify the behavior of this function directly, however they
// are needed to pass along to checkProofOfWork. | [
"checkBlockHeaderSanity",
"performs",
"some",
"preliminary",
"checks",
"on",
"a",
"block",
"header",
"to",
"ensure",
"it",
"is",
"sane",
"before",
"continuing",
"with",
"processing",
".",
"These",
"checks",
"are",
"context",
"free",
".",
"The",
"flags",
"do",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L430-L460 |
163,342 | btcsuite/btcd | blockchain/validate.go | checkBlockSanity | func checkBlockSanity(block *btcutil.Block, powLimit *big.Int, timeSource MedianTimeSource, flags BehaviorFlags) error {
msgBlock := block.MsgBlock()
header := &msgBlock.Header
err := checkBlockHeaderSanity(header, powLimit, timeSource, flags)
if err != nil {
return err
}
// A block must have at least one tran... | go | func checkBlockSanity(block *btcutil.Block, powLimit *big.Int, timeSource MedianTimeSource, flags BehaviorFlags) error {
msgBlock := block.MsgBlock()
header := &msgBlock.Header
err := checkBlockHeaderSanity(header, powLimit, timeSource, flags)
if err != nil {
return err
}
// A block must have at least one tran... | [
"func",
"checkBlockSanity",
"(",
"block",
"*",
"btcutil",
".",
"Block",
",",
"powLimit",
"*",
"big",
".",
"Int",
",",
"timeSource",
"MedianTimeSource",
",",
"flags",
"BehaviorFlags",
")",
"error",
"{",
"msgBlock",
":=",
"block",
".",
"MsgBlock",
"(",
")",
... | // checkBlockSanity performs some preliminary checks on a block to ensure it is
// sane before continuing with block processing. These checks are context free.
//
// The flags do not modify the behavior of this function directly, however they
// are needed to pass along to checkBlockHeaderSanity. | [
"checkBlockSanity",
"performs",
"some",
"preliminary",
"checks",
"on",
"a",
"block",
"to",
"ensure",
"it",
"is",
"sane",
"before",
"continuing",
"with",
"block",
"processing",
".",
"These",
"checks",
"are",
"context",
"free",
".",
"The",
"flags",
"do",
"not",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L467-L570 |
163,343 | btcsuite/btcd | blockchain/validate.go | CheckBlockSanity | func CheckBlockSanity(block *btcutil.Block, powLimit *big.Int, timeSource MedianTimeSource) error {
return checkBlockSanity(block, powLimit, timeSource, BFNone)
} | go | func CheckBlockSanity(block *btcutil.Block, powLimit *big.Int, timeSource MedianTimeSource) error {
return checkBlockSanity(block, powLimit, timeSource, BFNone)
} | [
"func",
"CheckBlockSanity",
"(",
"block",
"*",
"btcutil",
".",
"Block",
",",
"powLimit",
"*",
"big",
".",
"Int",
",",
"timeSource",
"MedianTimeSource",
")",
"error",
"{",
"return",
"checkBlockSanity",
"(",
"block",
",",
"powLimit",
",",
"timeSource",
",",
"B... | // CheckBlockSanity performs some preliminary checks on a block to ensure it is
// sane before continuing with block processing. These checks are context free. | [
"CheckBlockSanity",
"performs",
"some",
"preliminary",
"checks",
"on",
"a",
"block",
"to",
"ensure",
"it",
"is",
"sane",
"before",
"continuing",
"with",
"block",
"processing",
".",
"These",
"checks",
"are",
"context",
"free",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L574-L576 |
163,344 | btcsuite/btcd | blockchain/validate.go | ExtractCoinbaseHeight | func ExtractCoinbaseHeight(coinbaseTx *btcutil.Tx) (int32, error) {
sigScript := coinbaseTx.MsgTx().TxIn[0].SignatureScript
if len(sigScript) < 1 {
str := "the coinbase signature script for blocks of " +
"version %d or greater must start with the " +
"length of the serialized block height"
str = fmt.Sprintf... | go | func ExtractCoinbaseHeight(coinbaseTx *btcutil.Tx) (int32, error) {
sigScript := coinbaseTx.MsgTx().TxIn[0].SignatureScript
if len(sigScript) < 1 {
str := "the coinbase signature script for blocks of " +
"version %d or greater must start with the " +
"length of the serialized block height"
str = fmt.Sprintf... | [
"func",
"ExtractCoinbaseHeight",
"(",
"coinbaseTx",
"*",
"btcutil",
".",
"Tx",
")",
"(",
"int32",
",",
"error",
")",
"{",
"sigScript",
":=",
"coinbaseTx",
".",
"MsgTx",
"(",
")",
".",
"TxIn",
"[",
"0",
"]",
".",
"SignatureScript",
"\n",
"if",
"len",
"(... | // ExtractCoinbaseHeight attempts to extract the height of the block from the
// scriptSig of a coinbase transaction. Coinbase heights are only present in
// blocks of version 2 or later. This was added as part of BIP0034. | [
"ExtractCoinbaseHeight",
"attempts",
"to",
"extract",
"the",
"height",
"of",
"the",
"block",
"from",
"the",
"scriptSig",
"of",
"a",
"coinbase",
"transaction",
".",
"Coinbase",
"heights",
"are",
"only",
"present",
"in",
"blocks",
"of",
"version",
"2",
"or",
"la... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L581-L617 |
163,345 | btcsuite/btcd | blockchain/validate.go | checkSerializedHeight | func checkSerializedHeight(coinbaseTx *btcutil.Tx, wantHeight int32) error {
serializedHeight, err := ExtractCoinbaseHeight(coinbaseTx)
if err != nil {
return err
}
if serializedHeight != wantHeight {
str := fmt.Sprintf("the coinbase signature script serialized "+
"block height is %d when %d was expected",
... | go | func checkSerializedHeight(coinbaseTx *btcutil.Tx, wantHeight int32) error {
serializedHeight, err := ExtractCoinbaseHeight(coinbaseTx)
if err != nil {
return err
}
if serializedHeight != wantHeight {
str := fmt.Sprintf("the coinbase signature script serialized "+
"block height is %d when %d was expected",
... | [
"func",
"checkSerializedHeight",
"(",
"coinbaseTx",
"*",
"btcutil",
".",
"Tx",
",",
"wantHeight",
"int32",
")",
"error",
"{",
"serializedHeight",
",",
"err",
":=",
"ExtractCoinbaseHeight",
"(",
"coinbaseTx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // checkSerializedHeight checks if the signature script in the passed
// transaction starts with the serialized block height of wantHeight. | [
"checkSerializedHeight",
"checks",
"if",
"the",
"signature",
"script",
"in",
"the",
"passed",
"transaction",
"starts",
"with",
"the",
"serialized",
"block",
"height",
"of",
"wantHeight",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L621-L634 |
163,346 | btcsuite/btcd | blockchain/validate.go | CheckConnectBlockTemplate | func (b *BlockChain) CheckConnectBlockTemplate(block *btcutil.Block) error {
b.chainLock.Lock()
defer b.chainLock.Unlock()
// Skip the proof of work check as this is just a block template.
flags := BFNoPoWCheck
// This only checks whether the block can be connected to the tip of the
// current chain.
tip := b.... | go | func (b *BlockChain) CheckConnectBlockTemplate(block *btcutil.Block) error {
b.chainLock.Lock()
defer b.chainLock.Unlock()
// Skip the proof of work check as this is just a block template.
flags := BFNoPoWCheck
// This only checks whether the block can be connected to the tip of the
// current chain.
tip := b.... | [
"func",
"(",
"b",
"*",
"BlockChain",
")",
"CheckConnectBlockTemplate",
"(",
"block",
"*",
"btcutil",
".",
"Block",
")",
"error",
"{",
"b",
".",
"chainLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"chainLock",
".",
"Unlock",
"(",
")",
"\n\n",
... | // CheckConnectBlockTemplate fully validates that connecting the passed block to
// the main chain does not violate any consensus rules, aside from the proof of
// work requirement. The block must connect to the current tip of the main chain.
//
// This function is safe for concurrent access. | [
"CheckConnectBlockTemplate",
"fully",
"validates",
"that",
"connecting",
"the",
"passed",
"block",
"to",
"the",
"main",
"chain",
"does",
"not",
"violate",
"any",
"consensus",
"rules",
"aside",
"from",
"the",
"proof",
"of",
"work",
"requirement",
".",
"The",
"blo... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/blockchain/validate.go#L1246-L1279 |
163,347 | btcsuite/btcd | txscript/error.go | scriptError | func scriptError(c ErrorCode, desc string) Error {
return Error{ErrorCode: c, Description: desc}
} | go | func scriptError(c ErrorCode, desc string) Error {
return Error{ErrorCode: c, Description: desc}
} | [
"func",
"scriptError",
"(",
"c",
"ErrorCode",
",",
"desc",
"string",
")",
"Error",
"{",
"return",
"Error",
"{",
"ErrorCode",
":",
"c",
",",
"Description",
":",
"desc",
"}",
"\n",
"}"
] | // scriptError creates an Error given a set of arguments. | [
"scriptError",
"creates",
"an",
"Error",
"given",
"a",
"set",
"of",
"arguments",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/error.go#L444-L446 |
163,348 | btcsuite/btcd | txscript/error.go | IsErrorCode | func IsErrorCode(err error, c ErrorCode) bool {
serr, ok := err.(Error)
return ok && serr.ErrorCode == c
} | go | func IsErrorCode(err error, c ErrorCode) bool {
serr, ok := err.(Error)
return ok && serr.ErrorCode == c
} | [
"func",
"IsErrorCode",
"(",
"err",
"error",
",",
"c",
"ErrorCode",
")",
"bool",
"{",
"serr",
",",
"ok",
":=",
"err",
".",
"(",
"Error",
")",
"\n",
"return",
"ok",
"&&",
"serr",
".",
"ErrorCode",
"==",
"c",
"\n",
"}"
] | // IsErrorCode returns whether or not the provided error is a script error with
// the provided error code. | [
"IsErrorCode",
"returns",
"whether",
"or",
"not",
"the",
"provided",
"error",
"is",
"a",
"script",
"error",
"with",
"the",
"provided",
"error",
"code",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/error.go#L450-L453 |
163,349 | btcsuite/btcd | txscript/standard.go | String | func (t ScriptClass) String() string {
if int(t) > len(scriptClassToName) || int(t) < 0 {
return "Invalid"
}
return scriptClassToName[t]
} | go | func (t ScriptClass) String() string {
if int(t) > len(scriptClassToName) || int(t) < 0 {
return "Invalid"
}
return scriptClassToName[t]
} | [
"func",
"(",
"t",
"ScriptClass",
")",
"String",
"(",
")",
"string",
"{",
"if",
"int",
"(",
"t",
")",
">",
"len",
"(",
"scriptClassToName",
")",
"||",
"int",
"(",
"t",
")",
"<",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"scriptCla... | // String implements the Stringer interface by returning the name of
// the enum script class. If the enum is invalid then "Invalid" will be
// returned. | [
"String",
"implements",
"the",
"Stringer",
"interface",
"by",
"returning",
"the",
"name",
"of",
"the",
"enum",
"script",
"class",
".",
"If",
"the",
"enum",
"is",
"invalid",
"then",
"Invalid",
"will",
"be",
"returned",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L79-L84 |
163,350 | btcsuite/btcd | txscript/standard.go | isPubkey | func isPubkey(pops []parsedOpcode) bool {
// Valid pubkeys are either 33 or 65 bytes.
return len(pops) == 2 &&
(len(pops[0].data) == 33 || len(pops[0].data) == 65) &&
pops[1].opcode.value == OP_CHECKSIG
} | go | func isPubkey(pops []parsedOpcode) bool {
// Valid pubkeys are either 33 or 65 bytes.
return len(pops) == 2 &&
(len(pops[0].data) == 33 || len(pops[0].data) == 65) &&
pops[1].opcode.value == OP_CHECKSIG
} | [
"func",
"isPubkey",
"(",
"pops",
"[",
"]",
"parsedOpcode",
")",
"bool",
"{",
"// Valid pubkeys are either 33 or 65 bytes.",
"return",
"len",
"(",
"pops",
")",
"==",
"2",
"&&",
"(",
"len",
"(",
"pops",
"[",
"0",
"]",
".",
"data",
")",
"==",
"33",
"||",
... | // isPubkey returns true if the script passed is a pay-to-pubkey transaction,
// false otherwise. | [
"isPubkey",
"returns",
"true",
"if",
"the",
"script",
"passed",
"is",
"a",
"pay",
"-",
"to",
"-",
"pubkey",
"transaction",
"false",
"otherwise",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L88-L93 |
163,351 | btcsuite/btcd | txscript/standard.go | isPubkeyHash | func isPubkeyHash(pops []parsedOpcode) bool {
return len(pops) == 5 &&
pops[0].opcode.value == OP_DUP &&
pops[1].opcode.value == OP_HASH160 &&
pops[2].opcode.value == OP_DATA_20 &&
pops[3].opcode.value == OP_EQUALVERIFY &&
pops[4].opcode.value == OP_CHECKSIG
} | go | func isPubkeyHash(pops []parsedOpcode) bool {
return len(pops) == 5 &&
pops[0].opcode.value == OP_DUP &&
pops[1].opcode.value == OP_HASH160 &&
pops[2].opcode.value == OP_DATA_20 &&
pops[3].opcode.value == OP_EQUALVERIFY &&
pops[4].opcode.value == OP_CHECKSIG
} | [
"func",
"isPubkeyHash",
"(",
"pops",
"[",
"]",
"parsedOpcode",
")",
"bool",
"{",
"return",
"len",
"(",
"pops",
")",
"==",
"5",
"&&",
"pops",
"[",
"0",
"]",
".",
"opcode",
".",
"value",
"==",
"OP_DUP",
"&&",
"pops",
"[",
"1",
"]",
".",
"opcode",
"... | // isPubkeyHash returns true if the script passed is a pay-to-pubkey-hash
// transaction, false otherwise. | [
"isPubkeyHash",
"returns",
"true",
"if",
"the",
"script",
"passed",
"is",
"a",
"pay",
"-",
"to",
"-",
"pubkey",
"-",
"hash",
"transaction",
"false",
"otherwise",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L97-L105 |
163,352 | btcsuite/btcd | txscript/standard.go | isMultiSig | func isMultiSig(pops []parsedOpcode) bool {
// The absolute minimum is 1 pubkey:
// OP_0/OP_1-16 <pubkey> OP_1 OP_CHECKMULTISIG
l := len(pops)
if l < 4 {
return false
}
if !isSmallInt(pops[0].opcode) {
return false
}
if !isSmallInt(pops[l-2].opcode) {
return false
}
if pops[l-1].opcode.value != OP_CHECK... | go | func isMultiSig(pops []parsedOpcode) bool {
// The absolute minimum is 1 pubkey:
// OP_0/OP_1-16 <pubkey> OP_1 OP_CHECKMULTISIG
l := len(pops)
if l < 4 {
return false
}
if !isSmallInt(pops[0].opcode) {
return false
}
if !isSmallInt(pops[l-2].opcode) {
return false
}
if pops[l-1].opcode.value != OP_CHECK... | [
"func",
"isMultiSig",
"(",
"pops",
"[",
"]",
"parsedOpcode",
")",
"bool",
"{",
"// The absolute minimum is 1 pubkey:",
"// OP_0/OP_1-16 <pubkey> OP_1 OP_CHECKMULTISIG",
"l",
":=",
"len",
"(",
"pops",
")",
"\n",
"if",
"l",
"<",
"4",
"{",
"return",
"false",
"\n",
... | // isMultiSig returns true if the passed script is a multisig transaction, false
// otherwise. | [
"isMultiSig",
"returns",
"true",
"if",
"the",
"passed",
"script",
"is",
"a",
"multisig",
"transaction",
"false",
"otherwise",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L109-L139 |
163,353 | btcsuite/btcd | txscript/standard.go | isNullData | func isNullData(pops []parsedOpcode) bool {
// A nulldata transaction is either a single OP_RETURN or an
// OP_RETURN SMALLDATA (where SMALLDATA is a data push up to
// MaxDataCarrierSize bytes).
l := len(pops)
if l == 1 && pops[0].opcode.value == OP_RETURN {
return true
}
return l == 2 &&
pops[0].opcode.va... | go | func isNullData(pops []parsedOpcode) bool {
// A nulldata transaction is either a single OP_RETURN or an
// OP_RETURN SMALLDATA (where SMALLDATA is a data push up to
// MaxDataCarrierSize bytes).
l := len(pops)
if l == 1 && pops[0].opcode.value == OP_RETURN {
return true
}
return l == 2 &&
pops[0].opcode.va... | [
"func",
"isNullData",
"(",
"pops",
"[",
"]",
"parsedOpcode",
")",
"bool",
"{",
"// A nulldata transaction is either a single OP_RETURN or an",
"// OP_RETURN SMALLDATA (where SMALLDATA is a data push up to",
"// MaxDataCarrierSize bytes).",
"l",
":=",
"len",
"(",
"pops",
")",
"\... | // isNullData returns true if the passed script is a null data transaction,
// false otherwise. | [
"isNullData",
"returns",
"true",
"if",
"the",
"passed",
"script",
"is",
"a",
"null",
"data",
"transaction",
"false",
"otherwise",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L143-L157 |
163,354 | btcsuite/btcd | txscript/standard.go | typeOfScript | func typeOfScript(pops []parsedOpcode) ScriptClass {
if isPubkey(pops) {
return PubKeyTy
} else if isPubkeyHash(pops) {
return PubKeyHashTy
} else if isWitnessPubKeyHash(pops) {
return WitnessV0PubKeyHashTy
} else if isScriptHash(pops) {
return ScriptHashTy
} else if isWitnessScriptHash(pops) {
return Wi... | go | func typeOfScript(pops []parsedOpcode) ScriptClass {
if isPubkey(pops) {
return PubKeyTy
} else if isPubkeyHash(pops) {
return PubKeyHashTy
} else if isWitnessPubKeyHash(pops) {
return WitnessV0PubKeyHashTy
} else if isScriptHash(pops) {
return ScriptHashTy
} else if isWitnessScriptHash(pops) {
return Wi... | [
"func",
"typeOfScript",
"(",
"pops",
"[",
"]",
"parsedOpcode",
")",
"ScriptClass",
"{",
"if",
"isPubkey",
"(",
"pops",
")",
"{",
"return",
"PubKeyTy",
"\n",
"}",
"else",
"if",
"isPubkeyHash",
"(",
"pops",
")",
"{",
"return",
"PubKeyHashTy",
"\n",
"}",
"e... | // scriptType returns the type of the script being inspected from the known
// standard types. | [
"scriptType",
"returns",
"the",
"type",
"of",
"the",
"script",
"being",
"inspected",
"from",
"the",
"known",
"standard",
"types",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L161-L178 |
163,355 | btcsuite/btcd | txscript/standard.go | GetScriptClass | func GetScriptClass(script []byte) ScriptClass {
pops, err := parseScript(script)
if err != nil {
return NonStandardTy
}
return typeOfScript(pops)
} | go | func GetScriptClass(script []byte) ScriptClass {
pops, err := parseScript(script)
if err != nil {
return NonStandardTy
}
return typeOfScript(pops)
} | [
"func",
"GetScriptClass",
"(",
"script",
"[",
"]",
"byte",
")",
"ScriptClass",
"{",
"pops",
",",
"err",
":=",
"parseScript",
"(",
"script",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NonStandardTy",
"\n",
"}",
"\n",
"return",
"typeOfScript",
"(... | // GetScriptClass returns the class of the script passed.
//
// NonStandardTy will be returned when the script does not parse. | [
"GetScriptClass",
"returns",
"the",
"class",
"of",
"the",
"script",
"passed",
".",
"NonStandardTy",
"will",
"be",
"returned",
"when",
"the",
"script",
"does",
"not",
"parse",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L183-L189 |
163,356 | btcsuite/btcd | txscript/standard.go | CalcScriptInfo | func CalcScriptInfo(sigScript, pkScript []byte, witness wire.TxWitness,
bip16, segwit bool) (*ScriptInfo, error) {
sigPops, err := parseScript(sigScript)
if err != nil {
return nil, err
}
pkPops, err := parseScript(pkScript)
if err != nil {
return nil, err
}
// Push only sigScript makes little sense.
si... | go | func CalcScriptInfo(sigScript, pkScript []byte, witness wire.TxWitness,
bip16, segwit bool) (*ScriptInfo, error) {
sigPops, err := parseScript(sigScript)
if err != nil {
return nil, err
}
pkPops, err := parseScript(pkScript)
if err != nil {
return nil, err
}
// Push only sigScript makes little sense.
si... | [
"func",
"CalcScriptInfo",
"(",
"sigScript",
",",
"pkScript",
"[",
"]",
"byte",
",",
"witness",
"wire",
".",
"TxWitness",
",",
"bip16",
",",
"segwit",
"bool",
")",
"(",
"*",
"ScriptInfo",
",",
"error",
")",
"{",
"sigPops",
",",
"err",
":=",
"parseScript",... | // CalcScriptInfo returns a structure providing data about the provided script
// pair. It will error if the pair is in someway invalid such that they can not
// be analysed, i.e. if they do not parse or the pkScript is not a push-only
// script | [
"CalcScriptInfo",
"returns",
"a",
"structure",
"providing",
"data",
"about",
"the",
"provided",
"script",
"pair",
".",
"It",
"will",
"error",
"if",
"the",
"pair",
"is",
"in",
"someway",
"invalid",
"such",
"that",
"they",
"can",
"not",
"be",
"analysed",
"i",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L255-L357 |
163,357 | btcsuite/btcd | txscript/standard.go | CalcMultiSigStats | func CalcMultiSigStats(script []byte) (int, int, error) {
pops, err := parseScript(script)
if err != nil {
return 0, 0, err
}
// A multi-signature script is of the pattern:
// NUM_SIGS PUBKEY PUBKEY PUBKEY... NUM_PUBKEYS OP_CHECKMULTISIG
// Therefore the number of signatures is the oldest item on the stack
/... | go | func CalcMultiSigStats(script []byte) (int, int, error) {
pops, err := parseScript(script)
if err != nil {
return 0, 0, err
}
// A multi-signature script is of the pattern:
// NUM_SIGS PUBKEY PUBKEY PUBKEY... NUM_PUBKEYS OP_CHECKMULTISIG
// Therefore the number of signatures is the oldest item on the stack
/... | [
"func",
"CalcMultiSigStats",
"(",
"script",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"int",
",",
"error",
")",
"{",
"pops",
",",
"err",
":=",
"parseScript",
"(",
"script",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"er... | // CalcMultiSigStats returns the number of public keys and signatures from
// a multi-signature transaction script. The passed script MUST already be
// known to be a multi-signature script. | [
"CalcMultiSigStats",
"returns",
"the",
"number",
"of",
"public",
"keys",
"and",
"signatures",
"from",
"a",
"multi",
"-",
"signature",
"transaction",
"script",
".",
"The",
"passed",
"script",
"MUST",
"already",
"be",
"known",
"to",
"be",
"a",
"multi",
"-",
"s... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L362-L383 |
163,358 | btcsuite/btcd | txscript/standard.go | payToPubKeyHashScript | func payToPubKeyHashScript(pubKeyHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_DUP).AddOp(OP_HASH160).
AddData(pubKeyHash).AddOp(OP_EQUALVERIFY).AddOp(OP_CHECKSIG).
Script()
} | go | func payToPubKeyHashScript(pubKeyHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_DUP).AddOp(OP_HASH160).
AddData(pubKeyHash).AddOp(OP_EQUALVERIFY).AddOp(OP_CHECKSIG).
Script()
} | [
"func",
"payToPubKeyHashScript",
"(",
"pubKeyHash",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"NewScriptBuilder",
"(",
")",
".",
"AddOp",
"(",
"OP_DUP",
")",
".",
"AddOp",
"(",
"OP_HASH160",
")",
".",
"AddData",
"(... | // payToPubKeyHashScript creates a new script to pay a transaction
// output to a 20-byte pubkey hash. It is expected that the input is a valid
// hash. | [
"payToPubKeyHashScript",
"creates",
"a",
"new",
"script",
"to",
"pay",
"a",
"transaction",
"output",
"to",
"a",
"20",
"-",
"byte",
"pubkey",
"hash",
".",
"It",
"is",
"expected",
"that",
"the",
"input",
"is",
"a",
"valid",
"hash",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L388-L392 |
163,359 | btcsuite/btcd | txscript/standard.go | payToWitnessPubKeyHashScript | func payToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_0).AddData(pubKeyHash).Script()
} | go | func payToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_0).AddData(pubKeyHash).Script()
} | [
"func",
"payToWitnessPubKeyHashScript",
"(",
"pubKeyHash",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"NewScriptBuilder",
"(",
")",
".",
"AddOp",
"(",
"OP_0",
")",
".",
"AddData",
"(",
"pubKeyHash",
")",
".",
"Script"... | // payToWitnessPubKeyHashScript creates a new script to pay to a version 0
// pubkey hash witness program. The passed hash is expected to be valid. | [
"payToWitnessPubKeyHashScript",
"creates",
"a",
"new",
"script",
"to",
"pay",
"to",
"a",
"version",
"0",
"pubkey",
"hash",
"witness",
"program",
".",
"The",
"passed",
"hash",
"is",
"expected",
"to",
"be",
"valid",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L396-L398 |
163,360 | btcsuite/btcd | txscript/standard.go | payToScriptHashScript | func payToScriptHashScript(scriptHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_HASH160).AddData(scriptHash).
AddOp(OP_EQUAL).Script()
} | go | func payToScriptHashScript(scriptHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_HASH160).AddData(scriptHash).
AddOp(OP_EQUAL).Script()
} | [
"func",
"payToScriptHashScript",
"(",
"scriptHash",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"NewScriptBuilder",
"(",
")",
".",
"AddOp",
"(",
"OP_HASH160",
")",
".",
"AddData",
"(",
"scriptHash",
")",
".",
"AddOp",
... | // payToScriptHashScript creates a new script to pay a transaction output to a
// script hash. It is expected that the input is a valid hash. | [
"payToScriptHashScript",
"creates",
"a",
"new",
"script",
"to",
"pay",
"a",
"transaction",
"output",
"to",
"a",
"script",
"hash",
".",
"It",
"is",
"expected",
"that",
"the",
"input",
"is",
"a",
"valid",
"hash",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L402-L405 |
163,361 | btcsuite/btcd | txscript/standard.go | payToWitnessScriptHashScript | func payToWitnessScriptHashScript(scriptHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_0).AddData(scriptHash).Script()
} | go | func payToWitnessScriptHashScript(scriptHash []byte) ([]byte, error) {
return NewScriptBuilder().AddOp(OP_0).AddData(scriptHash).Script()
} | [
"func",
"payToWitnessScriptHashScript",
"(",
"scriptHash",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"NewScriptBuilder",
"(",
")",
".",
"AddOp",
"(",
"OP_0",
")",
".",
"AddData",
"(",
"scriptHash",
")",
".",
"Script"... | // payToWitnessPubKeyHashScript creates a new script to pay to a version 0
// script hash witness program. The passed hash is expected to be valid. | [
"payToWitnessPubKeyHashScript",
"creates",
"a",
"new",
"script",
"to",
"pay",
"to",
"a",
"version",
"0",
"script",
"hash",
"witness",
"program",
".",
"The",
"passed",
"hash",
"is",
"expected",
"to",
"be",
"valid",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L409-L411 |
163,362 | btcsuite/btcd | txscript/standard.go | payToPubKeyScript | func payToPubKeyScript(serializedPubKey []byte) ([]byte, error) {
return NewScriptBuilder().AddData(serializedPubKey).
AddOp(OP_CHECKSIG).Script()
} | go | func payToPubKeyScript(serializedPubKey []byte) ([]byte, error) {
return NewScriptBuilder().AddData(serializedPubKey).
AddOp(OP_CHECKSIG).Script()
} | [
"func",
"payToPubKeyScript",
"(",
"serializedPubKey",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"NewScriptBuilder",
"(",
")",
".",
"AddData",
"(",
"serializedPubKey",
")",
".",
"AddOp",
"(",
"OP_CHECKSIG",
")",
".",
... | // payToPubkeyScript creates a new script to pay a transaction output to a
// public key. It is expected that the input is a valid pubkey. | [
"payToPubkeyScript",
"creates",
"a",
"new",
"script",
"to",
"pay",
"a",
"transaction",
"output",
"to",
"a",
"public",
"key",
".",
"It",
"is",
"expected",
"that",
"the",
"input",
"is",
"a",
"valid",
"pubkey",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L415-L418 |
163,363 | btcsuite/btcd | txscript/standard.go | PayToAddrScript | func PayToAddrScript(addr btcutil.Address) ([]byte, error) {
const nilAddrErrStr = "unable to generate payment script for nil address"
switch addr := addr.(type) {
case *btcutil.AddressPubKeyHash:
if addr == nil {
return nil, scriptError(ErrUnsupportedAddress,
nilAddrErrStr)
}
return payToPubKeyHashScr... | go | func PayToAddrScript(addr btcutil.Address) ([]byte, error) {
const nilAddrErrStr = "unable to generate payment script for nil address"
switch addr := addr.(type) {
case *btcutil.AddressPubKeyHash:
if addr == nil {
return nil, scriptError(ErrUnsupportedAddress,
nilAddrErrStr)
}
return payToPubKeyHashScr... | [
"func",
"PayToAddrScript",
"(",
"addr",
"btcutil",
".",
"Address",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"const",
"nilAddrErrStr",
"=",
"\"",
"\"",
"\n\n",
"switch",
"addr",
":=",
"addr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"btcuti... | // PayToAddrScript creates a new script to pay a transaction output to a the
// specified address. | [
"PayToAddrScript",
"creates",
"a",
"new",
"script",
"to",
"pay",
"a",
"transaction",
"output",
"to",
"a",
"the",
"specified",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L422-L464 |
163,364 | btcsuite/btcd | txscript/standard.go | NullDataScript | func NullDataScript(data []byte) ([]byte, error) {
if len(data) > MaxDataCarrierSize {
str := fmt.Sprintf("data size %d is larger than max "+
"allowed size %d", len(data), MaxDataCarrierSize)
return nil, scriptError(ErrTooMuchNullData, str)
}
return NewScriptBuilder().AddOp(OP_RETURN).AddData(data).Script()
... | go | func NullDataScript(data []byte) ([]byte, error) {
if len(data) > MaxDataCarrierSize {
str := fmt.Sprintf("data size %d is larger than max "+
"allowed size %d", len(data), MaxDataCarrierSize)
return nil, scriptError(ErrTooMuchNullData, str)
}
return NewScriptBuilder().AddOp(OP_RETURN).AddData(data).Script()
... | [
"func",
"NullDataScript",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"data",
")",
">",
"MaxDataCarrierSize",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",... | // NullDataScript creates a provably-prunable script containing OP_RETURN
// followed by the passed data. An Error with the error code ErrTooMuchNullData
// will be returned if the length of the passed data exceeds MaxDataCarrierSize. | [
"NullDataScript",
"creates",
"a",
"provably",
"-",
"prunable",
"script",
"containing",
"OP_RETURN",
"followed",
"by",
"the",
"passed",
"data",
".",
"An",
"Error",
"with",
"the",
"error",
"code",
"ErrTooMuchNullData",
"will",
"be",
"returned",
"if",
"the",
"lengt... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L469-L477 |
163,365 | btcsuite/btcd | txscript/standard.go | MultiSigScript | func MultiSigScript(pubkeys []*btcutil.AddressPubKey, nrequired int) ([]byte, error) {
if len(pubkeys) < nrequired {
str := fmt.Sprintf("unable to generate multisig script with "+
"%d required signatures when there are only %d public "+
"keys available", nrequired, len(pubkeys))
return nil, scriptError(ErrTo... | go | func MultiSigScript(pubkeys []*btcutil.AddressPubKey, nrequired int) ([]byte, error) {
if len(pubkeys) < nrequired {
str := fmt.Sprintf("unable to generate multisig script with "+
"%d required signatures when there are only %d public "+
"keys available", nrequired, len(pubkeys))
return nil, scriptError(ErrTo... | [
"func",
"MultiSigScript",
"(",
"pubkeys",
"[",
"]",
"*",
"btcutil",
".",
"AddressPubKey",
",",
"nrequired",
"int",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"pubkeys",
")",
"<",
"nrequired",
"{",
"str",
":=",
"fmt",
".",
... | // MultiSigScript returns a valid script for a multisignature redemption where
// nrequired of the keys in pubkeys are required to have signed the transaction
// for success. An Error with the error code ErrTooManyRequiredSigs will be
// returned if nrequired is larger than the number of keys provided. | [
"MultiSigScript",
"returns",
"a",
"valid",
"script",
"for",
"a",
"multisignature",
"redemption",
"where",
"nrequired",
"of",
"the",
"keys",
"in",
"pubkeys",
"are",
"required",
"to",
"have",
"signed",
"the",
"transaction",
"for",
"success",
".",
"An",
"Error",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L483-L499 |
163,366 | btcsuite/btcd | txscript/standard.go | PushedData | func PushedData(script []byte) ([][]byte, error) {
pops, err := parseScript(script)
if err != nil {
return nil, err
}
var data [][]byte
for _, pop := range pops {
if pop.data != nil {
data = append(data, pop.data)
} else if pop.opcode.value == OP_0 {
data = append(data, nil)
}
}
return data, nil
} | go | func PushedData(script []byte) ([][]byte, error) {
pops, err := parseScript(script)
if err != nil {
return nil, err
}
var data [][]byte
for _, pop := range pops {
if pop.data != nil {
data = append(data, pop.data)
} else if pop.opcode.value == OP_0 {
data = append(data, nil)
}
}
return data, nil
} | [
"func",
"PushedData",
"(",
"script",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pops",
",",
"err",
":=",
"parseScript",
"(",
"script",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // PushedData returns an array of byte slices containing any pushed data found
// in the passed script. This includes OP_0, but not OP_1 - OP_16. | [
"PushedData",
"returns",
"an",
"array",
"of",
"byte",
"slices",
"containing",
"any",
"pushed",
"data",
"found",
"in",
"the",
"passed",
"script",
".",
"This",
"includes",
"OP_0",
"but",
"not",
"OP_1",
"-",
"OP_16",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L503-L518 |
163,367 | btcsuite/btcd | txscript/standard.go | ExtractPkScriptAddrs | func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (ScriptClass, []btcutil.Address, int, error) {
var addrs []btcutil.Address
var requiredSigs int
// No valid addresses or required signatures if the script doesn't
// parse.
pops, err := parseScript(pkScript)
if err != nil {
return NonStan... | go | func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (ScriptClass, []btcutil.Address, int, error) {
var addrs []btcutil.Address
var requiredSigs int
// No valid addresses or required signatures if the script doesn't
// parse.
pops, err := parseScript(pkScript)
if err != nil {
return NonStan... | [
"func",
"ExtractPkScriptAddrs",
"(",
"pkScript",
"[",
"]",
"byte",
",",
"chainParams",
"*",
"chaincfg",
".",
"Params",
")",
"(",
"ScriptClass",
",",
"[",
"]",
"btcutil",
".",
"Address",
",",
"int",
",",
"error",
")",
"{",
"var",
"addrs",
"[",
"]",
"btc... | // ExtractPkScriptAddrs returns the type of script, addresses and required
// signatures associated with the passed PkScript. Note that it only works for
// 'standard' transaction script types. Any data such as public keys which are
// invalid are omitted from the results. | [
"ExtractPkScriptAddrs",
"returns",
"the",
"type",
"of",
"script",
"addresses",
"and",
"required",
"signatures",
"associated",
"with",
"the",
"passed",
"PkScript",
".",
"Note",
"that",
"it",
"only",
"works",
"for",
"standard",
"transaction",
"script",
"types",
".",... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/standard.go#L524-L625 |
163,368 | btcsuite/btcd | btcjson/chainsvrwsntfns.go | NewFilteredBlockConnectedNtfn | func NewFilteredBlockConnectedNtfn(height int32, header string, subscribedTxs []string) *FilteredBlockConnectedNtfn {
return &FilteredBlockConnectedNtfn{
Height: height,
Header: header,
SubscribedTxs: subscribedTxs,
}
} | go | func NewFilteredBlockConnectedNtfn(height int32, header string, subscribedTxs []string) *FilteredBlockConnectedNtfn {
return &FilteredBlockConnectedNtfn{
Height: height,
Header: header,
SubscribedTxs: subscribedTxs,
}
} | [
"func",
"NewFilteredBlockConnectedNtfn",
"(",
"height",
"int32",
",",
"header",
"string",
",",
"subscribedTxs",
"[",
"]",
"string",
")",
"*",
"FilteredBlockConnectedNtfn",
"{",
"return",
"&",
"FilteredBlockConnectedNtfn",
"{",
"Height",
":",
"height",
",",
"Header",... | // NewFilteredBlockConnectedNtfn returns a new instance which can be used to
// issue a filteredblockconnected JSON-RPC notification. | [
"NewFilteredBlockConnectedNtfn",
"returns",
"a",
"new",
"instance",
"which",
"can",
"be",
"used",
"to",
"issue",
"a",
"filteredblockconnected",
"JSON",
"-",
"RPC",
"notification",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcjson/chainsvrwsntfns.go#L132-L138 |
163,369 | btcsuite/btcd | btcjson/chainsvrwsntfns.go | NewFilteredBlockDisconnectedNtfn | func NewFilteredBlockDisconnectedNtfn(height int32, header string) *FilteredBlockDisconnectedNtfn {
return &FilteredBlockDisconnectedNtfn{
Height: height,
Header: header,
}
} | go | func NewFilteredBlockDisconnectedNtfn(height int32, header string) *FilteredBlockDisconnectedNtfn {
return &FilteredBlockDisconnectedNtfn{
Height: height,
Header: header,
}
} | [
"func",
"NewFilteredBlockDisconnectedNtfn",
"(",
"height",
"int32",
",",
"header",
"string",
")",
"*",
"FilteredBlockDisconnectedNtfn",
"{",
"return",
"&",
"FilteredBlockDisconnectedNtfn",
"{",
"Height",
":",
"height",
",",
"Header",
":",
"header",
",",
"}",
"\n",
... | // NewFilteredBlockDisconnectedNtfn returns a new instance which can be used to
// issue a filteredblockdisconnected JSON-RPC notification. | [
"NewFilteredBlockDisconnectedNtfn",
"returns",
"a",
"new",
"instance",
"which",
"can",
"be",
"used",
"to",
"issue",
"a",
"filteredblockdisconnected",
"JSON",
"-",
"RPC",
"notification",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcjson/chainsvrwsntfns.go#L149-L154 |
163,370 | btcsuite/btcd | btcjson/chainsvrwsntfns.go | NewTxAcceptedNtfn | func NewTxAcceptedNtfn(txHash string, amount float64) *TxAcceptedNtfn {
return &TxAcceptedNtfn{
TxID: txHash,
Amount: amount,
}
} | go | func NewTxAcceptedNtfn(txHash string, amount float64) *TxAcceptedNtfn {
return &TxAcceptedNtfn{
TxID: txHash,
Amount: amount,
}
} | [
"func",
"NewTxAcceptedNtfn",
"(",
"txHash",
"string",
",",
"amount",
"float64",
")",
"*",
"TxAcceptedNtfn",
"{",
"return",
"&",
"TxAcceptedNtfn",
"{",
"TxID",
":",
"txHash",
",",
"Amount",
":",
"amount",
",",
"}",
"\n",
"}"
] | // NewTxAcceptedNtfn returns a new instance which can be used to issue a
// txaccepted JSON-RPC notification. | [
"NewTxAcceptedNtfn",
"returns",
"a",
"new",
"instance",
"which",
"can",
"be",
"used",
"to",
"issue",
"a",
"txaccepted",
"JSON",
"-",
"RPC",
"notification",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/btcjson/chainsvrwsntfns.go#L256-L261 |
163,371 | btcsuite/btcd | rpcclient/rawtransactions.go | GetRawTransactionAsync | func (c *Client) GetRawTransactionAsync(txHash *chainhash.Hash) FutureGetRawTransactionResult {
hash := ""
if txHash != nil {
hash = txHash.String()
}
cmd := btcjson.NewGetRawTransactionCmd(hash, btcjson.Int(0))
return c.sendCmd(cmd)
} | go | func (c *Client) GetRawTransactionAsync(txHash *chainhash.Hash) FutureGetRawTransactionResult {
hash := ""
if txHash != nil {
hash = txHash.String()
}
cmd := btcjson.NewGetRawTransactionCmd(hash, btcjson.Int(0))
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRawTransactionAsync",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"FutureGetRawTransactionResult",
"{",
"hash",
":=",
"\"",
"\"",
"\n",
"if",
"txHash",
"!=",
"nil",
"{",
"hash",
"=",
"txHash",
".",
"String",... | // GetRawTransactionAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetRawTransaction for the blocking version and more details. | [
"GetRawTransactionAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L99-L107 |
163,372 | btcsuite/btcd | rpcclient/rawtransactions.go | GetRawTransaction | func (c *Client) GetRawTransaction(txHash *chainhash.Hash) (*btcutil.Tx, error) {
return c.GetRawTransactionAsync(txHash).Receive()
} | go | func (c *Client) GetRawTransaction(txHash *chainhash.Hash) (*btcutil.Tx, error) {
return c.GetRawTransactionAsync(txHash).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRawTransaction",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcutil",
".",
"Tx",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetRawTransactionAsync",
"(",
"txHash",
")",
".",
"Receive",
"(",... | // GetRawTransaction returns a transaction given its hash.
//
// See GetRawTransactionVerbose to obtain additional information about the
// transaction. | [
"GetRawTransaction",
"returns",
"a",
"transaction",
"given",
"its",
"hash",
".",
"See",
"GetRawTransactionVerbose",
"to",
"obtain",
"additional",
"information",
"about",
"the",
"transaction",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L113-L115 |
163,373 | btcsuite/btcd | rpcclient/rawtransactions.go | GetRawTransactionVerboseAsync | func (c *Client) GetRawTransactionVerboseAsync(txHash *chainhash.Hash) FutureGetRawTransactionVerboseResult {
hash := ""
if txHash != nil {
hash = txHash.String()
}
cmd := btcjson.NewGetRawTransactionCmd(hash, btcjson.Int(1))
return c.sendCmd(cmd)
} | go | func (c *Client) GetRawTransactionVerboseAsync(txHash *chainhash.Hash) FutureGetRawTransactionVerboseResult {
hash := ""
if txHash != nil {
hash = txHash.String()
}
cmd := btcjson.NewGetRawTransactionCmd(hash, btcjson.Int(1))
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRawTransactionVerboseAsync",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"FutureGetRawTransactionVerboseResult",
"{",
"hash",
":=",
"\"",
"\"",
"\n",
"if",
"txHash",
"!=",
"nil",
"{",
"hash",
"=",
"txHash",
".... | // GetRawTransactionVerboseAsync returns an instance of a type that can be used
// to get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See GetRawTransactionVerbose for the blocking version and more details. | [
"GetRawTransactionVerboseAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"retu... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L145-L153 |
163,374 | btcsuite/btcd | rpcclient/rawtransactions.go | GetRawTransactionVerbose | func (c *Client) GetRawTransactionVerbose(txHash *chainhash.Hash) (*btcjson.TxRawResult, error) {
return c.GetRawTransactionVerboseAsync(txHash).Receive()
} | go | func (c *Client) GetRawTransactionVerbose(txHash *chainhash.Hash) (*btcjson.TxRawResult, error) {
return c.GetRawTransactionVerboseAsync(txHash).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRawTransactionVerbose",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcjson",
".",
"TxRawResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetRawTransactionVerboseAsync",
"(",
"txHash",
")",
"... | // GetRawTransactionVerbose returns information about a transaction given
// its hash.
//
// See GetRawTransaction to obtain only the transaction already deserialized. | [
"GetRawTransactionVerbose",
"returns",
"information",
"about",
"a",
"transaction",
"given",
"its",
"hash",
".",
"See",
"GetRawTransaction",
"to",
"obtain",
"only",
"the",
"transaction",
"already",
"deserialized",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L159-L161 |
163,375 | btcsuite/btcd | rpcclient/rawtransactions.go | Receive | func (r FutureDecodeRawTransactionResult) Receive() (*btcjson.TxRawResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a decoderawtransaction result object.
var rawTxResult btcjson.TxRawResult
err = json.Unmarshal(res, &rawTxResult)
if err != nil {
return n... | go | func (r FutureDecodeRawTransactionResult) Receive() (*btcjson.TxRawResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a decoderawtransaction result object.
var rawTxResult btcjson.TxRawResult
err = json.Unmarshal(res, &rawTxResult)
if err != nil {
return n... | [
"func",
"(",
"r",
"FutureDecodeRawTransactionResult",
")",
"Receive",
"(",
")",
"(",
"*",
"btcjson",
".",
"TxRawResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"ni... | // Receive waits for the response promised by the future and returns information
// about a transaction given its serialized bytes. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"information",
"about",
"a",
"transaction",
"given",
"its",
"serialized",
"bytes",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L169-L183 |
163,376 | btcsuite/btcd | rpcclient/rawtransactions.go | DecodeRawTransactionAsync | func (c *Client) DecodeRawTransactionAsync(serializedTx []byte) FutureDecodeRawTransactionResult {
txHex := hex.EncodeToString(serializedTx)
cmd := btcjson.NewDecodeRawTransactionCmd(txHex)
return c.sendCmd(cmd)
} | go | func (c *Client) DecodeRawTransactionAsync(serializedTx []byte) FutureDecodeRawTransactionResult {
txHex := hex.EncodeToString(serializedTx)
cmd := btcjson.NewDecodeRawTransactionCmd(txHex)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DecodeRawTransactionAsync",
"(",
"serializedTx",
"[",
"]",
"byte",
")",
"FutureDecodeRawTransactionResult",
"{",
"txHex",
":=",
"hex",
".",
"EncodeToString",
"(",
"serializedTx",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"N... | // DecodeRawTransactionAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See DecodeRawTransaction for the blocking version and more details. | [
"DecodeRawTransactionAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L190-L194 |
163,377 | btcsuite/btcd | rpcclient/rawtransactions.go | DecodeRawTransaction | func (c *Client) DecodeRawTransaction(serializedTx []byte) (*btcjson.TxRawResult, error) {
return c.DecodeRawTransactionAsync(serializedTx).Receive()
} | go | func (c *Client) DecodeRawTransaction(serializedTx []byte) (*btcjson.TxRawResult, error) {
return c.DecodeRawTransactionAsync(serializedTx).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DecodeRawTransaction",
"(",
"serializedTx",
"[",
"]",
"byte",
")",
"(",
"*",
"btcjson",
".",
"TxRawResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"DecodeRawTransactionAsync",
"(",
"serializedTx",
")",
".",
"Rece... | // DecodeRawTransaction returns information about a transaction given its
// serialized bytes. | [
"DecodeRawTransaction",
"returns",
"information",
"about",
"a",
"transaction",
"given",
"its",
"serialized",
"bytes",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L198-L200 |
163,378 | btcsuite/btcd | rpcclient/rawtransactions.go | CreateRawTransactionAsync | func (c *Client) CreateRawTransactionAsync(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount, lockTime *int64) FutureCreateRawTransactionResult {
convertedAmts := make(map[string]float64, len(amounts))
for addr, amount := range amounts {
convertedAmts[addr.String()] = amount.ToBTC()
}... | go | func (c *Client) CreateRawTransactionAsync(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount, lockTime *int64) FutureCreateRawTransactionResult {
convertedAmts := make(map[string]float64, len(amounts))
for addr, amount := range amounts {
convertedAmts[addr.String()] = amount.ToBTC()
}... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateRawTransactionAsync",
"(",
"inputs",
"[",
"]",
"btcjson",
".",
"TransactionInput",
",",
"amounts",
"map",
"[",
"btcutil",
".",
"Address",
"]",
"btcutil",
".",
"Amount",
",",
"lockTime",
"*",
"int64",
")",
"Futur... | // CreateRawTransactionAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See CreateRawTransaction for the blocking version and more details. | [
"CreateRawTransactionAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L241-L250 |
163,379 | btcsuite/btcd | rpcclient/rawtransactions.go | CreateRawTransaction | func (c *Client) CreateRawTransaction(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount, lockTime *int64) (*wire.MsgTx, error) {
return c.CreateRawTransactionAsync(inputs, amounts, lockTime).Receive()
} | go | func (c *Client) CreateRawTransaction(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount, lockTime *int64) (*wire.MsgTx, error) {
return c.CreateRawTransactionAsync(inputs, amounts, lockTime).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateRawTransaction",
"(",
"inputs",
"[",
"]",
"btcjson",
".",
"TransactionInput",
",",
"amounts",
"map",
"[",
"btcutil",
".",
"Address",
"]",
"btcutil",
".",
"Amount",
",",
"lockTime",
"*",
"int64",
")",
"(",
"*",... | // CreateRawTransaction returns a new transaction spending the provided inputs
// and sending to the provided addresses. | [
"CreateRawTransaction",
"returns",
"a",
"new",
"transaction",
"spending",
"the",
"provided",
"inputs",
"and",
"sending",
"to",
"the",
"provided",
"addresses",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L254-L258 |
163,380 | btcsuite/btcd | rpcclient/rawtransactions.go | Receive | func (r FutureSendRawTransactionResult) Receive() (*chainhash.Hash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a string.
var txHashStr string
err = json.Unmarshal(res, &txHashStr)
if err != nil {
return nil, err
}
return chainhash.NewHashFromStr(txHashS... | go | func (r FutureSendRawTransactionResult) Receive() (*chainhash.Hash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a string.
var txHashStr string
err = json.Unmarshal(res, &txHashStr)
if err != nil {
return nil, err
}
return chainhash.NewHashFromStr(txHashS... | [
"func",
"(",
"r",
"FutureSendRawTransactionResult",
")",
"Receive",
"(",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"... | // Receive waits for the response promised by the future and returns the result
// of submitting the encoded transaction to the server which then relays it to
// the network. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"result",
"of",
"submitting",
"the",
"encoded",
"transaction",
"to",
"the",
"server",
"which",
"then",
"relays",
"it",
"to",
"the",
"network",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L267-L281 |
163,381 | btcsuite/btcd | rpcclient/rawtransactions.go | SendRawTransactionAsync | func (c *Client) SendRawTransactionAsync(tx *wire.MsgTx, allowHighFees bool) FutureSendRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
buf := bytes.NewBuffer(make([]byte, 0, tx.SerializeSize()))
if err := tx.Serialize(buf); err != nil {
return newFutu... | go | func (c *Client) SendRawTransactionAsync(tx *wire.MsgTx, allowHighFees bool) FutureSendRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
buf := bytes.NewBuffer(make([]byte, 0, tx.SerializeSize()))
if err := tx.Serialize(buf); err != nil {
return newFutu... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendRawTransactionAsync",
"(",
"tx",
"*",
"wire",
".",
"MsgTx",
",",
"allowHighFees",
"bool",
")",
"FutureSendRawTransactionResult",
"{",
"txHex",
":=",
"\"",
"\"",
"\n",
"if",
"tx",
"!=",
"nil",
"{",
"// Serialize the ... | // SendRawTransactionAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See SendRawTransaction for the blocking version and more details. | [
"SendRawTransactionAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L288-L301 |
163,382 | btcsuite/btcd | rpcclient/rawtransactions.go | SendRawTransaction | func (c *Client) SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error) {
return c.SendRawTransactionAsync(tx, allowHighFees).Receive()
} | go | func (c *Client) SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error) {
return c.SendRawTransactionAsync(tx, allowHighFees).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendRawTransaction",
"(",
"tx",
"*",
"wire",
".",
"MsgTx",
",",
"allowHighFees",
"bool",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"return",
"c",
".",
"SendRawTransactionAsync",
"(",
"tx",
"... | // SendRawTransaction submits the encoded transaction to the server which will
// then relay it to the network. | [
"SendRawTransaction",
"submits",
"the",
"encoded",
"transaction",
"to",
"the",
"server",
"which",
"will",
"then",
"relay",
"it",
"to",
"the",
"network",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L305-L307 |
163,383 | btcsuite/btcd | rpcclient/rawtransactions.go | Receive | func (r FutureSignRawTransactionResult) Receive() (*wire.MsgTx, bool, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, false, err
}
// Unmarshal as a signrawtransaction result.
var signRawTxResult btcjson.SignRawTransactionResult
err = json.Unmarshal(res, &signRawTxResult)
if err != nil {
r... | go | func (r FutureSignRawTransactionResult) Receive() (*wire.MsgTx, bool, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, false, err
}
// Unmarshal as a signrawtransaction result.
var signRawTxResult btcjson.SignRawTransactionResult
err = json.Unmarshal(res, &signRawTxResult)
if err != nil {
r... | [
"func",
"(",
"r",
"FutureSignRawTransactionResult",
")",
"Receive",
"(",
")",
"(",
"*",
"wire",
".",
"MsgTx",
",",
"bool",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",... | // Receive waits for the response promised by the future and returns the
// signed transaction as well as whether or not all inputs are now signed. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"signed",
"transaction",
"as",
"well",
"as",
"whether",
"or",
"not",
"all",
"inputs",
"are",
"now",
"signed",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L316-L342 |
163,384 | btcsuite/btcd | rpcclient/rawtransactions.go | SignRawTransaction2 | func (c *Client) SignRawTransaction2(tx *wire.MsgTx, inputs []btcjson.RawTxInput) (*wire.MsgTx, bool, error) {
return c.SignRawTransaction2Async(tx, inputs).Receive()
} | go | func (c *Client) SignRawTransaction2(tx *wire.MsgTx, inputs []btcjson.RawTxInput) (*wire.MsgTx, bool, error) {
return c.SignRawTransaction2Async(tx, inputs).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SignRawTransaction2",
"(",
"tx",
"*",
"wire",
".",
"MsgTx",
",",
"inputs",
"[",
"]",
"btcjson",
".",
"RawTxInput",
")",
"(",
"*",
"wire",
".",
"MsgTx",
",",
"bool",
",",
"error",
")",
"{",
"return",
"c",
".",
... | // SignRawTransaction2 signs inputs for the passed transaction given the list
// of information about the input transactions needed to perform the signing
// process.
//
// This only input transactions that need to be specified are ones the
// RPC server does not already know. Already known input transactions will be
... | [
"SignRawTransaction2",
"signs",
"inputs",
"for",
"the",
"passed",
"transaction",
"given",
"the",
"list",
"of",
"information",
"about",
"the",
"input",
"transactions",
"needed",
"to",
"perform",
"the",
"signing",
"process",
".",
"This",
"only",
"input",
"transactio... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L405-L407 |
163,385 | btcsuite/btcd | rpcclient/rawtransactions.go | SignRawTransaction3Async | func (c *Client) SignRawTransaction3Async(tx *wire.MsgTx,
inputs []btcjson.RawTxInput,
privKeysWIF []string) FutureSignRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
buf := bytes.NewBuffer(make([]byte, 0, tx.SerializeSize()))
if err := tx.Serialize(b... | go | func (c *Client) SignRawTransaction3Async(tx *wire.MsgTx,
inputs []btcjson.RawTxInput,
privKeysWIF []string) FutureSignRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
buf := bytes.NewBuffer(make([]byte, 0, tx.SerializeSize()))
if err := tx.Serialize(b... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SignRawTransaction3Async",
"(",
"tx",
"*",
"wire",
".",
"MsgTx",
",",
"inputs",
"[",
"]",
"btcjson",
".",
"RawTxInput",
",",
"privKeysWIF",
"[",
"]",
"string",
")",
"FutureSignRawTransactionResult",
"{",
"txHex",
":=",
... | // SignRawTransaction3Async returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See SignRawTransaction3 for the blocking version and more details. | [
"SignRawTransaction3Async",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned"... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L414-L431 |
163,386 | btcsuite/btcd | rpcclient/rawtransactions.go | SearchRawTransactionsAsync | func (c *Client) SearchRawTransactionsAsync(address btcutil.Address, skip, count int, reverse bool, filterAddrs []string) FutureSearchRawTransactionsResult {
addr := address.EncodeAddress()
verbose := btcjson.Int(0)
cmd := btcjson.NewSearchRawTransactionsCmd(addr, verbose, &skip, &count,
nil, &reverse, &filterAddr... | go | func (c *Client) SearchRawTransactionsAsync(address btcutil.Address, skip, count int, reverse bool, filterAddrs []string) FutureSearchRawTransactionsResult {
addr := address.EncodeAddress()
verbose := btcjson.Int(0)
cmd := btcjson.NewSearchRawTransactionsCmd(addr, verbose, &skip, &count,
nil, &reverse, &filterAddr... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SearchRawTransactionsAsync",
"(",
"address",
"btcutil",
".",
"Address",
",",
"skip",
",",
"count",
"int",
",",
"reverse",
"bool",
",",
"filterAddrs",
"[",
"]",
"string",
")",
"FutureSearchRawTransactionsResult",
"{",
"add... | // SearchRawTransactionsAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See SearchRawTransactions for the blocking version and more details. | [
"SearchRawTransactionsAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returne... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L553-L559 |
163,387 | btcsuite/btcd | rpcclient/rawtransactions.go | SearchRawTransactionsVerboseAsync | func (c *Client) SearchRawTransactionsVerboseAsync(address btcutil.Address, skip,
count int, includePrevOut, reverse bool, filterAddrs *[]string) FutureSearchRawTransactionsVerboseResult {
addr := address.EncodeAddress()
verbose := btcjson.Int(1)
var prevOut *int
if includePrevOut {
prevOut = btcjson.Int(1)
}
... | go | func (c *Client) SearchRawTransactionsVerboseAsync(address btcutil.Address, skip,
count int, includePrevOut, reverse bool, filterAddrs *[]string) FutureSearchRawTransactionsVerboseResult {
addr := address.EncodeAddress()
verbose := btcjson.Int(1)
var prevOut *int
if includePrevOut {
prevOut = btcjson.Int(1)
}
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SearchRawTransactionsVerboseAsync",
"(",
"address",
"btcutil",
".",
"Address",
",",
"skip",
",",
"count",
"int",
",",
"includePrevOut",
",",
"reverse",
"bool",
",",
"filterAddrs",
"*",
"[",
"]",
"string",
")",
"FutureSe... | // SearchRawTransactionsVerboseAsync returns an instance of a type that can be
// used to get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See SearchRawTransactionsVerbose for the blocking version and more details. | [
"SearchRawTransactionsVerboseAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L600-L612 |
163,388 | btcsuite/btcd | rpcclient/rawtransactions.go | Receive | func (r FutureDecodeScriptResult) Receive() (*btcjson.DecodeScriptResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a decodescript result object.
var decodeScriptResult btcjson.DecodeScriptResult
err = json.Unmarshal(res, &decodeScriptResult)
if err != nil ... | go | func (r FutureDecodeScriptResult) Receive() (*btcjson.DecodeScriptResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a decodescript result object.
var decodeScriptResult btcjson.DecodeScriptResult
err = json.Unmarshal(res, &decodeScriptResult)
if err != nil ... | [
"func",
"(",
"r",
"FutureDecodeScriptResult",
")",
"Receive",
"(",
")",
"(",
"*",
"btcjson",
".",
"DecodeScriptResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil... | // Receive waits for the response promised by the future and returns information
// about a script given its serialized bytes. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"information",
"about",
"a",
"script",
"given",
"its",
"serialized",
"bytes",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L634-L648 |
163,389 | btcsuite/btcd | rpcclient/rawtransactions.go | DecodeScriptAsync | func (c *Client) DecodeScriptAsync(serializedScript []byte) FutureDecodeScriptResult {
scriptHex := hex.EncodeToString(serializedScript)
cmd := btcjson.NewDecodeScriptCmd(scriptHex)
return c.sendCmd(cmd)
} | go | func (c *Client) DecodeScriptAsync(serializedScript []byte) FutureDecodeScriptResult {
scriptHex := hex.EncodeToString(serializedScript)
cmd := btcjson.NewDecodeScriptCmd(scriptHex)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DecodeScriptAsync",
"(",
"serializedScript",
"[",
"]",
"byte",
")",
"FutureDecodeScriptResult",
"{",
"scriptHex",
":=",
"hex",
".",
"EncodeToString",
"(",
"serializedScript",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewDe... | // DecodeScriptAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See DecodeScript for the blocking version and more details. | [
"DecodeScriptAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"in... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L655-L659 |
163,390 | btcsuite/btcd | rpcclient/rawtransactions.go | DecodeScript | func (c *Client) DecodeScript(serializedScript []byte) (*btcjson.DecodeScriptResult, error) {
return c.DecodeScriptAsync(serializedScript).Receive()
} | go | func (c *Client) DecodeScript(serializedScript []byte) (*btcjson.DecodeScriptResult, error) {
return c.DecodeScriptAsync(serializedScript).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DecodeScript",
"(",
"serializedScript",
"[",
"]",
"byte",
")",
"(",
"*",
"btcjson",
".",
"DecodeScriptResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"DecodeScriptAsync",
"(",
"serializedScript",
")",
".",
"Recei... | // DecodeScript returns information about a script given its serialized bytes. | [
"DecodeScript",
"returns",
"information",
"about",
"a",
"script",
"given",
"its",
"serialized",
"bytes",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/rawtransactions.go#L662-L664 |
163,391 | btcsuite/btcd | database/ffldb/dbcache.go | newLdbCacheIter | func newLdbCacheIter(snap *dbCacheSnapshot, slice *util.Range) *ldbCacheIter {
iter := snap.pendingKeys.Iterator(slice.Start, slice.Limit)
return &ldbCacheIter{Iterator: iter}
} | go | func newLdbCacheIter(snap *dbCacheSnapshot, slice *util.Range) *ldbCacheIter {
iter := snap.pendingKeys.Iterator(slice.Start, slice.Limit)
return &ldbCacheIter{Iterator: iter}
} | [
"func",
"newLdbCacheIter",
"(",
"snap",
"*",
"dbCacheSnapshot",
",",
"slice",
"*",
"util",
".",
"Range",
")",
"*",
"ldbCacheIter",
"{",
"iter",
":=",
"snap",
".",
"pendingKeys",
".",
"Iterator",
"(",
"slice",
".",
"Start",
",",
"slice",
".",
"Limit",
")"... | // newLdbCacheIter creates a new treap iterator for the given slice against the
// pending keys for the passed cache snapshot and returns it wrapped in an
// ldbCacheIter so it can be used as a leveldb iterator. | [
"newLdbCacheIter",
"creates",
"a",
"new",
"treap",
"iterator",
"for",
"the",
"given",
"slice",
"against",
"the",
"pending",
"keys",
"for",
"the",
"passed",
"cache",
"snapshot",
"and",
"returns",
"it",
"wrapped",
"in",
"an",
"ldbCacheIter",
"so",
"it",
"can",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L75-L78 |
163,392 | btcsuite/btcd | database/ffldb/dbcache.go | skipPendingUpdates | func (iter *dbCacheIterator) skipPendingUpdates(forwards bool) {
for iter.dbIter.Valid() {
var skip bool
key := iter.dbIter.Key()
if iter.cacheSnapshot.pendingRemove.Has(key) {
skip = true
} else if iter.cacheSnapshot.pendingKeys.Has(key) {
skip = true
}
if !skip {
break
}
if forwards {
it... | go | func (iter *dbCacheIterator) skipPendingUpdates(forwards bool) {
for iter.dbIter.Valid() {
var skip bool
key := iter.dbIter.Key()
if iter.cacheSnapshot.pendingRemove.Has(key) {
skip = true
} else if iter.cacheSnapshot.pendingKeys.Has(key) {
skip = true
}
if !skip {
break
}
if forwards {
it... | [
"func",
"(",
"iter",
"*",
"dbCacheIterator",
")",
"skipPendingUpdates",
"(",
"forwards",
"bool",
")",
"{",
"for",
"iter",
".",
"dbIter",
".",
"Valid",
"(",
")",
"{",
"var",
"skip",
"bool",
"\n",
"key",
":=",
"iter",
".",
"dbIter",
".",
"Key",
"(",
")... | // skipPendingUpdates skips any keys at the current database iterator position
// that are being updated by the cache. The forwards flag indicates the
// direction the iterator is moving. | [
"skipPendingUpdates",
"skips",
"any",
"keys",
"at",
"the",
"current",
"database",
"iterator",
"position",
"that",
"are",
"being",
"updated",
"by",
"the",
"cache",
".",
"The",
"forwards",
"flag",
"indicates",
"the",
"direction",
"the",
"iterator",
"is",
"moving",... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L96-L115 |
163,393 | btcsuite/btcd | database/ffldb/dbcache.go | chooseIterator | func (iter *dbCacheIterator) chooseIterator(forwards bool) bool {
// Skip any keys at the current database iterator position that are
// being updated by the cache.
iter.skipPendingUpdates(forwards)
// When both iterators are exhausted, the iterator is exhausted too.
if !iter.dbIter.Valid() && !iter.cacheIter.Val... | go | func (iter *dbCacheIterator) chooseIterator(forwards bool) bool {
// Skip any keys at the current database iterator position that are
// being updated by the cache.
iter.skipPendingUpdates(forwards)
// When both iterators are exhausted, the iterator is exhausted too.
if !iter.dbIter.Valid() && !iter.cacheIter.Val... | [
"func",
"(",
"iter",
"*",
"dbCacheIterator",
")",
"chooseIterator",
"(",
"forwards",
"bool",
")",
"bool",
"{",
"// Skip any keys at the current database iterator position that are",
"// being updated by the cache.",
"iter",
".",
"skipPendingUpdates",
"(",
"forwards",
")",
"... | // chooseIterator first skips any entries in the database iterator that are
// being updated by the cache and sets the current iterator to the appropriate
// iterator depending on their validity and the order they compare in while taking
// into account the direction flag. When the iterator is being moved forwards
// ... | [
"chooseIterator",
"first",
"skips",
"any",
"entries",
"in",
"the",
"database",
"iterator",
"that",
"are",
"being",
"updated",
"by",
"the",
"cache",
"and",
"sets",
"the",
"current",
"iterator",
"to",
"the",
"appropriate",
"iterator",
"depending",
"on",
"their",
... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L123-L155 |
163,394 | btcsuite/btcd | database/ffldb/dbcache.go | Key | func (iter *dbCacheIterator) Key() []byte {
// Nothing to return if iterator is exhausted.
if iter.currentIter == nil {
return nil
}
return iter.currentIter.Key()
} | go | func (iter *dbCacheIterator) Key() []byte {
// Nothing to return if iterator is exhausted.
if iter.currentIter == nil {
return nil
}
return iter.currentIter.Key()
} | [
"func",
"(",
"iter",
"*",
"dbCacheIterator",
")",
"Key",
"(",
")",
"[",
"]",
"byte",
"{",
"// Nothing to return if iterator is exhausted.",
"if",
"iter",
".",
"currentIter",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"iter",
".",
"curren... | // Key returns the current key the iterator is pointing to.
//
// This is part of the leveldb iterator.Iterator interface implementation. | [
"Key",
"returns",
"the",
"current",
"key",
"the",
"iterator",
"is",
"pointing",
"to",
".",
"This",
"is",
"part",
"of",
"the",
"leveldb",
"iterator",
".",
"Iterator",
"interface",
"implementation",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L236-L243 |
163,395 | btcsuite/btcd | database/ffldb/dbcache.go | Value | func (iter *dbCacheIterator) Value() []byte {
// Nothing to return if iterator is exhausted.
if iter.currentIter == nil {
return nil
}
return iter.currentIter.Value()
} | go | func (iter *dbCacheIterator) Value() []byte {
// Nothing to return if iterator is exhausted.
if iter.currentIter == nil {
return nil
}
return iter.currentIter.Value()
} | [
"func",
"(",
"iter",
"*",
"dbCacheIterator",
")",
"Value",
"(",
")",
"[",
"]",
"byte",
"{",
"// Nothing to return if iterator is exhausted.",
"if",
"iter",
".",
"currentIter",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"iter",
".",
"curr... | // Value returns the current value the iterator is pointing to.
//
// This is part of the leveldb iterator.Iterator interface implementation. | [
"Value",
"returns",
"the",
"current",
"value",
"the",
"iterator",
"is",
"pointing",
"to",
".",
"This",
"is",
"part",
"of",
"the",
"leveldb",
"iterator",
".",
"Iterator",
"interface",
"implementation",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L248-L255 |
163,396 | btcsuite/btcd | database/ffldb/dbcache.go | Release | func (snap *dbCacheSnapshot) Release() {
snap.dbSnapshot.Release()
snap.pendingKeys = nil
snap.pendingRemove = nil
} | go | func (snap *dbCacheSnapshot) Release() {
snap.dbSnapshot.Release()
snap.pendingKeys = nil
snap.pendingRemove = nil
} | [
"func",
"(",
"snap",
"*",
"dbCacheSnapshot",
")",
"Release",
"(",
")",
"{",
"snap",
".",
"dbSnapshot",
".",
"Release",
"(",
")",
"\n",
"snap",
".",
"pendingKeys",
"=",
"nil",
"\n",
"snap",
".",
"pendingRemove",
"=",
"nil",
"\n",
"}"
] | // Release releases the snapshot. | [
"Release",
"releases",
"the",
"snapshot",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L328-L332 |
163,397 | btcsuite/btcd | database/ffldb/dbcache.go | NewIterator | func (snap *dbCacheSnapshot) NewIterator(slice *util.Range) *dbCacheIterator {
return &dbCacheIterator{
dbIter: snap.dbSnapshot.NewIterator(slice, nil),
cacheIter: newLdbCacheIter(snap, slice),
cacheSnapshot: snap,
}
} | go | func (snap *dbCacheSnapshot) NewIterator(slice *util.Range) *dbCacheIterator {
return &dbCacheIterator{
dbIter: snap.dbSnapshot.NewIterator(slice, nil),
cacheIter: newLdbCacheIter(snap, slice),
cacheSnapshot: snap,
}
} | [
"func",
"(",
"snap",
"*",
"dbCacheSnapshot",
")",
"NewIterator",
"(",
"slice",
"*",
"util",
".",
"Range",
")",
"*",
"dbCacheIterator",
"{",
"return",
"&",
"dbCacheIterator",
"{",
"dbIter",
":",
"snap",
".",
"dbSnapshot",
".",
"NewIterator",
"(",
"slice",
"... | // NewIterator returns a new iterator for the snapshot. The newly returned
// iterator is not pointing to a valid item until a call to one of the methods
// to position it is made.
//
// The slice parameter allows the iterator to be limited to a range of keys.
// The start key is inclusive and the limit key is exclusi... | [
"NewIterator",
"returns",
"a",
"new",
"iterator",
"for",
"the",
"snapshot",
".",
"The",
"newly",
"returned",
"iterator",
"is",
"not",
"pointing",
"to",
"a",
"valid",
"item",
"until",
"a",
"call",
"to",
"one",
"of",
"the",
"methods",
"to",
"position",
"it",... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L341-L347 |
163,398 | btcsuite/btcd | database/ffldb/dbcache.go | Snapshot | func (c *dbCache) Snapshot() (*dbCacheSnapshot, error) {
dbSnapshot, err := c.ldb.GetSnapshot()
if err != nil {
str := "failed to open transaction"
return nil, convertErr(str, err)
}
// Since the cached keys to be added and removed use an immutable treap,
// a snapshot is simply obtaining the root of the tree... | go | func (c *dbCache) Snapshot() (*dbCacheSnapshot, error) {
dbSnapshot, err := c.ldb.GetSnapshot()
if err != nil {
str := "failed to open transaction"
return nil, convertErr(str, err)
}
// Since the cached keys to be added and removed use an immutable treap,
// a snapshot is simply obtaining the root of the tree... | [
"func",
"(",
"c",
"*",
"dbCache",
")",
"Snapshot",
"(",
")",
"(",
"*",
"dbCacheSnapshot",
",",
"error",
")",
"{",
"dbSnapshot",
",",
"err",
":=",
"c",
".",
"ldb",
".",
"GetSnapshot",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"str",
":=",
"\"... | // Snapshot returns a snapshot of the database cache and underlying database at
// a particular point in time.
//
// The snapshot must be released after use by calling Release. | [
"Snapshot",
"returns",
"a",
"snapshot",
"of",
"the",
"database",
"cache",
"and",
"underlying",
"database",
"at",
"a",
"particular",
"point",
"in",
"time",
".",
"The",
"snapshot",
"must",
"be",
"released",
"after",
"use",
"by",
"calling",
"Release",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L398-L416 |
163,399 | btcsuite/btcd | database/ffldb/dbcache.go | updateDB | func (c *dbCache) updateDB(fn func(ldbTx *leveldb.Transaction) error) error {
// Start a leveldb transaction.
ldbTx, err := c.ldb.OpenTransaction()
if err != nil {
return convertErr("failed to open ldb transaction", err)
}
if err := fn(ldbTx); err != nil {
ldbTx.Discard()
return err
}
// Commit the level... | go | func (c *dbCache) updateDB(fn func(ldbTx *leveldb.Transaction) error) error {
// Start a leveldb transaction.
ldbTx, err := c.ldb.OpenTransaction()
if err != nil {
return convertErr("failed to open ldb transaction", err)
}
if err := fn(ldbTx); err != nil {
ldbTx.Discard()
return err
}
// Commit the level... | [
"func",
"(",
"c",
"*",
"dbCache",
")",
"updateDB",
"(",
"fn",
"func",
"(",
"ldbTx",
"*",
"leveldb",
".",
"Transaction",
")",
"error",
")",
"error",
"{",
"// Start a leveldb transaction.",
"ldbTx",
",",
"err",
":=",
"c",
".",
"ldb",
".",
"OpenTransaction",
... | // updateDB invokes the passed function in the context of a managed leveldb
// transaction. Any errors returned from the user-supplied function will cause
// the transaction to be rolled back and are returned from this function.
// Otherwise, the transaction is committed when the user-supplied function
// returns a ni... | [
"updateDB",
"invokes",
"the",
"passed",
"function",
"in",
"the",
"context",
"of",
"a",
"managed",
"leveldb",
"transaction",
".",
"Any",
"errors",
"returned",
"from",
"the",
"user",
"-",
"supplied",
"function",
"will",
"cause",
"the",
"transaction",
"to",
"be",... | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/dbcache.go#L423-L440 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.