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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
btcsuite/btcwallet | wtxmgr/query.go | unminedTxDetails | func (s *Store) unminedTxDetails(ns walletdb.ReadBucket, txHash *chainhash.Hash, v []byte) (*TxDetails, error) {
details := TxDetails{
Block: BlockMeta{Block: Block{Height: -1}},
}
err := readRawTxRecord(txHash, v, &details.TxRecord)
if err != nil {
return nil, err
}
it := makeReadUnminedCreditIterator(ns, t... | go | func (s *Store) unminedTxDetails(ns walletdb.ReadBucket, txHash *chainhash.Hash, v []byte) (*TxDetails, error) {
details := TxDetails{
Block: BlockMeta{Block: Block{Height: -1}},
}
err := readRawTxRecord(txHash, v, &details.TxRecord)
if err != nil {
return nil, err
}
it := makeReadUnminedCreditIterator(ns, t... | [
"func",
"(",
"s",
"*",
"Store",
")",
"unminedTxDetails",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
",",
"txHash",
"*",
"chainhash",
".",
"Hash",
",",
"v",
"[",
"]",
"byte",
")",
"(",
"*",
"TxDetails",
",",
"error",
")",
"{",
"details",
":=",
"TxDetai... | // unminedTxDetails fetches the TxDetails for the unmined transaction with the
// hash txHash and the passed unmined record value. | [
"unminedTxDetails",
"fetches",
"the",
"TxDetails",
"for",
"the",
"unmined",
"transaction",
"with",
"the",
"hash",
"txHash",
"and",
"the",
"passed",
"unmined",
"record",
"value",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/query.go#L98-L162 | train |
btcsuite/btcwallet | wtxmgr/query.go | TxDetails | func (s *Store) TxDetails(ns walletdb.ReadBucket, txHash *chainhash.Hash) (*TxDetails, error) {
// First, check whether there exists an unmined transaction with this
// hash. Use it if found.
v := existsRawUnmined(ns, txHash[:])
if v != nil {
return s.unminedTxDetails(ns, txHash, v)
}
// Otherwise, if there e... | go | func (s *Store) TxDetails(ns walletdb.ReadBucket, txHash *chainhash.Hash) (*TxDetails, error) {
// First, check whether there exists an unmined transaction with this
// hash. Use it if found.
v := existsRawUnmined(ns, txHash[:])
if v != nil {
return s.unminedTxDetails(ns, txHash, v)
}
// Otherwise, if there e... | [
"func",
"(",
"s",
"*",
"Store",
")",
"TxDetails",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
",",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"TxDetails",
",",
"error",
")",
"{",
"// First, check whether there exists an unmined transaction with this",
... | // TxDetails looks up all recorded details regarding a transaction with some
// hash. In case of a hash collision, the most recent transaction with a
// matching hash is returned.
//
// Not finding a transaction with this hash is not an error. In this case,
// a nil TxDetails is returned. | [
"TxDetails",
"looks",
"up",
"all",
"recorded",
"details",
"regarding",
"a",
"transaction",
"with",
"some",
"hash",
".",
"In",
"case",
"of",
"a",
"hash",
"collision",
"the",
"most",
"recent",
"transaction",
"with",
"a",
"matching",
"hash",
"is",
"returned",
"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/query.go#L170-L186 | train |
btcsuite/btcwallet | wtxmgr/query.go | UniqueTxDetails | func (s *Store) UniqueTxDetails(ns walletdb.ReadBucket, txHash *chainhash.Hash,
block *Block) (*TxDetails, error) {
if block == nil {
v := existsRawUnmined(ns, txHash[:])
if v == nil {
return nil, nil
}
return s.unminedTxDetails(ns, txHash, v)
}
k, v := existsTxRecord(ns, txHash, block)
if v == nil {
... | go | func (s *Store) UniqueTxDetails(ns walletdb.ReadBucket, txHash *chainhash.Hash,
block *Block) (*TxDetails, error) {
if block == nil {
v := existsRawUnmined(ns, txHash[:])
if v == nil {
return nil, nil
}
return s.unminedTxDetails(ns, txHash, v)
}
k, v := existsTxRecord(ns, txHash, block)
if v == nil {
... | [
"func",
"(",
"s",
"*",
"Store",
")",
"UniqueTxDetails",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
",",
"txHash",
"*",
"chainhash",
".",
"Hash",
",",
"block",
"*",
"Block",
")",
"(",
"*",
"TxDetails",
",",
"error",
")",
"{",
"if",
"block",
"==",
"nil"... | // UniqueTxDetails looks up all recorded details for a transaction recorded
// mined in some particular block, or an unmined transaction if block is nil.
//
// Not finding a transaction with this hash from this block is not an error. In
// this case, a nil TxDetails is returned. | [
"UniqueTxDetails",
"looks",
"up",
"all",
"recorded",
"details",
"for",
"a",
"transaction",
"recorded",
"mined",
"in",
"some",
"particular",
"block",
"or",
"an",
"unmined",
"transaction",
"if",
"block",
"is",
"nil",
".",
"Not",
"finding",
"a",
"transaction",
"w... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/query.go#L193-L209 | train |
btcsuite/btcwallet | wtxmgr/query.go | PreviousPkScripts | func (s *Store) PreviousPkScripts(ns walletdb.ReadBucket, rec *TxRecord, block *Block) ([][]byte, error) {
var pkScripts [][]byte
if block == nil {
for _, input := range rec.MsgTx.TxIn {
prevOut := &input.PreviousOutPoint
// Input may spend a previous unmined output, a
// mined output (which would still ... | go | func (s *Store) PreviousPkScripts(ns walletdb.ReadBucket, rec *TxRecord, block *Block) ([][]byte, error) {
var pkScripts [][]byte
if block == nil {
for _, input := range rec.MsgTx.TxIn {
prevOut := &input.PreviousOutPoint
// Input may spend a previous unmined output, a
// mined output (which would still ... | [
"func",
"(",
"s",
"*",
"Store",
")",
"PreviousPkScripts",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
",",
"rec",
"*",
"TxRecord",
",",
"block",
"*",
"Block",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"pkScripts",
"[",
"]",... | // PreviousPkScripts returns a slice of previous output scripts for each credit
// output this transaction record debits from. | [
"PreviousPkScripts",
"returns",
"a",
"slice",
"of",
"previous",
"output",
"scripts",
"for",
"each",
"credit",
"output",
"this",
"transaction",
"record",
"debits",
"from",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/query.go#L391-L455 | train |
btcsuite/btcwallet | wallet/loader.go | NewLoader | func NewLoader(chainParams *chaincfg.Params, dbDirPath string,
recoveryWindow uint32) *Loader {
return &Loader{
chainParams: chainParams,
dbDirPath: dbDirPath,
recoveryWindow: recoveryWindow,
}
} | go | func NewLoader(chainParams *chaincfg.Params, dbDirPath string,
recoveryWindow uint32) *Loader {
return &Loader{
chainParams: chainParams,
dbDirPath: dbDirPath,
recoveryWindow: recoveryWindow,
}
} | [
"func",
"NewLoader",
"(",
"chainParams",
"*",
"chaincfg",
".",
"Params",
",",
"dbDirPath",
"string",
",",
"recoveryWindow",
"uint32",
")",
"*",
"Loader",
"{",
"return",
"&",
"Loader",
"{",
"chainParams",
":",
"chainParams",
",",
"dbDirPath",
":",
"dbDirPath",
... | // NewLoader constructs a Loader with an optional recovery window. If the
// recovery window is non-zero, the wallet will attempt to recovery addresses
// starting from the last SyncedTo height. | [
"NewLoader",
"constructs",
"a",
"Loader",
"with",
"an",
"optional",
"recovery",
"window",
".",
"If",
"the",
"recovery",
"window",
"is",
"non",
"-",
"zero",
"the",
"wallet",
"will",
"attempt",
"to",
"recovery",
"addresses",
"starting",
"from",
"the",
"last",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L58-L66 | train |
btcsuite/btcwallet | wallet/loader.go | onLoaded | func (l *Loader) onLoaded(w *Wallet, db walletdb.DB) {
for _, fn := range l.callbacks {
fn(w)
}
l.wallet = w
l.db = db
l.callbacks = nil // not needed anymore
} | go | func (l *Loader) onLoaded(w *Wallet, db walletdb.DB) {
for _, fn := range l.callbacks {
fn(w)
}
l.wallet = w
l.db = db
l.callbacks = nil // not needed anymore
} | [
"func",
"(",
"l",
"*",
"Loader",
")",
"onLoaded",
"(",
"w",
"*",
"Wallet",
",",
"db",
"walletdb",
".",
"DB",
")",
"{",
"for",
"_",
",",
"fn",
":=",
"range",
"l",
".",
"callbacks",
"{",
"fn",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"l",
".",
"wallet... | // onLoaded executes each added callback and prevents loader from loading any
// additional wallets. Requires mutex to be locked. | [
"onLoaded",
"executes",
"each",
"added",
"callback",
"and",
"prevents",
"loader",
"from",
"loading",
"any",
"additional",
"wallets",
".",
"Requires",
"mutex",
"to",
"be",
"locked",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L70-L78 | train |
btcsuite/btcwallet | wallet/loader.go | RunAfterLoad | func (l *Loader) RunAfterLoad(fn func(*Wallet)) {
l.mu.Lock()
if l.wallet != nil {
w := l.wallet
l.mu.Unlock()
fn(w)
} else {
l.callbacks = append(l.callbacks, fn)
l.mu.Unlock()
}
} | go | func (l *Loader) RunAfterLoad(fn func(*Wallet)) {
l.mu.Lock()
if l.wallet != nil {
w := l.wallet
l.mu.Unlock()
fn(w)
} else {
l.callbacks = append(l.callbacks, fn)
l.mu.Unlock()
}
} | [
"func",
"(",
"l",
"*",
"Loader",
")",
"RunAfterLoad",
"(",
"fn",
"func",
"(",
"*",
"Wallet",
")",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"l",
".",
"wallet",
"!=",
"nil",
"{",
"w",
":=",
"l",
".",
"wallet",
"\n",
"l",
"... | // RunAfterLoad adds a function to be executed when the loader creates or opens
// a wallet. Functions are executed in a single goroutine in the order they are
// added. | [
"RunAfterLoad",
"adds",
"a",
"function",
"to",
"be",
"executed",
"when",
"the",
"loader",
"creates",
"or",
"opens",
"a",
"wallet",
".",
"Functions",
"are",
"executed",
"in",
"a",
"single",
"goroutine",
"in",
"the",
"order",
"they",
"are",
"added",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L83-L93 | train |
btcsuite/btcwallet | wallet/loader.go | CreateNewWallet | func (l *Loader) CreateNewWallet(pubPassphrase, privPassphrase, seed []byte,
bday time.Time) (*Wallet, error) {
defer l.mu.Unlock()
l.mu.Lock()
if l.wallet != nil {
return nil, ErrLoaded
}
dbPath := filepath.Join(l.dbDirPath, walletDbName)
exists, err := fileExists(dbPath)
if err != nil {
return nil, err... | go | func (l *Loader) CreateNewWallet(pubPassphrase, privPassphrase, seed []byte,
bday time.Time) (*Wallet, error) {
defer l.mu.Unlock()
l.mu.Lock()
if l.wallet != nil {
return nil, ErrLoaded
}
dbPath := filepath.Join(l.dbDirPath, walletDbName)
exists, err := fileExists(dbPath)
if err != nil {
return nil, err... | [
"func",
"(",
"l",
"*",
"Loader",
")",
"CreateNewWallet",
"(",
"pubPassphrase",
",",
"privPassphrase",
",",
"seed",
"[",
"]",
"byte",
",",
"bday",
"time",
".",
"Time",
")",
"(",
"*",
"Wallet",
",",
"error",
")",
"{",
"defer",
"l",
".",
"mu",
".",
"U... | // CreateNewWallet creates a new wallet using the provided public and private
// passphrases. The seed is optional. If non-nil, addresses are derived from
// this seed. If nil, a secure random seed is generated. | [
"CreateNewWallet",
"creates",
"a",
"new",
"wallet",
"using",
"the",
"provided",
"public",
"and",
"private",
"passphrases",
".",
"The",
"seed",
"is",
"optional",
".",
"If",
"non",
"-",
"nil",
"addresses",
"are",
"derived",
"from",
"this",
"seed",
".",
"If",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L98-L144 | train |
btcsuite/btcwallet | wallet/loader.go | OpenExistingWallet | func (l *Loader) OpenExistingWallet(pubPassphrase []byte, canConsolePrompt bool) (*Wallet, error) {
defer l.mu.Unlock()
l.mu.Lock()
if l.wallet != nil {
return nil, ErrLoaded
}
// Ensure that the network directory exists.
if err := checkCreateDir(l.dbDirPath); err != nil {
return nil, err
}
// Open the d... | go | func (l *Loader) OpenExistingWallet(pubPassphrase []byte, canConsolePrompt bool) (*Wallet, error) {
defer l.mu.Unlock()
l.mu.Lock()
if l.wallet != nil {
return nil, ErrLoaded
}
// Ensure that the network directory exists.
if err := checkCreateDir(l.dbDirPath); err != nil {
return nil, err
}
// Open the d... | [
"func",
"(",
"l",
"*",
"Loader",
")",
"OpenExistingWallet",
"(",
"pubPassphrase",
"[",
"]",
"byte",
",",
"canConsolePrompt",
"bool",
")",
"(",
"*",
"Wallet",
",",
"error",
")",
"{",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
... | // OpenExistingWallet opens the wallet from the loader's wallet database path
// and the public passphrase. If the loader is being called by a context where
// standard input prompts may be used during wallet upgrades, setting
// canConsolePrompt will enables these prompts. | [
"OpenExistingWallet",
"opens",
"the",
"wallet",
"from",
"the",
"loader",
"s",
"wallet",
"database",
"path",
"and",
"the",
"public",
"passphrase",
".",
"If",
"the",
"loader",
"is",
"being",
"called",
"by",
"a",
"context",
"where",
"standard",
"input",
"prompts"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L156-L204 | train |
btcsuite/btcwallet | wallet/loader.go | LoadedWallet | func (l *Loader) LoadedWallet() (*Wallet, bool) {
l.mu.Lock()
w := l.wallet
l.mu.Unlock()
return w, w != nil
} | go | func (l *Loader) LoadedWallet() (*Wallet, bool) {
l.mu.Lock()
w := l.wallet
l.mu.Unlock()
return w, w != nil
} | [
"func",
"(",
"l",
"*",
"Loader",
")",
"LoadedWallet",
"(",
")",
"(",
"*",
"Wallet",
",",
"bool",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"w",
":=",
"l",
".",
"wallet",
"\n",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"ret... | // LoadedWallet returns the loaded wallet, if any, and a bool for whether the
// wallet has been loaded or not. If true, the wallet pointer should be safe to
// dereference. | [
"LoadedWallet",
"returns",
"the",
"loaded",
"wallet",
"if",
"any",
"and",
"a",
"bool",
"for",
"whether",
"the",
"wallet",
"has",
"been",
"loaded",
"or",
"not",
".",
"If",
"true",
"the",
"wallet",
"pointer",
"should",
"be",
"safe",
"to",
"dereference",
"."
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L216-L221 | train |
btcsuite/btcwallet | wallet/loader.go | UnloadWallet | func (l *Loader) UnloadWallet() error {
defer l.mu.Unlock()
l.mu.Lock()
if l.wallet == nil {
return ErrNotLoaded
}
l.wallet.Stop()
l.wallet.WaitForShutdown()
err := l.db.Close()
if err != nil {
return err
}
l.wallet = nil
l.db = nil
return nil
} | go | func (l *Loader) UnloadWallet() error {
defer l.mu.Unlock()
l.mu.Lock()
if l.wallet == nil {
return ErrNotLoaded
}
l.wallet.Stop()
l.wallet.WaitForShutdown()
err := l.db.Close()
if err != nil {
return err
}
l.wallet = nil
l.db = nil
return nil
} | [
"func",
"(",
"l",
"*",
"Loader",
")",
"UnloadWallet",
"(",
")",
"error",
"{",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n\n",
"if",
"l",
".",
"wallet",
"==",
"nil",
"{",
"return",
"ErrNotLo... | // UnloadWallet stops the loaded wallet, if any, and closes the wallet database.
// This returns ErrNotLoaded if the wallet has not been loaded with
// CreateNewWallet or LoadExistingWallet. The Loader may be reused if this
// function returns without error. | [
"UnloadWallet",
"stops",
"the",
"loaded",
"wallet",
"if",
"any",
"and",
"closes",
"the",
"wallet",
"database",
".",
"This",
"returns",
"ErrNotLoaded",
"if",
"the",
"wallet",
"has",
"not",
"been",
"loaded",
"with",
"CreateNewWallet",
"or",
"LoadExistingWallet",
"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/loader.go#L227-L245 | train |
btcsuite/btcwallet | wallet/rescan.go | SubmitRescan | func (w *Wallet) SubmitRescan(job *RescanJob) <-chan error {
errChan := make(chan error, 1)
job.err = errChan
w.rescanAddJob <- job
return errChan
} | go | func (w *Wallet) SubmitRescan(job *RescanJob) <-chan error {
errChan := make(chan error, 1)
job.err = errChan
w.rescanAddJob <- job
return errChan
} | [
"func",
"(",
"w",
"*",
"Wallet",
")",
"SubmitRescan",
"(",
"job",
"*",
"RescanJob",
")",
"<-",
"chan",
"error",
"{",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"job",
".",
"err",
"=",
"errChan",
"\n",
"w",
".",
"rescanAddJo... | // SubmitRescan submits a RescanJob to the RescanManager. A channel is
// returned with the final error of the rescan. The channel is buffered
// and does not need to be read to prevent a deadlock. | [
"SubmitRescan",
"submits",
"a",
"RescanJob",
"to",
"the",
"RescanManager",
".",
"A",
"channel",
"is",
"returned",
"with",
"the",
"final",
"error",
"of",
"the",
"rescan",
".",
"The",
"channel",
"is",
"buffered",
"and",
"does",
"not",
"need",
"to",
"be",
"re... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L56-L61 | train |
btcsuite/btcwallet | wallet/rescan.go | batch | func (job *RescanJob) batch() *rescanBatch {
return &rescanBatch{
initialSync: job.InitialSync,
addrs: job.Addrs,
outpoints: job.OutPoints,
bs: job.BlockStamp,
errChans: []chan error{job.err},
}
} | go | func (job *RescanJob) batch() *rescanBatch {
return &rescanBatch{
initialSync: job.InitialSync,
addrs: job.Addrs,
outpoints: job.OutPoints,
bs: job.BlockStamp,
errChans: []chan error{job.err},
}
} | [
"func",
"(",
"job",
"*",
"RescanJob",
")",
"batch",
"(",
")",
"*",
"rescanBatch",
"{",
"return",
"&",
"rescanBatch",
"{",
"initialSync",
":",
"job",
".",
"InitialSync",
",",
"addrs",
":",
"job",
".",
"Addrs",
",",
"outpoints",
":",
"job",
".",
"OutPoin... | // batch creates the rescanBatch for a single rescan job. | [
"batch",
"creates",
"the",
"rescanBatch",
"for",
"a",
"single",
"rescan",
"job",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L64-L72 | train |
btcsuite/btcwallet | wallet/rescan.go | merge | func (b *rescanBatch) merge(job *RescanJob) {
if job.InitialSync {
b.initialSync = true
}
b.addrs = append(b.addrs, job.Addrs...)
for op, addr := range job.OutPoints {
b.outpoints[op] = addr
}
if job.BlockStamp.Height < b.bs.Height {
b.bs = job.BlockStamp
}
b.errChans = append(b.errChans, job.err)
} | go | func (b *rescanBatch) merge(job *RescanJob) {
if job.InitialSync {
b.initialSync = true
}
b.addrs = append(b.addrs, job.Addrs...)
for op, addr := range job.OutPoints {
b.outpoints[op] = addr
}
if job.BlockStamp.Height < b.bs.Height {
b.bs = job.BlockStamp
}
b.errChans = append(b.errChans, job.err)
} | [
"func",
"(",
"b",
"*",
"rescanBatch",
")",
"merge",
"(",
"job",
"*",
"RescanJob",
")",
"{",
"if",
"job",
".",
"InitialSync",
"{",
"b",
".",
"initialSync",
"=",
"true",
"\n",
"}",
"\n",
"b",
".",
"addrs",
"=",
"append",
"(",
"b",
".",
"addrs",
","... | // merge merges the work from k into j, setting the starting height to
// the minimum of the two jobs. This method does not check for
// duplicate addresses or outpoints. | [
"merge",
"merges",
"the",
"work",
"from",
"k",
"into",
"j",
"setting",
"the",
"starting",
"height",
"to",
"the",
"minimum",
"of",
"the",
"two",
"jobs",
".",
"This",
"method",
"does",
"not",
"check",
"for",
"duplicate",
"addresses",
"or",
"outpoints",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L77-L91 | train |
btcsuite/btcwallet | wallet/rescan.go | rescanBatchHandler | func (w *Wallet) rescanBatchHandler() {
var curBatch, nextBatch *rescanBatch
quit := w.quitChan()
out:
for {
select {
case job := <-w.rescanAddJob:
if curBatch == nil {
// Set current batch as this job and send
// request.
curBatch = job.batch()
w.rescanBatch <- curBatch
} else {
// Cr... | go | func (w *Wallet) rescanBatchHandler() {
var curBatch, nextBatch *rescanBatch
quit := w.quitChan()
out:
for {
select {
case job := <-w.rescanAddJob:
if curBatch == nil {
// Set current batch as this job and send
// request.
curBatch = job.batch()
w.rescanBatch <- curBatch
} else {
// Cr... | [
"func",
"(",
"w",
"*",
"Wallet",
")",
"rescanBatchHandler",
"(",
")",
"{",
"var",
"curBatch",
",",
"nextBatch",
"*",
"rescanBatch",
"\n",
"quit",
":=",
"w",
".",
"quitChan",
"(",
")",
"\n\n",
"out",
":",
"for",
"{",
"select",
"{",
"case",
"job",
":="... | // rescanBatchHandler handles incoming rescan request, serializing rescan
// submissions, and possibly batching many waiting requests together so they
// can be handled by a single rescan after the current one completes. | [
"rescanBatchHandler",
"handles",
"incoming",
"rescan",
"request",
"serializing",
"rescan",
"submissions",
"and",
"possibly",
"batching",
"many",
"waiting",
"requests",
"together",
"so",
"they",
"can",
"be",
"handled",
"by",
"a",
"single",
"rescan",
"after",
"the",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L105-L171 | train |
btcsuite/btcwallet | wallet/rescan.go | rescanProgressHandler | func (w *Wallet) rescanProgressHandler() {
quit := w.quitChan()
out:
for {
// These can't be processed out of order since both chans are
// unbuffured and are sent from same context (the batch
// handler).
select {
case msg := <-w.rescanProgress:
n := msg.Notification
log.Infof("Rescanned through bloc... | go | func (w *Wallet) rescanProgressHandler() {
quit := w.quitChan()
out:
for {
// These can't be processed out of order since both chans are
// unbuffured and are sent from same context (the batch
// handler).
select {
case msg := <-w.rescanProgress:
n := msg.Notification
log.Infof("Rescanned through bloc... | [
"func",
"(",
"w",
"*",
"Wallet",
")",
"rescanProgressHandler",
"(",
")",
"{",
"quit",
":=",
"w",
".",
"quitChan",
"(",
")",
"\n",
"out",
":",
"for",
"{",
"// These can't be processed out of order since both chans are",
"// unbuffured and are sent from same context (the ... | // rescanProgressHandler handles notifications for partially and fully completed
// rescans by marking each rescanned address as partially or fully synced. | [
"rescanProgressHandler",
"handles",
"notifications",
"for",
"partially",
"and",
"fully",
"completed",
"rescans",
"by",
"marking",
"each",
"rescanned",
"address",
"as",
"partially",
"or",
"fully",
"synced",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L175-L203 | train |
btcsuite/btcwallet | wallet/rescan.go | rescanRPCHandler | func (w *Wallet) rescanRPCHandler() {
chainClient, err := w.requireChainClient()
if err != nil {
log.Errorf("rescanRPCHandler called without an RPC client")
w.wg.Done()
return
}
quit := w.quitChan()
out:
for {
select {
case batch := <-w.rescanBatch:
// Log the newly-started rescan.
numAddrs := le... | go | func (w *Wallet) rescanRPCHandler() {
chainClient, err := w.requireChainClient()
if err != nil {
log.Errorf("rescanRPCHandler called without an RPC client")
w.wg.Done()
return
}
quit := w.quitChan()
out:
for {
select {
case batch := <-w.rescanBatch:
// Log the newly-started rescan.
numAddrs := le... | [
"func",
"(",
"w",
"*",
"Wallet",
")",
"rescanRPCHandler",
"(",
")",
"{",
"chainClient",
",",
"err",
":=",
"w",
".",
"requireChainClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"w",
".",
"... | // rescanRPCHandler reads batch jobs sent by rescanBatchHandler and sends the
// RPC requests to perform a rescan. New jobs are not read until a rescan
// finishes. | [
"rescanRPCHandler",
"reads",
"batch",
"jobs",
"sent",
"by",
"rescanBatchHandler",
"and",
"sends",
"the",
"RPC",
"requests",
"to",
"perform",
"a",
"rescan",
".",
"New",
"jobs",
"are",
"not",
"read",
"until",
"a",
"rescan",
"finishes",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L208-L241 | train |
btcsuite/btcwallet | wallet/rescan.go | Rescan | func (w *Wallet) Rescan(addrs []btcutil.Address, unspent []wtxmgr.Credit) error {
return w.rescanWithTarget(addrs, unspent, nil)
} | go | func (w *Wallet) Rescan(addrs []btcutil.Address, unspent []wtxmgr.Credit) error {
return w.rescanWithTarget(addrs, unspent, nil)
} | [
"func",
"(",
"w",
"*",
"Wallet",
")",
"Rescan",
"(",
"addrs",
"[",
"]",
"btcutil",
".",
"Address",
",",
"unspent",
"[",
"]",
"wtxmgr",
".",
"Credit",
")",
"error",
"{",
"return",
"w",
".",
"rescanWithTarget",
"(",
"addrs",
",",
"unspent",
",",
"nil",... | // Rescan begins a rescan for all active addresses and unspent outputs of
// a wallet. This is intended to be used to sync a wallet back up to the
// current best block in the main chain, and is considered an initial sync
// rescan. | [
"Rescan",
"begins",
"a",
"rescan",
"for",
"all",
"active",
"addresses",
"and",
"unspent",
"outputs",
"of",
"a",
"wallet",
".",
"This",
"is",
"intended",
"to",
"be",
"used",
"to",
"sync",
"a",
"wallet",
"back",
"up",
"to",
"the",
"current",
"best",
"block... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L247-L249 | train |
btcsuite/btcwallet | wallet/rescan.go | rescanWithTarget | func (w *Wallet) rescanWithTarget(addrs []btcutil.Address,
unspent []wtxmgr.Credit, startStamp *waddrmgr.BlockStamp) error {
outpoints := make(map[wire.OutPoint]btcutil.Address, len(unspent))
for _, output := range unspent {
_, outputAddrs, _, err := txscript.ExtractPkScriptAddrs(
output.PkScript, w.chainParam... | go | func (w *Wallet) rescanWithTarget(addrs []btcutil.Address,
unspent []wtxmgr.Credit, startStamp *waddrmgr.BlockStamp) error {
outpoints := make(map[wire.OutPoint]btcutil.Address, len(unspent))
for _, output := range unspent {
_, outputAddrs, _, err := txscript.ExtractPkScriptAddrs(
output.PkScript, w.chainParam... | [
"func",
"(",
"w",
"*",
"Wallet",
")",
"rescanWithTarget",
"(",
"addrs",
"[",
"]",
"btcutil",
".",
"Address",
",",
"unspent",
"[",
"]",
"wtxmgr",
".",
"Credit",
",",
"startStamp",
"*",
"waddrmgr",
".",
"BlockStamp",
")",
"error",
"{",
"outpoints",
":=",
... | // rescanWithTarget performs a rescan starting at the optional startStamp. If
// none is provided, the rescan will begin from the manager's sync tip. | [
"rescanWithTarget",
"performs",
"a",
"rescan",
"starting",
"at",
"the",
"optional",
"startStamp",
".",
"If",
"none",
"is",
"provided",
"the",
"rescan",
"will",
"begin",
"from",
"the",
"manager",
"s",
"sync",
"tip",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/rescan.go#L253-L284 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | unimplemented | func unimplemented(interface{}, *wallet.Wallet) (interface{}, error) {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCUnimplemented,
Message: "Method unimplemented",
}
} | go | func unimplemented(interface{}, *wallet.Wallet) (interface{}, error) {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCUnimplemented,
Message: "Method unimplemented",
}
} | [
"func",
"unimplemented",
"(",
"interface",
"{",
"}",
",",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"nil",
",",
"&",
"btcjson",
".",
"RPCError",
"{",
"Code",
":",
"btcjson",
".",
"ErrRPCUnimplement... | // unimplemented handles an unimplemented RPC request with the
// appropiate error. | [
"unimplemented",
"handles",
"an",
"unimplemented",
"RPC",
"request",
"with",
"the",
"appropiate",
"error",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L143-L148 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | makeResponse | func makeResponse(id, result interface{}, err error) btcjson.Response {
idPtr := idPointer(id)
if err != nil {
return btcjson.Response{
ID: idPtr,
Error: jsonError(err),
}
}
resultBytes, err := json.Marshal(result)
if err != nil {
return btcjson.Response{
ID: idPtr,
Error: &btcjson.RPCError{
... | go | func makeResponse(id, result interface{}, err error) btcjson.Response {
idPtr := idPointer(id)
if err != nil {
return btcjson.Response{
ID: idPtr,
Error: jsonError(err),
}
}
resultBytes, err := json.Marshal(result)
if err != nil {
return btcjson.Response{
ID: idPtr,
Error: &btcjson.RPCError{
... | [
"func",
"makeResponse",
"(",
"id",
",",
"result",
"interface",
"{",
"}",
",",
"err",
"error",
")",
"btcjson",
".",
"Response",
"{",
"idPtr",
":=",
"idPointer",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"btcjson",
".",
"Response",
... | // makeResponse makes the JSON-RPC response struct for the result and error
// returned by a requestHandler. The returned response is not ready for
// marshaling and sending off to a client, but must be | [
"makeResponse",
"makes",
"the",
"JSON",
"-",
"RPC",
"response",
"struct",
"for",
"the",
"result",
"and",
"error",
"returned",
"by",
"a",
"requestHandler",
".",
"The",
"returned",
"response",
"is",
"not",
"ready",
"for",
"marshaling",
"and",
"sending",
"off",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L234-L256 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | jsonError | func jsonError(err error) *btcjson.RPCError {
if err == nil {
return nil
}
code := btcjson.ErrRPCWallet
switch e := err.(type) {
case btcjson.RPCError:
return &e
case *btcjson.RPCError:
return e
case DeserializationError:
code = btcjson.ErrRPCDeserialization
case InvalidParameterError:
code = btcjson... | go | func jsonError(err error) *btcjson.RPCError {
if err == nil {
return nil
}
code := btcjson.ErrRPCWallet
switch e := err.(type) {
case btcjson.RPCError:
return &e
case *btcjson.RPCError:
return e
case DeserializationError:
code = btcjson.ErrRPCDeserialization
case InvalidParameterError:
code = btcjson... | [
"func",
"jsonError",
"(",
"err",
"error",
")",
"*",
"btcjson",
".",
"RPCError",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"code",
":=",
"btcjson",
".",
"ErrRPCWallet",
"\n",
"switch",
"e",
":=",
"err",
".",
"(",
"type",
... | // jsonError creates a JSON-RPC error from the Go error. | [
"jsonError",
"creates",
"a",
"JSON",
"-",
"RPC",
"error",
"from",
"the",
"Go",
"error",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L259-L286 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | makeMultiSigScript | func makeMultiSigScript(w *wallet.Wallet, keys []string, nRequired int) ([]byte, error) {
keysesPrecious := make([]*btcutil.AddressPubKey, len(keys))
// The address list will made up either of addreseses (pubkey hash), for
// which we need to look up the keys in wallet, straight pubkeys, or a
// mixture of the two... | go | func makeMultiSigScript(w *wallet.Wallet, keys []string, nRequired int) ([]byte, error) {
keysesPrecious := make([]*btcutil.AddressPubKey, len(keys))
// The address list will made up either of addreseses (pubkey hash), for
// which we need to look up the keys in wallet, straight pubkeys, or a
// mixture of the two... | [
"func",
"makeMultiSigScript",
"(",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"keys",
"[",
"]",
"string",
",",
"nRequired",
"int",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"keysesPrecious",
":=",
"make",
"(",
"[",
"]",
"*",
"btcutil",
".",
... | // makeMultiSigScript is a helper function to combine common logic for
// AddMultiSig and CreateMultiSig. | [
"makeMultiSigScript",
"is",
"a",
"helper",
"function",
"to",
"combine",
"common",
"logic",
"for",
"AddMultiSig",
"and",
"CreateMultiSig",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L290-L321 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | addMultiSigAddress | func addMultiSigAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.AddMultisigAddressCmd)
// If an account is specified, ensure that is the imported account.
if cmd.Account != nil && *cmd.Account != waddrmgr.ImportedAddrAccountName {
return nil, &ErrNotImportedAccount
}
se... | go | func addMultiSigAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.AddMultisigAddressCmd)
// If an account is specified, ensure that is the imported account.
if cmd.Account != nil && *cmd.Account != waddrmgr.ImportedAddrAccountName {
return nil, &ErrNotImportedAccount
}
se... | [
"func",
"addMultiSigAddress",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"AddMultisigAddressCmd",
")",
"\n\n",... | // addMultiSigAddress handles an addmultisigaddress request by adding a
// multisig address to the given wallet. | [
"addMultiSigAddress",
"handles",
"an",
"addmultisigaddress",
"request",
"by",
"adding",
"a",
"multisig",
"address",
"to",
"the",
"given",
"wallet",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L325-L353 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | createMultiSig | func createMultiSig(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.CreateMultisigCmd)
script, err := makeMultiSigScript(w, cmd.Keys, cmd.NRequired)
if err != nil {
return nil, ParseError{err}
}
address, err := btcutil.NewAddressScriptHash(script, w.ChainParams())
if err != ni... | go | func createMultiSig(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.CreateMultisigCmd)
script, err := makeMultiSigScript(w, cmd.Keys, cmd.NRequired)
if err != nil {
return nil, ParseError{err}
}
address, err := btcutil.NewAddressScriptHash(script, w.ChainParams())
if err != ni... | [
"func",
"createMultiSig",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"CreateMultisigCmd",
")",
"\n\n",
"scri... | // createMultiSig handles an createmultisig request by returning a
// multisig address for the given inputs. | [
"createMultiSig",
"handles",
"an",
"createmultisig",
"request",
"by",
"returning",
"a",
"multisig",
"address",
"for",
"the",
"given",
"inputs",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L357-L375 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | dumpPrivKey | func dumpPrivKey(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.DumpPrivKeyCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
key, err := w.DumpWIFPrivateKey(addr)
if waddrmgr.IsError(err, waddrmgr.ErrLocked) {
// Address was fou... | go | func dumpPrivKey(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.DumpPrivKeyCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
key, err := w.DumpWIFPrivateKey(addr)
if waddrmgr.IsError(err, waddrmgr.ErrLocked) {
// Address was fou... | [
"func",
"dumpPrivKey",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"DumpPrivKeyCmd",
")",
"\n\n",
"addr",
"... | // dumpPrivKey handles a dumpprivkey request with the private key
// for a single address, or an appropiate error if the wallet
// is locked. | [
"dumpPrivKey",
"handles",
"a",
"dumpprivkey",
"request",
"with",
"the",
"private",
"key",
"for",
"a",
"single",
"address",
"or",
"an",
"appropiate",
"error",
"if",
"the",
"wallet",
"is",
"locked",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L380-L395 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getAddressesByAccount | func getAddressesByAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetAddressesByAccountCmd)
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, cmd.Account)
if err != nil {
return nil, err
}
addrs, err := w.AccountAddresses(account)
if err != nil {
return nil,... | go | func getAddressesByAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetAddressesByAccountCmd)
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, cmd.Account)
if err != nil {
return nil, err
}
addrs, err := w.AccountAddresses(account)
if err != nil {
return nil,... | [
"func",
"getAddressesByAccount",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"GetAddressesByAccountCmd",
")",
"... | // getAddressesByAccount handles a getaddressesbyaccount request by returning
// all addresses for an account, or an error if the requested account does
// not exist. | [
"getAddressesByAccount",
"handles",
"a",
"getaddressesbyaccount",
"request",
"by",
"returning",
"all",
"addresses",
"for",
"an",
"account",
"or",
"an",
"error",
"if",
"the",
"requested",
"account",
"does",
"not",
"exist",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L412-L430 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getBestBlock | func getBestBlock(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
blk := w.Manager.SyncedTo()
result := &btcjson.GetBestBlockResult{
Hash: blk.Hash.String(),
Height: blk.Height,
}
return result, nil
} | go | func getBestBlock(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
blk := w.Manager.SyncedTo()
result := &btcjson.GetBestBlockResult{
Hash: blk.Hash.String(),
Height: blk.Height,
}
return result, nil
} | [
"func",
"getBestBlock",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"blk",
":=",
"w",
".",
"Manager",
".",
"SyncedTo",
"(",
")",
"\n",
"result",
":=",
"&",
"... | // getBestBlock handles a getbestblock request by returning a JSON object
// with the height and hash of the most recently processed block. | [
"getBestBlock",
"handles",
"a",
"getbestblock",
"request",
"by",
"returning",
"a",
"JSON",
"object",
"with",
"the",
"height",
"and",
"hash",
"of",
"the",
"most",
"recently",
"processed",
"block",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L466-L473 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getBestBlockHash | func getBestBlockHash(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
blk := w.Manager.SyncedTo()
return blk.Hash.String(), nil
} | go | func getBestBlockHash(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
blk := w.Manager.SyncedTo()
return blk.Hash.String(), nil
} | [
"func",
"getBestBlockHash",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"blk",
":=",
"w",
".",
"Manager",
".",
"SyncedTo",
"(",
")",
"\n",
"return",
"blk",
"."... | // getBestBlockHash handles a getbestblockhash request by returning the hash
// of the most recently processed block. | [
"getBestBlockHash",
"handles",
"a",
"getbestblockhash",
"request",
"by",
"returning",
"the",
"hash",
"of",
"the",
"most",
"recently",
"processed",
"block",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L477-L480 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getBlockCount | func getBlockCount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
blk := w.Manager.SyncedTo()
return blk.Height, nil
} | go | func getBlockCount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
blk := w.Manager.SyncedTo()
return blk.Height, nil
} | [
"func",
"getBlockCount",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"blk",
":=",
"w",
".",
"Manager",
".",
"SyncedTo",
"(",
")",
"\n",
"return",
"blk",
".",
... | // getBlockCount handles a getblockcount request by returning the chain height
// of the most recently processed block. | [
"getBlockCount",
"handles",
"a",
"getblockcount",
"request",
"by",
"returning",
"the",
"chain",
"height",
"of",
"the",
"most",
"recently",
"processed",
"block",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L484-L487 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getInfo | func getInfo(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
// Call down to btcd for all of the information in this command known
// by them.
info, err := chainClient.GetInfo()
if err != nil {
return nil, err
}
bal, err := w.CalculateBalance(1)
if err != nil {
retur... | go | func getInfo(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
// Call down to btcd for all of the information in this command known
// by them.
info, err := chainClient.GetInfo()
if err != nil {
return nil, err
}
bal, err := w.CalculateBalance(1)
if err != nil {
retur... | [
"func",
"getInfo",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"chainClient",
"*",
"chain",
".",
"RPCClient",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// Call down to btcd for all of the information in this... | // getInfo handles a getinfo request by returning the a structure containing
// information about the current state of btcwallet.
// exist. | [
"getInfo",
"handles",
"a",
"getinfo",
"request",
"by",
"returning",
"the",
"a",
"structure",
"containing",
"information",
"about",
"the",
"current",
"state",
"of",
"btcwallet",
".",
"exist",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L492-L516 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getAccount | func getAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetAccountCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
// Fetch the associated account
account, err := w.AccountOfAddress(addr)
if err != nil {
return nil, &Er... | go | func getAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetAccountCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
// Fetch the associated account
account, err := w.AccountOfAddress(addr)
if err != nil {
return nil, &Er... | [
"func",
"getAccount",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"GetAccountCmd",
")",
"\n\n",
"addr",
","... | // getAccount handles a getaccount request by returning the account name
// associated with a single address. | [
"getAccount",
"handles",
"a",
"getaccount",
"request",
"by",
"returning",
"the",
"account",
"name",
"associated",
"with",
"a",
"single",
"address",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L540-L559 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getUnconfirmedBalance | func getUnconfirmedBalance(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetUnconfirmedBalanceCmd)
acctName := "default"
if cmd.Account != nil {
acctName = *cmd.Account
}
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, acctName)
if err != nil {
return nil, err
}
... | go | func getUnconfirmedBalance(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetUnconfirmedBalanceCmd)
acctName := "default"
if cmd.Account != nil {
acctName = *cmd.Account
}
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, acctName)
if err != nil {
return nil, err
}
... | [
"func",
"getUnconfirmedBalance",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"GetUnconfirmedBalanceCmd",
")",
"... | // getUnconfirmedBalance handles a getunconfirmedbalance extension request
// by returning the current unconfirmed balance of an account. | [
"getUnconfirmedBalance",
"handles",
"a",
"getunconfirmedbalance",
"extension",
"request",
"by",
"returning",
"the",
"current",
"unconfirmed",
"balance",
"of",
"an",
"account",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L584-L601 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | importPrivKey | func importPrivKey(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ImportPrivKeyCmd)
// Ensure that private keys are only imported to the correct account.
//
// Yes, Label is the account name.
if cmd.Label != nil && *cmd.Label != waddrmgr.ImportedAddrAccountName {
return nil, &E... | go | func importPrivKey(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ImportPrivKeyCmd)
// Ensure that private keys are only imported to the correct account.
//
// Yes, Label is the account name.
if cmd.Label != nil && *cmd.Label != waddrmgr.ImportedAddrAccountName {
return nil, &E... | [
"func",
"importPrivKey",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ImportPrivKeyCmd",
")",
"\n\n",
"// Ens... | // importPrivKey handles an importprivkey request by parsing
// a WIF-encoded private key and adding it to an account. | [
"importPrivKey",
"handles",
"an",
"importprivkey",
"request",
"by",
"parsing",
"a",
"WIF",
"-",
"encoded",
"private",
"key",
"and",
"adding",
"it",
"to",
"an",
"account",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L605-L640 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | createNewAccount | func createNewAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.CreateNewAccountCmd)
// The wildcard * is reserved by the rpc server with the special meaning
// of "all accounts", so disallow naming accounts to this string.
if cmd.Account == "*" {
return nil, &ErrReservedAc... | go | func createNewAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.CreateNewAccountCmd)
// The wildcard * is reserved by the rpc server with the special meaning
// of "all accounts", so disallow naming accounts to this string.
if cmd.Account == "*" {
return nil, &ErrReservedAc... | [
"func",
"createNewAccount",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"CreateNewAccountCmd",
")",
"\n\n",
"... | // createNewAccount handles a createnewaccount request by creating and
// returning a new account. If the last account has no transaction history
// as per BIP 0044 a new account cannot be created so an error will be returned. | [
"createNewAccount",
"handles",
"a",
"createnewaccount",
"request",
"by",
"creating",
"and",
"returning",
"a",
"new",
"account",
".",
"If",
"the",
"last",
"account",
"has",
"no",
"transaction",
"history",
"as",
"per",
"BIP",
"0044",
"a",
"new",
"account",
"cann... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L651-L669 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | renameAccount | func renameAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.RenameAccountCmd)
// The wildcard * is reserved by the rpc server with the special meaning
// of "all accounts", so disallow naming accounts to this string.
if cmd.NewAccount == "*" {
return nil, &ErrReservedAccou... | go | func renameAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.RenameAccountCmd)
// The wildcard * is reserved by the rpc server with the special meaning
// of "all accounts", so disallow naming accounts to this string.
if cmd.NewAccount == "*" {
return nil, &ErrReservedAccou... | [
"func",
"renameAccount",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"RenameAccountCmd",
")",
"\n\n",
"// The... | // renameAccount handles a renameaccount request by renaming an account.
// If the account does not exist an appropiate error will be returned. | [
"renameAccount",
"handles",
"a",
"renameaccount",
"request",
"by",
"renaming",
"an",
"account",
".",
"If",
"the",
"account",
"does",
"not",
"exist",
"an",
"appropiate",
"error",
"will",
"be",
"returned",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L673-L688 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getReceivedByAccount | func getReceivedByAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetReceivedByAccountCmd)
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, cmd.Account)
if err != nil {
return nil, err
}
// TODO: This is more inefficient that it could be, but the entire
// alg... | go | func getReceivedByAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetReceivedByAccountCmd)
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, cmd.Account)
if err != nil {
return nil, err
}
// TODO: This is more inefficient that it could be, but the entire
// alg... | [
"func",
"getReceivedByAccount",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"GetReceivedByAccountCmd",
")",
"\n... | // getReceivedByAccount handles a getreceivedbyaccount request by returning
// the total amount received by addresses of an account. | [
"getReceivedByAccount",
"handles",
"a",
"getreceivedbyaccount",
"request",
"by",
"returning",
"the",
"total",
"amount",
"received",
"by",
"addresses",
"of",
"an",
"account",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L742-L764 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | getReceivedByAddress | func getReceivedByAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetReceivedByAddressCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
total, err := w.TotalReceivedForAddr(addr, int32(*cmd.MinConf))
if err != nil {
return... | go | func getReceivedByAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.GetReceivedByAddressCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
total, err := w.TotalReceivedForAddr(addr, int32(*cmd.MinConf))
if err != nil {
return... | [
"func",
"getReceivedByAddress",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"GetReceivedByAddressCmd",
")",
"\n... | // getReceivedByAddress handles a getreceivedbyaddress request by returning
// the total amount received by a single address. | [
"getReceivedByAddress",
"handles",
"a",
"getreceivedbyaddress",
"request",
"by",
"returning",
"the",
"total",
"amount",
"received",
"by",
"a",
"single",
"address",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L768-L781 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | helpWithChainRPC | func helpWithChainRPC(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
return help(icmd, w, chainClient)
} | go | func helpWithChainRPC(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
return help(icmd, w, chainClient)
} | [
"func",
"helpWithChainRPC",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"chainClient",
"*",
"chain",
".",
"RPCClient",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"help",
"(",
"icmd",
",",
"... | // helpWithChainRPC handles the help request when the RPC server has been
// associated with a consensus RPC client. The additional RPC client is used to
// include help messages for methods implemented by the consensus server via RPC
// passthrough. | [
"helpWithChainRPC",
"handles",
"the",
"help",
"request",
"when",
"the",
"RPC",
"server",
"has",
"been",
"associated",
"with",
"a",
"consensus",
"RPC",
"client",
".",
"The",
"additional",
"RPC",
"client",
"is",
"used",
"to",
"include",
"help",
"messages",
"for"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L946-L948 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | helpNoChainRPC | func helpNoChainRPC(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
return help(icmd, w, nil)
} | go | func helpNoChainRPC(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
return help(icmd, w, nil)
} | [
"func",
"helpNoChainRPC",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"help",
"(",
"icmd",
",",
"w",
",",
"nil",
")",
"\n",
"}"
] | // helpNoChainRPC handles the help request when the RPC server has not been
// associated with a consensus RPC client. No help messages are included for
// passthrough requests. | [
"helpNoChainRPC",
"handles",
"the",
"help",
"request",
"when",
"the",
"RPC",
"server",
"has",
"not",
"been",
"associated",
"with",
"a",
"consensus",
"RPC",
"client",
".",
"No",
"help",
"messages",
"are",
"included",
"for",
"passthrough",
"requests",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L953-L955 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | help | func help(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
cmd := icmd.(*btcjson.HelpCmd)
// btcd returns different help messages depending on the kind of
// connection the client is using. Only methods availble to HTTP POST
// clients are available to be used by wallet cli... | go | func help(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
cmd := icmd.(*btcjson.HelpCmd)
// btcd returns different help messages depending on the kind of
// connection the client is using. Only methods availble to HTTP POST
// clients are available to be used by wallet cli... | [
"func",
"help",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"chainClient",
"*",
"chain",
".",
"RPCClient",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
... | // help handles the help request by returning one line usage of all available
// methods, or full help for a specific method. The chainClient is optional,
// and this is simply a helper function for the HelpNoChainRPC and
// HelpWithChainRPC handlers. | [
"help",
"handles",
"the",
"help",
"request",
"by",
"returning",
"one",
"line",
"usage",
"of",
"all",
"available",
"methods",
"or",
"full",
"help",
"for",
"a",
"specific",
"method",
".",
"The",
"chainClient",
"is",
"optional",
"and",
"this",
"is",
"simply",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L961-L1039 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | listAccounts | func listAccounts(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListAccountsCmd)
accountBalances := map[string]float64{}
results, err := w.AccountBalances(waddrmgr.KeyScopeBIP0044, int32(*cmd.MinConf))
if err != nil {
return nil, err
}
for _, result := range results {
accou... | go | func listAccounts(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListAccountsCmd)
accountBalances := map[string]float64{}
results, err := w.AccountBalances(waddrmgr.KeyScopeBIP0044, int32(*cmd.MinConf))
if err != nil {
return nil, err
}
for _, result := range results {
accou... | [
"func",
"listAccounts",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ListAccountsCmd",
")",
"\n\n",
"accountB... | // listAccounts handles a listaccounts request by returning a map of account
// names to their balances. | [
"listAccounts",
"handles",
"a",
"listaccounts",
"request",
"by",
"returning",
"a",
"map",
"of",
"account",
"names",
"to",
"their",
"balances",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1043-L1056 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | listSinceBlock | func listSinceBlock(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
cmd := icmd.(*btcjson.ListSinceBlockCmd)
syncBlock := w.Manager.SyncedTo()
targetConf := int64(*cmd.TargetConfirmations)
// For the result we need the block hash for the last block counted
// in the block... | go | func listSinceBlock(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
cmd := icmd.(*btcjson.ListSinceBlockCmd)
syncBlock := w.Manager.SyncedTo()
targetConf := int64(*cmd.TargetConfirmations)
// For the result we need the block hash for the last block counted
// in the block... | [
"func",
"listSinceBlock",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"chainClient",
"*",
"chain",
".",
"RPCClient",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"... | // listSinceBlock handles a listsinceblock request by returning an array of maps
// with details of sent and received wallet transactions since the given block. | [
"listSinceBlock",
"handles",
"a",
"listsinceblock",
"request",
"by",
"returning",
"an",
"array",
"of",
"maps",
"with",
"details",
"of",
"sent",
"and",
"received",
"wallet",
"transactions",
"since",
"the",
"given",
"block",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1196-L1236 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | listTransactions | func listTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListTransactionsCmd)
// TODO: ListTransactions does not currently understand the difference
// between transactions pertaining to one account from another. This
// will be resolved when wtxmgr is combined with t... | go | func listTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListTransactionsCmd)
// TODO: ListTransactions does not currently understand the difference
// between transactions pertaining to one account from another. This
// will be resolved when wtxmgr is combined with t... | [
"func",
"listTransactions",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ListTransactionsCmd",
")",
"\n\n",
"... | // listTransactions handles a listtransactions request by returning an
// array of maps with details of sent and recevied wallet transactions. | [
"listTransactions",
"handles",
"a",
"listtransactions",
"request",
"by",
"returning",
"an",
"array",
"of",
"maps",
"with",
"details",
"of",
"sent",
"and",
"recevied",
"wallet",
"transactions",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1240-L1258 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | listAddressTransactions | func listAddressTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListAddressTransactionsCmd)
if cmd.Account != nil && *cmd.Account != "*" {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInvalidParameter,
Message: "Listing transactions for addresses may onl... | go | func listAddressTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListAddressTransactionsCmd)
if cmd.Account != nil && *cmd.Account != "*" {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInvalidParameter,
Message: "Listing transactions for addresses may onl... | [
"func",
"listAddressTransactions",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ListAddressTransactionsCmd",
")",... | // listAddressTransactions handles a listaddresstransactions request by
// returning an array of maps with details of spent and received wallet
// transactions. The form of the reply is identical to listtransactions,
// but the array elements are limited to transaction details which are
// about the addresess included... | [
"listAddressTransactions",
"handles",
"a",
"listaddresstransactions",
"request",
"by",
"returning",
"an",
"array",
"of",
"maps",
"with",
"details",
"of",
"spent",
"and",
"received",
"wallet",
"transactions",
".",
"The",
"form",
"of",
"the",
"reply",
"is",
"identic... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1265-L1286 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | listAllTransactions | func listAllTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListAllTransactionsCmd)
if cmd.Account != nil && *cmd.Account != "*" {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInvalidParameter,
Message: "Listing all transactions may only be done for all ... | go | func listAllTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListAllTransactionsCmd)
if cmd.Account != nil && *cmd.Account != "*" {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInvalidParameter,
Message: "Listing all transactions may only be done for all ... | [
"func",
"listAllTransactions",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ListAllTransactionsCmd",
")",
"\n\n... | // listAllTransactions handles a listalltransactions request by returning
// a map with details of sent and recevied wallet transactions. This is
// similar to ListTransactions, except it takes only a single optional
// argument for the account name and replies with all transactions. | [
"listAllTransactions",
"handles",
"a",
"listalltransactions",
"request",
"by",
"returning",
"a",
"map",
"with",
"details",
"of",
"sent",
"and",
"recevied",
"wallet",
"transactions",
".",
"This",
"is",
"similar",
"to",
"ListTransactions",
"except",
"it",
"takes",
"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1292-L1303 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | listUnspent | func listUnspent(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListUnspentCmd)
var addresses map[string]struct{}
if cmd.Addresses != nil {
addresses = make(map[string]struct{})
// confirm that all of them are good:
for _, as := range *cmd.Addresses {
a, err := decodeAddre... | go | func listUnspent(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ListUnspentCmd)
var addresses map[string]struct{}
if cmd.Addresses != nil {
addresses = make(map[string]struct{})
// confirm that all of them are good:
for _, as := range *cmd.Addresses {
a, err := decodeAddre... | [
"func",
"listUnspent",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ListUnspentCmd",
")",
"\n\n",
"var",
"a... | // listUnspent handles the listunspent command. | [
"listUnspent",
"handles",
"the",
"listunspent",
"command",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1306-L1323 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | lockUnspent | func lockUnspent(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.LockUnspentCmd)
switch {
case cmd.Unlock && len(cmd.Transactions) == 0:
w.ResetLockedOutpoints()
default:
for _, input := range cmd.Transactions {
txHash, err := chainhash.NewHashFromStr(input.Txid)
if err !... | go | func lockUnspent(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.LockUnspentCmd)
switch {
case cmd.Unlock && len(cmd.Transactions) == 0:
w.ResetLockedOutpoints()
default:
for _, input := range cmd.Transactions {
txHash, err := chainhash.NewHashFromStr(input.Txid)
if err !... | [
"func",
"lockUnspent",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"LockUnspentCmd",
")",
"\n\n",
"switch",
... | // lockUnspent handles the lockunspent command. | [
"lockUnspent",
"handles",
"the",
"lockunspent",
"command",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1326-L1347 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | makeOutputs | func makeOutputs(pairs map[string]btcutil.Amount, chainParams *chaincfg.Params) ([]*wire.TxOut, error) {
outputs := make([]*wire.TxOut, 0, len(pairs))
for addrStr, amt := range pairs {
addr, err := btcutil.DecodeAddress(addrStr, chainParams)
if err != nil {
return nil, fmt.Errorf("cannot decode address: %s", e... | go | func makeOutputs(pairs map[string]btcutil.Amount, chainParams *chaincfg.Params) ([]*wire.TxOut, error) {
outputs := make([]*wire.TxOut, 0, len(pairs))
for addrStr, amt := range pairs {
addr, err := btcutil.DecodeAddress(addrStr, chainParams)
if err != nil {
return nil, fmt.Errorf("cannot decode address: %s", e... | [
"func",
"makeOutputs",
"(",
"pairs",
"map",
"[",
"string",
"]",
"btcutil",
".",
"Amount",
",",
"chainParams",
"*",
"chaincfg",
".",
"Params",
")",
"(",
"[",
"]",
"*",
"wire",
".",
"TxOut",
",",
"error",
")",
"{",
"outputs",
":=",
"make",
"(",
"[",
... | // makeOutputs creates a slice of transaction outputs from a pair of address
// strings to amounts. This is used to create the outputs to include in newly
// created transactions from a JSON object describing the output destinations
// and amounts. | [
"makeOutputs",
"creates",
"a",
"slice",
"of",
"transaction",
"outputs",
"from",
"a",
"pair",
"of",
"address",
"strings",
"to",
"amounts",
".",
"This",
"is",
"used",
"to",
"create",
"the",
"outputs",
"to",
"include",
"in",
"newly",
"created",
"transactions",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1353-L1369 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | sendPairs | func sendPairs(w *wallet.Wallet, amounts map[string]btcutil.Amount,
account uint32, minconf int32, feeSatPerKb btcutil.Amount) (string, error) {
outputs, err := makeOutputs(amounts, w.ChainParams())
if err != nil {
return "", err
}
tx, err := w.SendOutputs(outputs, account, minconf, feeSatPerKb)
if err != nil ... | go | func sendPairs(w *wallet.Wallet, amounts map[string]btcutil.Amount,
account uint32, minconf int32, feeSatPerKb btcutil.Amount) (string, error) {
outputs, err := makeOutputs(amounts, w.ChainParams())
if err != nil {
return "", err
}
tx, err := w.SendOutputs(outputs, account, minconf, feeSatPerKb)
if err != nil ... | [
"func",
"sendPairs",
"(",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"amounts",
"map",
"[",
"string",
"]",
"btcutil",
".",
"Amount",
",",
"account",
"uint32",
",",
"minconf",
"int32",
",",
"feeSatPerKb",
"btcutil",
".",
"Amount",
")",
"(",
"string",
",",
... | // sendPairs creates and sends payment transactions.
// It returns the transaction hash in string format upon success
// All errors are returned in btcjson.RPCError format | [
"sendPairs",
"creates",
"and",
"sends",
"payment",
"transactions",
".",
"It",
"returns",
"the",
"transaction",
"hash",
"in",
"string",
"format",
"upon",
"success",
"All",
"errors",
"are",
"returned",
"in",
"btcjson",
".",
"RPCError",
"format"
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1374-L1403 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | sendFrom | func sendFrom(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
cmd := icmd.(*btcjson.SendFromCmd)
// Transaction comments are not yet supported. Error instead of
// pretending to save them.
if !isNilOrEmpty(cmd.Comment) || !isNilOrEmpty(cmd.CommentTo) {
return nil, &btcjs... | go | func sendFrom(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error) {
cmd := icmd.(*btcjson.SendFromCmd)
// Transaction comments are not yet supported. Error instead of
// pretending to save them.
if !isNilOrEmpty(cmd.Comment) || !isNilOrEmpty(cmd.CommentTo) {
return nil, &btcjs... | [
"func",
"sendFrom",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
",",
"chainClient",
"*",
"chain",
".",
"RPCClient",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjso... | // sendFrom handles a sendfrom RPC request by creating a new transaction
// spending unspent transaction outputs for a wallet to another payment
// address. Leftover inputs not sent to the payment address or a fee for
// the miner are sent back to a new address in the wallet. Upon success,
// the TxID for the created... | [
"sendFrom",
"handles",
"a",
"sendfrom",
"RPC",
"request",
"by",
"creating",
"a",
"new",
"transaction",
"spending",
"unspent",
"transaction",
"outputs",
"for",
"a",
"wallet",
"to",
"another",
"payment",
"address",
".",
"Leftover",
"inputs",
"not",
"sent",
"to",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1414-L1452 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | sendMany | func sendMany(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SendManyCmd)
// Transaction comments are not yet supported. Error instead of
// pretending to save them.
if !isNilOrEmpty(cmd.Comment) {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCUnimplemented,
Messa... | go | func sendMany(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SendManyCmd)
// Transaction comments are not yet supported. Error instead of
// pretending to save them.
if !isNilOrEmpty(cmd.Comment) {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCUnimplemented,
Messa... | [
"func",
"sendMany",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"SendManyCmd",
")",
"\n\n",
"// Transaction c... | // sendMany handles a sendmany RPC request by creating a new transaction
// spending unspent transaction outputs for a wallet to any number of
// payment addresses. Leftover inputs not sent to the payment address
// or a fee for the miner are sent back to a new address in the wallet.
// Upon success, the TxID for the ... | [
"sendMany",
"handles",
"a",
"sendmany",
"RPC",
"request",
"by",
"creating",
"a",
"new",
"transaction",
"spending",
"unspent",
"transaction",
"outputs",
"for",
"a",
"wallet",
"to",
"any",
"number",
"of",
"payment",
"addresses",
".",
"Leftover",
"inputs",
"not",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1459-L1493 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | sendToAddress | func sendToAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SendToAddressCmd)
// Transaction comments are not yet supported. Error instead of
// pretending to save them.
if !isNilOrEmpty(cmd.Comment) || !isNilOrEmpty(cmd.CommentTo) {
return nil, &btcjson.RPCError{
Code... | go | func sendToAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SendToAddressCmd)
// Transaction comments are not yet supported. Error instead of
// pretending to save them.
if !isNilOrEmpty(cmd.Comment) || !isNilOrEmpty(cmd.CommentTo) {
return nil, &btcjson.RPCError{
Code... | [
"func",
"sendToAddress",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"SendToAddressCmd",
")",
"\n\n",
"// Tra... | // sendToAddress handles a sendtoaddress RPC request by creating a new
// transaction spending unspent transaction outputs for a wallet to another
// payment address. Leftover inputs not sent to the payment address or a fee
// for the miner are sent back to a new address in the wallet. Upon success,
// the TxID for t... | [
"sendToAddress",
"handles",
"a",
"sendtoaddress",
"RPC",
"request",
"by",
"creating",
"a",
"new",
"transaction",
"spending",
"unspent",
"transaction",
"outputs",
"for",
"a",
"wallet",
"to",
"another",
"payment",
"address",
".",
"Leftover",
"inputs",
"not",
"sent",... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1500-L1530 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | setTxFee | func setTxFee(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SetTxFeeCmd)
// Check that amount is not negative.
if cmd.Amount < 0 {
return nil, ErrNeedPositiveAmount
}
// A boolean true result is returned upon success.
return true, nil
} | go | func setTxFee(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SetTxFeeCmd)
// Check that amount is not negative.
if cmd.Amount < 0 {
return nil, ErrNeedPositiveAmount
}
// A boolean true result is returned upon success.
return true, nil
} | [
"func",
"setTxFee",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"SetTxFeeCmd",
")",
"\n\n",
"// Check that am... | // setTxFee sets the transaction fee per kilobyte added to transactions. | [
"setTxFee",
"sets",
"the",
"transaction",
"fee",
"per",
"kilobyte",
"added",
"to",
"transactions",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1533-L1543 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | signMessage | func signMessage(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SignMessageCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
privKey, err := w.PrivKeyForAddress(addr)
if err != nil {
return nil, err
}
var buf bytes.Buffer
wi... | go | func signMessage(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.SignMessageCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
privKey, err := w.PrivKeyForAddress(addr)
if err != nil {
return nil, err
}
var buf bytes.Buffer
wi... | [
"func",
"signMessage",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"SignMessageCmd",
")",
"\n\n",
"addr",
"... | // signMessage signs the given message with the private key for the given
// address | [
"signMessage",
"signs",
"the",
"given",
"message",
"with",
"the",
"private",
"key",
"for",
"the",
"given",
"address"
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1547-L1571 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | validateAddress | func validateAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ValidateAddressCmd)
result := btcjson.ValidateAddressWalletResult{}
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
// Use result zero value (IsValid=false).
return result, nil
}
//... | go | func validateAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.ValidateAddressCmd)
result := btcjson.ValidateAddressWalletResult{}
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
// Use result zero value (IsValid=false).
return result, nil
}
//... | [
"func",
"validateAddress",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"ValidateAddressCmd",
")",
"\n\n",
"re... | // validateAddress handles the validateaddress command. | [
"validateAddress",
"handles",
"the",
"validateaddress",
"command",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1748-L1825 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | verifyMessage | func verifyMessage(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.VerifyMessageCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
// decode base64 signature
sig, err := base64.StdEncoding.DecodeString(cmd.Signature)
if err != nil ... | go | func verifyMessage(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.VerifyMessageCmd)
addr, err := decodeAddress(cmd.Address, w.ChainParams())
if err != nil {
return nil, err
}
// decode base64 signature
sig, err := base64.StdEncoding.DecodeString(cmd.Signature)
if err != nil ... | [
"func",
"verifyMessage",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"VerifyMessageCmd",
")",
"\n\n",
"addr",... | // verifyMessage handles the verifymessage command by verifying the provided
// compact signature for the given address and message. | [
"verifyMessage",
"handles",
"the",
"verifymessage",
"command",
"by",
"verifying",
"the",
"provided",
"compact",
"signature",
"for",
"the",
"given",
"address",
"and",
"message",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1829-L1870 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | walletPassphrase | func walletPassphrase(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.WalletPassphraseCmd)
timeout := time.Second * time.Duration(cmd.Timeout)
var unlockAfter <-chan time.Time
if timeout != 0 {
unlockAfter = time.After(timeout)
}
err := w.Unlock([]byte(cmd.Passphrase), unlockAf... | go | func walletPassphrase(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.WalletPassphraseCmd)
timeout := time.Second * time.Duration(cmd.Timeout)
var unlockAfter <-chan time.Time
if timeout != 0 {
unlockAfter = time.After(timeout)
}
err := w.Unlock([]byte(cmd.Passphrase), unlockAf... | [
"func",
"walletPassphrase",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"WalletPassphraseCmd",
")",
"\n\n",
"... | // walletPassphrase responds to the walletpassphrase request by unlocking
// the wallet. The decryption key is saved in the wallet until timeout
// seconds expires, after which the wallet is locked. | [
"walletPassphrase",
"responds",
"to",
"the",
"walletpassphrase",
"request",
"by",
"unlocking",
"the",
"wallet",
".",
"The",
"decryption",
"key",
"is",
"saved",
"in",
"the",
"wallet",
"until",
"timeout",
"seconds",
"expires",
"after",
"which",
"the",
"wallet",
"i... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1890-L1900 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | walletPassphraseChange | func walletPassphraseChange(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.WalletPassphraseChangeCmd)
err := w.ChangePrivatePassphrase([]byte(cmd.OldPassphrase),
[]byte(cmd.NewPassphrase))
if waddrmgr.IsError(err, waddrmgr.ErrWrongPassphrase) {
return nil, &btcjson.RPCError{
... | go | func walletPassphraseChange(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
cmd := icmd.(*btcjson.WalletPassphraseChangeCmd)
err := w.ChangePrivatePassphrase([]byte(cmd.OldPassphrase),
[]byte(cmd.NewPassphrase))
if waddrmgr.IsError(err, waddrmgr.ErrWrongPassphrase) {
return nil, &btcjson.RPCError{
... | [
"func",
"walletPassphraseChange",
"(",
"icmd",
"interface",
"{",
"}",
",",
"w",
"*",
"wallet",
".",
"Wallet",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cmd",
":=",
"icmd",
".",
"(",
"*",
"btcjson",
".",
"WalletPassphraseChangeCmd",
")",
... | // walletPassphraseChange responds to the walletpassphrasechange request
// by unlocking all accounts with the provided old passphrase, and
// re-encrypting each private key with an AES key derived from the new
// passphrase.
//
// If the old passphrase is correct and the passphrase is changed, all
// wallets will be i... | [
"walletPassphraseChange",
"responds",
"to",
"the",
"walletpassphrasechange",
"request",
"by",
"unlocking",
"all",
"accounts",
"with",
"the",
"provided",
"old",
"passphrase",
"and",
"re",
"-",
"encrypting",
"each",
"private",
"key",
"with",
"an",
"AES",
"key",
"der... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1909-L1921 | train |
btcsuite/btcwallet | rpc/legacyrpc/methods.go | decodeHexStr | func decodeHexStr(hexStr string) ([]byte, error) {
if len(hexStr)%2 != 0 {
hexStr = "0" + hexStr
}
decoded, err := hex.DecodeString(hexStr)
if err != nil {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCDecodeHexString,
Message: "Hex string decode failed: " + err.Error(),
}
}
return decoded, ni... | go | func decodeHexStr(hexStr string) ([]byte, error) {
if len(hexStr)%2 != 0 {
hexStr = "0" + hexStr
}
decoded, err := hex.DecodeString(hexStr)
if err != nil {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCDecodeHexString,
Message: "Hex string decode failed: " + err.Error(),
}
}
return decoded, ni... | [
"func",
"decodeHexStr",
"(",
"hexStr",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"hexStr",
")",
"%",
"2",
"!=",
"0",
"{",
"hexStr",
"=",
"\"",
"\"",
"+",
"hexStr",
"\n",
"}",
"\n",
"decoded",
",",
"err",
":... | // decodeHexStr decodes the hex encoding of a string, possibly prepending a
// leading '0' character if there is an odd number of bytes in the hex string.
// This is to prevent an error for an invalid hex string when using an odd
// number of bytes when calling hex.Decode. | [
"decodeHexStr",
"decodes",
"the",
"hex",
"encoding",
"of",
"a",
"string",
"possibly",
"prepending",
"a",
"leading",
"0",
"character",
"if",
"there",
"is",
"an",
"odd",
"number",
"of",
"bytes",
"in",
"the",
"hex",
"string",
".",
"This",
"is",
"to",
"prevent... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/legacyrpc/methods.go#L1927-L1939 | train |
btcsuite/btcwallet | internal/cfgutil/normalization.go | NormalizeAddress | func NormalizeAddress(addr string, defaultPort string) (hostport string, err error) {
// If the first SplitHostPort errors because of a missing port and not
// for an invalid host, add the port. If the second SplitHostPort
// fails, then a port is not missing and the original error should be
// returned.
host, po... | go | func NormalizeAddress(addr string, defaultPort string) (hostport string, err error) {
// If the first SplitHostPort errors because of a missing port and not
// for an invalid host, add the port. If the second SplitHostPort
// fails, then a port is not missing and the original error should be
// returned.
host, po... | [
"func",
"NormalizeAddress",
"(",
"addr",
"string",
",",
"defaultPort",
"string",
")",
"(",
"hostport",
"string",
",",
"err",
"error",
")",
"{",
"// If the first SplitHostPort errors because of a missing port and not",
"// for an invalid host, add the port. If the second SplitHos... | // NormalizeAddress returns the normalized form of the address, adding a default
// port if necessary. An error is returned if the address, even without a port,
// is not valid. | [
"NormalizeAddress",
"returns",
"the",
"normalized",
"form",
"of",
"the",
"address",
"adding",
"a",
"default",
"port",
"if",
"necessary",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"address",
"even",
"without",
"a",
"port",
"is",
"not",
"valid",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/internal/cfgutil/normalization.go#L12-L27 | train |
btcsuite/btcwallet | internal/cfgutil/normalization.go | NormalizeAddresses | func NormalizeAddresses(addrs []string, defaultPort string) ([]string, error) {
var (
normalized = make([]string, 0, len(addrs))
seenSet = make(map[string]struct{})
)
for _, addr := range addrs {
normalizedAddr, err := NormalizeAddress(addr, defaultPort)
if err != nil {
return nil, err
}
_, seen :... | go | func NormalizeAddresses(addrs []string, defaultPort string) ([]string, error) {
var (
normalized = make([]string, 0, len(addrs))
seenSet = make(map[string]struct{})
)
for _, addr := range addrs {
normalizedAddr, err := NormalizeAddress(addr, defaultPort)
if err != nil {
return nil, err
}
_, seen :... | [
"func",
"NormalizeAddresses",
"(",
"addrs",
"[",
"]",
"string",
",",
"defaultPort",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"(",
"normalized",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"addrs",
... | // NormalizeAddresses returns a new slice with all the passed peer addresses
// normalized with the given default port, and all duplicates removed. | [
"NormalizeAddresses",
"returns",
"a",
"new",
"slice",
"with",
"all",
"the",
"passed",
"peer",
"addresses",
"normalized",
"with",
"the",
"given",
"default",
"port",
"and",
"all",
"duplicates",
"removed",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/internal/cfgutil/normalization.go#L31-L50 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBestBlock | func (c *BitcoindClient) GetBestBlock() (*chainhash.Hash, int32, error) {
bcinfo, err := c.chainConn.client.GetBlockChainInfo()
if err != nil {
return nil, 0, err
}
hash, err := chainhash.NewHashFromStr(bcinfo.BestBlockHash)
if err != nil {
return nil, 0, err
}
return hash, bcinfo.Blocks, nil
} | go | func (c *BitcoindClient) GetBestBlock() (*chainhash.Hash, int32, error) {
bcinfo, err := c.chainConn.client.GetBlockChainInfo()
if err != nil {
return nil, 0, err
}
hash, err := chainhash.NewHashFromStr(bcinfo.BestBlockHash)
if err != nil {
return nil, 0, err
}
return hash, bcinfo.Blocks, nil
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBestBlock",
"(",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"int32",
",",
"error",
")",
"{",
"bcinfo",
",",
"err",
":=",
"c",
".",
"chainConn",
".",
"client",
".",
"GetBlockChainInfo",
"(",
")",
"\... | // GetBestBlock returns the highest block known to bitcoind. | [
"GetBestBlock",
"returns",
"the",
"highest",
"block",
"known",
"to",
"bitcoind",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L121-L133 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBlockHeight | func (c *BitcoindClient) GetBlockHeight(hash *chainhash.Hash) (int32, error) {
header, err := c.chainConn.client.GetBlockHeaderVerbose(hash)
if err != nil {
return 0, err
}
return header.Height, nil
} | go | func (c *BitcoindClient) GetBlockHeight(hash *chainhash.Hash) (int32, error) {
header, err := c.chainConn.client.GetBlockHeaderVerbose(hash)
if err != nil {
return 0, err
}
return header.Height, nil
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBlockHeight",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"int32",
",",
"error",
")",
"{",
"header",
",",
"err",
":=",
"c",
".",
"chainConn",
".",
"client",
".",
"GetBlockHeaderVerbose",
"(",
... | // GetBlockHeight returns the height for the hash, if known, or returns an
// error. | [
"GetBlockHeight",
"returns",
"the",
"height",
"for",
"the",
"hash",
"if",
"known",
"or",
"returns",
"an",
"error",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L137-L144 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBlock | func (c *BitcoindClient) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error) {
return c.chainConn.client.GetBlock(hash)
} | go | func (c *BitcoindClient) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error) {
return c.chainConn.client.GetBlock(hash)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBlock",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"wire",
".",
"MsgBlock",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
".",
"GetBlock",
"(",
"hash",
")",
... | // GetBlock returns a block from the hash. | [
"GetBlock",
"returns",
"a",
"block",
"from",
"the",
"hash",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L147-L149 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBlockVerbose | func (c *BitcoindClient) GetBlockVerbose(
hash *chainhash.Hash) (*btcjson.GetBlockVerboseResult, error) {
return c.chainConn.client.GetBlockVerbose(hash)
} | go | func (c *BitcoindClient) GetBlockVerbose(
hash *chainhash.Hash) (*btcjson.GetBlockVerboseResult, error) {
return c.chainConn.client.GetBlockVerbose(hash)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBlockVerbose",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcjson",
".",
"GetBlockVerboseResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
".",
"GetBlockVerbo... | // GetBlockVerbose returns a verbose block from the hash. | [
"GetBlockVerbose",
"returns",
"a",
"verbose",
"block",
"from",
"the",
"hash",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L152-L156 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBlockHash | func (c *BitcoindClient) GetBlockHash(height int64) (*chainhash.Hash, error) {
return c.chainConn.client.GetBlockHash(height)
} | go | func (c *BitcoindClient) GetBlockHash(height int64) (*chainhash.Hash, error) {
return c.chainConn.client.GetBlockHash(height)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBlockHash",
"(",
"height",
"int64",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
".",
"GetBlockHash",
"(",
"height",
")",
"\n",
"}"
] | // GetBlockHash returns a block hash from the height. | [
"GetBlockHash",
"returns",
"a",
"block",
"hash",
"from",
"the",
"height",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L159-L161 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBlockHeader | func (c *BitcoindClient) GetBlockHeader(
hash *chainhash.Hash) (*wire.BlockHeader, error) {
return c.chainConn.client.GetBlockHeader(hash)
} | go | func (c *BitcoindClient) GetBlockHeader(
hash *chainhash.Hash) (*wire.BlockHeader, error) {
return c.chainConn.client.GetBlockHeader(hash)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBlockHeader",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"wire",
".",
"BlockHeader",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
".",
"GetBlockHeader",
"(",
"... | // GetBlockHeader returns a block header from the hash. | [
"GetBlockHeader",
"returns",
"a",
"block",
"header",
"from",
"the",
"hash",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L164-L168 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetBlockHeaderVerbose | func (c *BitcoindClient) GetBlockHeaderVerbose(
hash *chainhash.Hash) (*btcjson.GetBlockHeaderVerboseResult, error) {
return c.chainConn.client.GetBlockHeaderVerbose(hash)
} | go | func (c *BitcoindClient) GetBlockHeaderVerbose(
hash *chainhash.Hash) (*btcjson.GetBlockHeaderVerboseResult, error) {
return c.chainConn.client.GetBlockHeaderVerbose(hash)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetBlockHeaderVerbose",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcjson",
".",
"GetBlockHeaderVerboseResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
".",
"G... | // GetBlockHeaderVerbose returns a block header from the hash. | [
"GetBlockHeaderVerbose",
"returns",
"a",
"block",
"header",
"from",
"the",
"hash",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L171-L175 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetRawTransactionVerbose | func (c *BitcoindClient) GetRawTransactionVerbose(
hash *chainhash.Hash) (*btcjson.TxRawResult, error) {
return c.chainConn.client.GetRawTransactionVerbose(hash)
} | go | func (c *BitcoindClient) GetRawTransactionVerbose(
hash *chainhash.Hash) (*btcjson.TxRawResult, error) {
return c.chainConn.client.GetRawTransactionVerbose(hash)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetRawTransactionVerbose",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcjson",
".",
"TxRawResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
".",
"GetRawTransact... | // GetRawTransactionVerbose returns a transaction from the tx hash. | [
"GetRawTransactionVerbose",
"returns",
"a",
"transaction",
"from",
"the",
"tx",
"hash",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L178-L182 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | GetTxOut | func (c *BitcoindClient) GetTxOut(txHash *chainhash.Hash, index uint32,
mempool bool) (*btcjson.GetTxOutResult, error) {
return c.chainConn.client.GetTxOut(txHash, index, mempool)
} | go | func (c *BitcoindClient) GetTxOut(txHash *chainhash.Hash, index uint32,
mempool bool) (*btcjson.GetTxOutResult, error) {
return c.chainConn.client.GetTxOut(txHash, index, mempool)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"GetTxOut",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
",",
"index",
"uint32",
",",
"mempool",
"bool",
")",
"(",
"*",
"btcjson",
".",
"GetTxOutResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainC... | // GetTxOut returns a txout from the outpoint info provided. | [
"GetTxOut",
"returns",
"a",
"txout",
"from",
"the",
"outpoint",
"info",
"provided",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L185-L189 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | SendRawTransaction | func (c *BitcoindClient) SendRawTransaction(tx *wire.MsgTx,
allowHighFees bool) (*chainhash.Hash, error) {
return c.chainConn.client.SendRawTransaction(tx, allowHighFees)
} | go | func (c *BitcoindClient) SendRawTransaction(tx *wire.MsgTx,
allowHighFees bool) (*chainhash.Hash, error) {
return c.chainConn.client.SendRawTransaction(tx, allowHighFees)
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"SendRawTransaction",
"(",
"tx",
"*",
"wire",
".",
"MsgTx",
",",
"allowHighFees",
"bool",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"return",
"c",
".",
"chainConn",
".",
"client",
"."... | // SendRawTransaction sends a raw transaction via bitcoind. | [
"SendRawTransaction",
"sends",
"a",
"raw",
"transaction",
"via",
"bitcoind",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L192-L196 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | NotifySpent | func (c *BitcoindClient) NotifySpent(outPoints []*wire.OutPoint) error {
c.NotifyBlocks()
select {
case c.rescanUpdate <- outPoints:
case <-c.quit:
return ErrBitcoindClientShuttingDown
}
return nil
} | go | func (c *BitcoindClient) NotifySpent(outPoints []*wire.OutPoint) error {
c.NotifyBlocks()
select {
case c.rescanUpdate <- outPoints:
case <-c.quit:
return ErrBitcoindClientShuttingDown
}
return nil
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"NotifySpent",
"(",
"outPoints",
"[",
"]",
"*",
"wire",
".",
"OutPoint",
")",
"error",
"{",
"c",
".",
"NotifyBlocks",
"(",
")",
"\n\n",
"select",
"{",
"case",
"c",
".",
"rescanUpdate",
"<-",
"outPoints",
":... | // NotifySpent allows the chain backend to notify the caller whenever a
// transaction spends any of the given outpoints. | [
"NotifySpent",
"allows",
"the",
"chain",
"backend",
"to",
"notify",
"the",
"caller",
"whenever",
"a",
"transaction",
"spends",
"any",
"of",
"the",
"given",
"outpoints",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L223-L233 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | NotifyTx | func (c *BitcoindClient) NotifyTx(txids []chainhash.Hash) error {
c.NotifyBlocks()
select {
case c.rescanUpdate <- txids:
case <-c.quit:
return ErrBitcoindClientShuttingDown
}
return nil
} | go | func (c *BitcoindClient) NotifyTx(txids []chainhash.Hash) error {
c.NotifyBlocks()
select {
case c.rescanUpdate <- txids:
case <-c.quit:
return ErrBitcoindClientShuttingDown
}
return nil
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"NotifyTx",
"(",
"txids",
"[",
"]",
"chainhash",
".",
"Hash",
")",
"error",
"{",
"c",
".",
"NotifyBlocks",
"(",
")",
"\n\n",
"select",
"{",
"case",
"c",
".",
"rescanUpdate",
"<-",
"txids",
":",
"case",
"<... | // NotifyTx allows the chain backend to notify the caller whenever any of the
// given transactions confirm within the chain. | [
"NotifyTx",
"allows",
"the",
"chain",
"backend",
"to",
"notify",
"the",
"caller",
"whenever",
"any",
"of",
"the",
"given",
"transactions",
"confirm",
"within",
"the",
"chain",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L237-L247 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | Rescan | func (c *BitcoindClient) Rescan(blockHash *chainhash.Hash,
addresses []btcutil.Address, outPoints map[wire.OutPoint]btcutil.Address) error {
// A block hash is required to use as the starting point of the rescan.
if blockHash == nil {
return errors.New("rescan requires a starting block hash")
}
// We'll then u... | go | func (c *BitcoindClient) Rescan(blockHash *chainhash.Hash,
addresses []btcutil.Address, outPoints map[wire.OutPoint]btcutil.Address) error {
// A block hash is required to use as the starting point of the rescan.
if blockHash == nil {
return errors.New("rescan requires a starting block hash")
}
// We'll then u... | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"Rescan",
"(",
"blockHash",
"*",
"chainhash",
".",
"Hash",
",",
"addresses",
"[",
"]",
"btcutil",
".",
"Address",
",",
"outPoints",
"map",
"[",
"wire",
".",
"OutPoint",
"]",
"btcutil",
".",
"Address",
")",
... | // Rescan rescans from the block with the given hash until the current block,
// after adding the passed addresses and outpoints to the client's watch list. | [
"Rescan",
"rescans",
"from",
"the",
"block",
"with",
"the",
"given",
"hash",
"until",
"the",
"current",
"block",
"after",
"adding",
"the",
"passed",
"addresses",
"and",
"outpoints",
"to",
"the",
"client",
"s",
"watch",
"list",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L360-L389 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | onBlockConnected | func (c *BitcoindClient) onBlockConnected(hash *chainhash.Hash, height int32,
timestamp time.Time) {
if c.shouldNotifyBlocks() {
select {
case c.notificationQueue.ChanIn() <- BlockConnected{
Block: wtxmgr.Block{
Hash: *hash,
Height: height,
},
Time: timestamp,
}:
case <-c.quit:
}
}
} | go | func (c *BitcoindClient) onBlockConnected(hash *chainhash.Hash, height int32,
timestamp time.Time) {
if c.shouldNotifyBlocks() {
select {
case c.notificationQueue.ChanIn() <- BlockConnected{
Block: wtxmgr.Block{
Hash: *hash,
Height: height,
},
Time: timestamp,
}:
case <-c.quit:
}
}
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"onBlockConnected",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
",",
"height",
"int32",
",",
"timestamp",
"time",
".",
"Time",
")",
"{",
"if",
"c",
".",
"shouldNotifyBlocks",
"(",
")",
"{",
"select",
"{",
"... | // onBlockConnected is a callback that's executed whenever a new block has been
// detected. This will queue a BlockConnected notification to the caller. | [
"onBlockConnected",
"is",
"a",
"callback",
"that",
"s",
"executed",
"whenever",
"a",
"new",
"block",
"has",
"been",
"detected",
".",
"This",
"will",
"queue",
"a",
"BlockConnected",
"notification",
"to",
"the",
"caller",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L623-L638 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | onFilteredBlockConnected | func (c *BitcoindClient) onFilteredBlockConnected(height int32,
header *wire.BlockHeader, relevantTxs []*wtxmgr.TxRecord) {
if c.shouldNotifyBlocks() {
select {
case c.notificationQueue.ChanIn() <- FilteredBlockConnected{
Block: &wtxmgr.BlockMeta{
Block: wtxmgr.Block{
Hash: header.BlockHash(),
... | go | func (c *BitcoindClient) onFilteredBlockConnected(height int32,
header *wire.BlockHeader, relevantTxs []*wtxmgr.TxRecord) {
if c.shouldNotifyBlocks() {
select {
case c.notificationQueue.ChanIn() <- FilteredBlockConnected{
Block: &wtxmgr.BlockMeta{
Block: wtxmgr.Block{
Hash: header.BlockHash(),
... | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"onFilteredBlockConnected",
"(",
"height",
"int32",
",",
"header",
"*",
"wire",
".",
"BlockHeader",
",",
"relevantTxs",
"[",
"]",
"*",
"wtxmgr",
".",
"TxRecord",
")",
"{",
"if",
"c",
".",
"shouldNotifyBlocks",
... | // onFilteredBlockConnected is an alternative callback that's executed whenever
// a new block has been detected. It serves the same purpose as
// onBlockConnected, but it also includes a list of the relevant transactions
// found within the block being connected. This will queue a
// FilteredBlockConnected notificatio... | [
"onFilteredBlockConnected",
"is",
"an",
"alternative",
"callback",
"that",
"s",
"executed",
"whenever",
"a",
"new",
"block",
"has",
"been",
"detected",
".",
"It",
"serves",
"the",
"same",
"purpose",
"as",
"onBlockConnected",
"but",
"it",
"also",
"includes",
"a",... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L645-L663 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | onRelevantTx | func (c *BitcoindClient) onRelevantTx(tx *wtxmgr.TxRecord,
blockDetails *btcjson.BlockDetails) {
block, err := parseBlock(blockDetails)
if err != nil {
log.Errorf("Unable to send onRelevantTx notification, failed "+
"parse block: %v", err)
return
}
select {
case c.notificationQueue.ChanIn() <- RelevantTx... | go | func (c *BitcoindClient) onRelevantTx(tx *wtxmgr.TxRecord,
blockDetails *btcjson.BlockDetails) {
block, err := parseBlock(blockDetails)
if err != nil {
log.Errorf("Unable to send onRelevantTx notification, failed "+
"parse block: %v", err)
return
}
select {
case c.notificationQueue.ChanIn() <- RelevantTx... | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"onRelevantTx",
"(",
"tx",
"*",
"wtxmgr",
".",
"TxRecord",
",",
"blockDetails",
"*",
"btcjson",
".",
"BlockDetails",
")",
"{",
"block",
",",
"err",
":=",
"parseBlock",
"(",
"blockDetails",
")",
"\n",
"if",
"e... | // onRelevantTx is a callback that's executed whenever a transaction is relevant
// to the caller. This means that the transaction matched a specific item in the
// client's different filters. This will queue a RelevantTx notification to the
// caller. | [
"onRelevantTx",
"is",
"a",
"callback",
"that",
"s",
"executed",
"whenever",
"a",
"transaction",
"is",
"relevant",
"to",
"the",
"caller",
".",
"This",
"means",
"that",
"the",
"transaction",
"matched",
"a",
"specific",
"item",
"in",
"the",
"client",
"s",
"diff... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L689-L706 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | onRescanProgress | func (c *BitcoindClient) onRescanProgress(hash *chainhash.Hash, height int32,
timestamp time.Time) {
select {
case c.notificationQueue.ChanIn() <- &RescanProgress{
Hash: hash,
Height: height,
Time: timestamp,
}:
case <-c.quit:
}
} | go | func (c *BitcoindClient) onRescanProgress(hash *chainhash.Hash, height int32,
timestamp time.Time) {
select {
case c.notificationQueue.ChanIn() <- &RescanProgress{
Hash: hash,
Height: height,
Time: timestamp,
}:
case <-c.quit:
}
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"onRescanProgress",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
",",
"height",
"int32",
",",
"timestamp",
"time",
".",
"Time",
")",
"{",
"select",
"{",
"case",
"c",
".",
"notificationQueue",
".",
"ChanIn",
"(... | // onRescanProgress is a callback that's executed whenever a rescan is in
// progress. This will queue a RescanProgress notification to the caller with
// the current rescan progress details. | [
"onRescanProgress",
"is",
"a",
"callback",
"that",
"s",
"executed",
"whenever",
"a",
"rescan",
"is",
"in",
"progress",
".",
"This",
"will",
"queue",
"a",
"RescanProgress",
"notification",
"to",
"the",
"caller",
"with",
"the",
"current",
"rescan",
"progress",
"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L711-L722 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | onRescanFinished | func (c *BitcoindClient) onRescanFinished(hash *chainhash.Hash, height int32,
timestamp time.Time) {
log.Infof("Rescan finished at %d (%s)", height, hash)
select {
case c.notificationQueue.ChanIn() <- &RescanFinished{
Hash: hash,
Height: height,
Time: timestamp,
}:
case <-c.quit:
}
} | go | func (c *BitcoindClient) onRescanFinished(hash *chainhash.Hash, height int32,
timestamp time.Time) {
log.Infof("Rescan finished at %d (%s)", height, hash)
select {
case c.notificationQueue.ChanIn() <- &RescanFinished{
Hash: hash,
Height: height,
Time: timestamp,
}:
case <-c.quit:
}
} | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"onRescanFinished",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
",",
"height",
"int32",
",",
"timestamp",
"time",
".",
"Time",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"height",
",",
"hash",
"... | // onRescanFinished is a callback that's executed whenever a rescan has
// finished. This will queue a RescanFinished notification to the caller with
// the details of the last block in the range of the rescan. | [
"onRescanFinished",
"is",
"a",
"callback",
"that",
"s",
"executed",
"whenever",
"a",
"rescan",
"has",
"finished",
".",
"This",
"will",
"queue",
"a",
"RescanFinished",
"notification",
"to",
"the",
"caller",
"with",
"the",
"details",
"of",
"the",
"last",
"block"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L727-L740 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | reorg | func (c *BitcoindClient) reorg(currentBlock waddrmgr.BlockStamp,
reorgBlock *wire.MsgBlock) error {
log.Debugf("Possible reorg at block %s", reorgBlock.BlockHash())
// Retrieve the best known height based on the block which caused the
// reorg. This way, we can preserve the chain of blocks we need to
// retrieve... | go | func (c *BitcoindClient) reorg(currentBlock waddrmgr.BlockStamp,
reorgBlock *wire.MsgBlock) error {
log.Debugf("Possible reorg at block %s", reorgBlock.BlockHash())
// Retrieve the best known height based on the block which caused the
// reorg. This way, we can preserve the chain of blocks we need to
// retrieve... | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"reorg",
"(",
"currentBlock",
"waddrmgr",
".",
"BlockStamp",
",",
"reorgBlock",
"*",
"wire",
".",
"MsgBlock",
")",
"error",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reorgBlock",
".",
"BlockHash",
"("... | // reorg processes a reorganization during chain synchronization. This is
// separate from a rescan's handling of a reorg. This will rewind back until it
// finds a common ancestor and notify all the new blocks since then. | [
"reorg",
"processes",
"a",
"reorganization",
"during",
"chain",
"synchronization",
".",
"This",
"is",
"separate",
"from",
"a",
"rescan",
"s",
"handling",
"of",
"a",
"reorg",
".",
"This",
"will",
"rewind",
"back",
"until",
"it",
"finds",
"a",
"common",
"ances... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L745-L863 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | filterBlock | func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
notify bool) ([]*wtxmgr.TxRecord, error) {
// If this block happened before the client's birthday, then we'll skip
// it entirely.
if block.Header.Timestamp.Before(c.birthday) {
return nil, nil
}
if c.shouldNotifyBlocks() {
log.Debugf(... | go | func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
notify bool) ([]*wtxmgr.TxRecord, error) {
// If this block happened before the client's birthday, then we'll skip
// it entirely.
if block.Header.Timestamp.Before(c.birthday) {
return nil, nil
}
if c.shouldNotifyBlocks() {
log.Debugf(... | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"filterBlock",
"(",
"block",
"*",
"wire",
".",
"MsgBlock",
",",
"height",
"int32",
",",
"notify",
"bool",
")",
"(",
"[",
"]",
"*",
"wtxmgr",
".",
"TxRecord",
",",
"error",
")",
"{",
"// If this block happened... | // filterBlock filters a block for watched outpoints and addresses, and returns
// any matching transactions, sending notifications along the way. | [
"filterBlock",
"filters",
"a",
"block",
"for",
"watched",
"outpoints",
"and",
"addresses",
"and",
"returns",
"any",
"matching",
"transactions",
"sending",
"notifications",
"along",
"the",
"way",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L1103-L1166 | train |
btcsuite/btcwallet | chain/bitcoind_client.go | filterTx | func (c *BitcoindClient) filterTx(tx *wire.MsgTx,
blockDetails *btcjson.BlockDetails,
notify bool) (bool, *wtxmgr.TxRecord, error) {
txDetails := btcutil.NewTx(tx)
if blockDetails != nil {
txDetails.SetIndex(blockDetails.Index)
}
rec, err := wtxmgr.NewTxRecordFromMsgTx(txDetails.MsgTx(), time.Now())
if err !... | go | func (c *BitcoindClient) filterTx(tx *wire.MsgTx,
blockDetails *btcjson.BlockDetails,
notify bool) (bool, *wtxmgr.TxRecord, error) {
txDetails := btcutil.NewTx(tx)
if blockDetails != nil {
txDetails.SetIndex(blockDetails.Index)
}
rec, err := wtxmgr.NewTxRecordFromMsgTx(txDetails.MsgTx(), time.Now())
if err !... | [
"func",
"(",
"c",
"*",
"BitcoindClient",
")",
"filterTx",
"(",
"tx",
"*",
"wire",
".",
"MsgTx",
",",
"blockDetails",
"*",
"btcjson",
".",
"BlockDetails",
",",
"notify",
"bool",
")",
"(",
"bool",
",",
"*",
"wtxmgr",
".",
"TxRecord",
",",
"error",
")",
... | // filterTx determines whether a transaction is relevant to the client by
// inspecting the client's different filters. | [
"filterTx",
"determines",
"whether",
"a",
"transaction",
"is",
"relevant",
"to",
"the",
"client",
"by",
"inspecting",
"the",
"client",
"s",
"different",
"filters",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/chain/bitcoind_client.go#L1170-L1288 | train |
btcsuite/btcwallet | wtxmgr/migrations.go | dropTransactionHistory | func dropTransactionHistory(ns walletdb.ReadWriteBucket) error {
log.Info("Dropping wallet transaction history")
// To drop the store's transaction history, we'll need to remove all of
// the relevant descendant buckets and key/value pairs.
if err := deleteBuckets(ns); err != nil {
return err
}
if err := ns.De... | go | func dropTransactionHistory(ns walletdb.ReadWriteBucket) error {
log.Info("Dropping wallet transaction history")
// To drop the store's transaction history, we'll need to remove all of
// the relevant descendant buckets and key/value pairs.
if err := deleteBuckets(ns); err != nil {
return err
}
if err := ns.De... | [
"func",
"dropTransactionHistory",
"(",
"ns",
"walletdb",
".",
"ReadWriteBucket",
")",
"error",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"// To drop the store's transaction history, we'll need to remove all of",
"// the relevant descendant buckets and key/value pai... | // dropTransactionHistory is a migration that attempts to recreate the
// transaction store with a clean state. | [
"dropTransactionHistory",
"is",
"a",
"migration",
"that",
"attempts",
"to",
"recreate",
"the",
"transaction",
"store",
"with",
"a",
"clean",
"state",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/migrations.go#L91-L110 | train |
btcsuite/btcwallet | waddrmgr/sync.go | newSyncState | func newSyncState(startBlock, syncedTo *BlockStamp) *syncState {
return &syncState{
startBlock: *startBlock,
syncedTo: *syncedTo,
}
} | go | func newSyncState(startBlock, syncedTo *BlockStamp) *syncState {
return &syncState{
startBlock: *startBlock,
syncedTo: *syncedTo,
}
} | [
"func",
"newSyncState",
"(",
"startBlock",
",",
"syncedTo",
"*",
"BlockStamp",
")",
"*",
"syncState",
"{",
"return",
"&",
"syncState",
"{",
"startBlock",
":",
"*",
"startBlock",
",",
"syncedTo",
":",
"*",
"syncedTo",
",",
"}",
"\n",
"}"
] | // newSyncState returns a new sync state with the provided parameters. | [
"newSyncState",
"returns",
"a",
"new",
"sync",
"state",
"with",
"the",
"provided",
"parameters",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L37-L43 | train |
btcsuite/btcwallet | waddrmgr/sync.go | SetSyncedTo | func (m *Manager) SetSyncedTo(ns walletdb.ReadWriteBucket, bs *BlockStamp) error {
m.mtx.Lock()
defer m.mtx.Unlock()
// Use the stored start blockstamp and reset recent hashes and height
// when the provided blockstamp is nil.
if bs == nil {
bs = &m.syncState.startBlock
}
// Update the database.
err := PutS... | go | func (m *Manager) SetSyncedTo(ns walletdb.ReadWriteBucket, bs *BlockStamp) error {
m.mtx.Lock()
defer m.mtx.Unlock()
// Use the stored start blockstamp and reset recent hashes and height
// when the provided blockstamp is nil.
if bs == nil {
bs = &m.syncState.startBlock
}
// Update the database.
err := PutS... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"SetSyncedTo",
"(",
"ns",
"walletdb",
".",
"ReadWriteBucket",
",",
"bs",
"*",
"BlockStamp",
")",
"error",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"(",
")",
... | // SetSyncedTo marks the address manager to be in sync with the recently-seen
// block described by the blockstamp. When the provided blockstamp is nil, the
// oldest blockstamp of the block the manager was created at and of all
// imported addresses will be used. This effectively allows the manager to be
// marked a... | [
"SetSyncedTo",
"marks",
"the",
"address",
"manager",
"to",
"be",
"in",
"sync",
"with",
"the",
"recently",
"-",
"seen",
"block",
"described",
"by",
"the",
"blockstamp",
".",
"When",
"the",
"provided",
"blockstamp",
"is",
"nil",
"the",
"oldest",
"blockstamp",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L51-L70 | train |
btcsuite/btcwallet | waddrmgr/sync.go | SyncedTo | func (m *Manager) SyncedTo() BlockStamp {
m.mtx.Lock()
defer m.mtx.Unlock()
return m.syncState.syncedTo
} | go | func (m *Manager) SyncedTo() BlockStamp {
m.mtx.Lock()
defer m.mtx.Unlock()
return m.syncState.syncedTo
} | [
"func",
"(",
"m",
"*",
"Manager",
")",
"SyncedTo",
"(",
")",
"BlockStamp",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"m",
".",
"syncState",
".",
"syncedTo",
"\n",
"}"
] | // SyncedTo returns details about the block height and hash that the address
// manager is synced through at the very least. The intention is that callers
// can use this information for intelligently initiating rescans to sync back to
// the best chain from the last known good block. | [
"SyncedTo",
"returns",
"details",
"about",
"the",
"block",
"height",
"and",
"hash",
"that",
"the",
"address",
"manager",
"is",
"synced",
"through",
"at",
"the",
"very",
"least",
".",
"The",
"intention",
"is",
"that",
"callers",
"can",
"use",
"this",
"informa... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L76-L81 | train |
btcsuite/btcwallet | waddrmgr/sync.go | BlockHash | func (m *Manager) BlockHash(ns walletdb.ReadBucket, height int32) (
*chainhash.Hash, error) {
m.mtx.Lock()
defer m.mtx.Unlock()
return fetchBlockHash(ns, height)
} | go | func (m *Manager) BlockHash(ns walletdb.ReadBucket, height int32) (
*chainhash.Hash, error) {
m.mtx.Lock()
defer m.mtx.Unlock()
return fetchBlockHash(ns, height)
} | [
"func",
"(",
"m",
"*",
"Manager",
")",
"BlockHash",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
",",
"height",
"int32",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
"."... | // BlockHash returns the block hash at a particular block height. This
// information is useful for comparing against the chain back-end to see if a
// reorg is taking place and how far back it goes. | [
"BlockHash",
"returns",
"the",
"block",
"hash",
"at",
"a",
"particular",
"block",
"height",
".",
"This",
"information",
"is",
"useful",
"for",
"comparing",
"against",
"the",
"chain",
"back",
"-",
"end",
"to",
"see",
"if",
"a",
"reorg",
"is",
"taking",
"pla... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L86-L92 | train |
btcsuite/btcwallet | waddrmgr/sync.go | Birthday | func (m *Manager) Birthday() time.Time {
m.mtx.Lock()
defer m.mtx.Unlock()
return m.birthday
} | go | func (m *Manager) Birthday() time.Time {
m.mtx.Lock()
defer m.mtx.Unlock()
return m.birthday
} | [
"func",
"(",
"m",
"*",
"Manager",
")",
"Birthday",
"(",
")",
"time",
".",
"Time",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"m",
".",
"birthday",
"\n",
"}"
] | // Birthday returns the birthday, or earliest time a key could have been used,
// for the manager. | [
"Birthday",
"returns",
"the",
"birthday",
"or",
"earliest",
"time",
"a",
"key",
"could",
"have",
"been",
"used",
"for",
"the",
"manager",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L96-L101 | train |
btcsuite/btcwallet | waddrmgr/sync.go | SetBirthday | func (m *Manager) SetBirthday(ns walletdb.ReadWriteBucket,
birthday time.Time) error {
m.mtx.Lock()
defer m.mtx.Unlock()
m.birthday = birthday
return putBirthday(ns, birthday)
} | go | func (m *Manager) SetBirthday(ns walletdb.ReadWriteBucket,
birthday time.Time) error {
m.mtx.Lock()
defer m.mtx.Unlock()
m.birthday = birthday
return putBirthday(ns, birthday)
} | [
"func",
"(",
"m",
"*",
"Manager",
")",
"SetBirthday",
"(",
"ns",
"walletdb",
".",
"ReadWriteBucket",
",",
"birthday",
"time",
".",
"Time",
")",
"error",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"("... | // SetBirthday sets the birthday, or earliest time a key could have been used,
// for the manager. | [
"SetBirthday",
"sets",
"the",
"birthday",
"or",
"earliest",
"time",
"a",
"key",
"could",
"have",
"been",
"used",
"for",
"the",
"manager",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L105-L112 | train |
btcsuite/btcwallet | waddrmgr/sync.go | BirthdayBlock | func (m *Manager) BirthdayBlock(ns walletdb.ReadBucket) (BlockStamp, bool, error) {
birthdayBlock, err := FetchBirthdayBlock(ns)
if err != nil {
return BlockStamp{}, false, err
}
return birthdayBlock, fetchBirthdayBlockVerification(ns), nil
} | go | func (m *Manager) BirthdayBlock(ns walletdb.ReadBucket) (BlockStamp, bool, error) {
birthdayBlock, err := FetchBirthdayBlock(ns)
if err != nil {
return BlockStamp{}, false, err
}
return birthdayBlock, fetchBirthdayBlockVerification(ns), nil
} | [
"func",
"(",
"m",
"*",
"Manager",
")",
"BirthdayBlock",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
")",
"(",
"BlockStamp",
",",
"bool",
",",
"error",
")",
"{",
"birthdayBlock",
",",
"err",
":=",
"FetchBirthdayBlock",
"(",
"ns",
")",
"\n",
"if",
"err",
"... | // BirthdayBlock returns the birthday block, or earliest block a key could have
// been used, for the manager. A boolean is also returned to indicate whether
// the birthday block has been verified as correct. | [
"BirthdayBlock",
"returns",
"the",
"birthday",
"block",
"or",
"earliest",
"block",
"a",
"key",
"could",
"have",
"been",
"used",
"for",
"the",
"manager",
".",
"A",
"boolean",
"is",
"also",
"returned",
"to",
"indicate",
"whether",
"the",
"birthday",
"block",
"... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L117-L124 | train |
btcsuite/btcwallet | waddrmgr/sync.go | SetBirthdayBlock | func (m *Manager) SetBirthdayBlock(ns walletdb.ReadWriteBucket,
block BlockStamp, verified bool) error {
if err := putBirthdayBlock(ns, block); err != nil {
return err
}
return putBirthdayBlockVerification(ns, verified)
} | go | func (m *Manager) SetBirthdayBlock(ns walletdb.ReadWriteBucket,
block BlockStamp, verified bool) error {
if err := putBirthdayBlock(ns, block); err != nil {
return err
}
return putBirthdayBlockVerification(ns, verified)
} | [
"func",
"(",
"m",
"*",
"Manager",
")",
"SetBirthdayBlock",
"(",
"ns",
"walletdb",
".",
"ReadWriteBucket",
",",
"block",
"BlockStamp",
",",
"verified",
"bool",
")",
"error",
"{",
"if",
"err",
":=",
"putBirthdayBlock",
"(",
"ns",
",",
"block",
")",
";",
"e... | // SetBirthdayBlock sets the birthday block, or earliest time a key could have
// been used, for the manager. The verified boolean can be used to specify
// whether this birthday block should be sanity checked to determine if there
// exists a better candidate to prevent less block fetching. | [
"SetBirthdayBlock",
"sets",
"the",
"birthday",
"block",
"or",
"earliest",
"time",
"a",
"key",
"could",
"have",
"been",
"used",
"for",
"the",
"manager",
".",
"The",
"verified",
"boolean",
"can",
"be",
"used",
"to",
"specify",
"whether",
"this",
"birthday",
"b... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/sync.go#L130-L137 | train |
btcsuite/btcwallet | wallet/recovery.go | NewRecoveryManager | func NewRecoveryManager(recoveryWindow, batchSize uint32,
chainParams *chaincfg.Params) *RecoveryManager {
return &RecoveryManager{
recoveryWindow: recoveryWindow,
blockBatch: make([]wtxmgr.BlockMeta, 0, batchSize),
chainParams: chainParams,
state: NewRecoveryState(recoveryWindow),
}
} | go | func NewRecoveryManager(recoveryWindow, batchSize uint32,
chainParams *chaincfg.Params) *RecoveryManager {
return &RecoveryManager{
recoveryWindow: recoveryWindow,
blockBatch: make([]wtxmgr.BlockMeta, 0, batchSize),
chainParams: chainParams,
state: NewRecoveryState(recoveryWindow),
}
} | [
"func",
"NewRecoveryManager",
"(",
"recoveryWindow",
",",
"batchSize",
"uint32",
",",
"chainParams",
"*",
"chaincfg",
".",
"Params",
")",
"*",
"RecoveryManager",
"{",
"return",
"&",
"RecoveryManager",
"{",
"recoveryWindow",
":",
"recoveryWindow",
",",
"blockBatch",
... | // NewRecoveryManager initializes a new RecoveryManager with a derivation
// look-ahead of `recoveryWindow` child indexes, and pre-allocates a backing
// array for `batchSize` blocks to scan at once. | [
"NewRecoveryManager",
"initializes",
"a",
"new",
"RecoveryManager",
"with",
"a",
"derivation",
"look",
"-",
"ahead",
"of",
"recoveryWindow",
"child",
"indexes",
"and",
"pre",
"-",
"allocates",
"a",
"backing",
"array",
"for",
"batchSize",
"blocks",
"to",
"scan",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L43-L52 | train |
btcsuite/btcwallet | wallet/recovery.go | Resurrect | func (rm *RecoveryManager) Resurrect(ns walletdb.ReadBucket,
scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager,
credits []wtxmgr.Credit) error {
// First, for each scope that we are recovering, rederive all of the
// addresses up to the last found address known to each branch.
for keyScope, scopedMgr :=... | go | func (rm *RecoveryManager) Resurrect(ns walletdb.ReadBucket,
scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager,
credits []wtxmgr.Credit) error {
// First, for each scope that we are recovering, rederive all of the
// addresses up to the last found address known to each branch.
for keyScope, scopedMgr :=... | [
"func",
"(",
"rm",
"*",
"RecoveryManager",
")",
"Resurrect",
"(",
"ns",
"walletdb",
".",
"ReadBucket",
",",
"scopedMgrs",
"map",
"[",
"waddrmgr",
".",
"KeyScope",
"]",
"*",
"waddrmgr",
".",
"ScopedKeyManager",
",",
"credits",
"[",
"]",
"wtxmgr",
".",
"Cred... | // Resurrect restores all known addresses for the provided scopes that can be
// found in the walletdb namespace, in addition to restoring all outpoints that
// have been previously found. This method ensures that the recovery state's
// horizons properly start from the last found address of a prior recovery
// attempt... | [
"Resurrect",
"restores",
"all",
"known",
"addresses",
"for",
"the",
"provided",
"scopes",
"that",
"can",
"be",
"found",
"in",
"the",
"walletdb",
"namespace",
"in",
"addition",
"to",
"restoring",
"all",
"outpoints",
"that",
"have",
"been",
"previously",
"found",
... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L59-L144 | train |
btcsuite/btcwallet | wallet/recovery.go | AddToBlockBatch | func (rm *RecoveryManager) AddToBlockBatch(hash *chainhash.Hash, height int32,
timestamp time.Time) {
if !rm.started {
log.Infof("Seed birthday surpassed, starting recovery "+
"of wallet from height=%d hash=%v with "+
"recovery-window=%d", height, *hash, rm.recoveryWindow)
rm.started = true
}
block := w... | go | func (rm *RecoveryManager) AddToBlockBatch(hash *chainhash.Hash, height int32,
timestamp time.Time) {
if !rm.started {
log.Infof("Seed birthday surpassed, starting recovery "+
"of wallet from height=%d hash=%v with "+
"recovery-window=%d", height, *hash, rm.recoveryWindow)
rm.started = true
}
block := w... | [
"func",
"(",
"rm",
"*",
"RecoveryManager",
")",
"AddToBlockBatch",
"(",
"hash",
"*",
"chainhash",
".",
"Hash",
",",
"height",
"int32",
",",
"timestamp",
"time",
".",
"Time",
")",
"{",
"if",
"!",
"rm",
".",
"started",
"{",
"log",
".",
"Infof",
"(",
"\... | // AddToBlockBatch appends the block information, consisting of hash and height,
// to the batch of blocks to be searched. | [
"AddToBlockBatch",
"appends",
"the",
"block",
"information",
"consisting",
"of",
"hash",
"and",
"height",
"to",
"the",
"batch",
"of",
"blocks",
"to",
"be",
"searched",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L148-L166 | train |
btcsuite/btcwallet | wallet/recovery.go | NewRecoveryState | func NewRecoveryState(recoveryWindow uint32) *RecoveryState {
scopes := make(map[waddrmgr.KeyScope]*ScopeRecoveryState)
return &RecoveryState{
recoveryWindow: recoveryWindow,
scopes: scopes,
watchedOutPoints: make(map[wire.OutPoint]btcutil.Address),
}
} | go | func NewRecoveryState(recoveryWindow uint32) *RecoveryState {
scopes := make(map[waddrmgr.KeyScope]*ScopeRecoveryState)
return &RecoveryState{
recoveryWindow: recoveryWindow,
scopes: scopes,
watchedOutPoints: make(map[wire.OutPoint]btcutil.Address),
}
} | [
"func",
"NewRecoveryState",
"(",
"recoveryWindow",
"uint32",
")",
"*",
"RecoveryState",
"{",
"scopes",
":=",
"make",
"(",
"map",
"[",
"waddrmgr",
".",
"KeyScope",
"]",
"*",
"ScopeRecoveryState",
")",
"\n\n",
"return",
"&",
"RecoveryState",
"{",
"recoveryWindow",... | // NewRecoveryState creates a new RecoveryState using the provided
// recoveryWindow. Each RecoveryState that is subsequently initialized for a
// particular key scope will receive the same recoveryWindow. | [
"NewRecoveryState",
"creates",
"a",
"new",
"RecoveryState",
"using",
"the",
"provided",
"recoveryWindow",
".",
"Each",
"RecoveryState",
"that",
"is",
"subsequently",
"initialized",
"for",
"a",
"particular",
"key",
"scope",
"will",
"receive",
"the",
"same",
"recovery... | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L216-L224 | train |
btcsuite/btcwallet | wallet/recovery.go | StateForScope | func (rs *RecoveryState) StateForScope(
keyScope waddrmgr.KeyScope) *ScopeRecoveryState {
// If the account recovery state already exists, return it.
if scopeState, ok := rs.scopes[keyScope]; ok {
return scopeState
}
// Otherwise, initialize the recovery state for this scope with the
// chosen recovery window... | go | func (rs *RecoveryState) StateForScope(
keyScope waddrmgr.KeyScope) *ScopeRecoveryState {
// If the account recovery state already exists, return it.
if scopeState, ok := rs.scopes[keyScope]; ok {
return scopeState
}
// Otherwise, initialize the recovery state for this scope with the
// chosen recovery window... | [
"func",
"(",
"rs",
"*",
"RecoveryState",
")",
"StateForScope",
"(",
"keyScope",
"waddrmgr",
".",
"KeyScope",
")",
"*",
"ScopeRecoveryState",
"{",
"// If the account recovery state already exists, return it.",
"if",
"scopeState",
",",
"ok",
":=",
"rs",
".",
"scopes",
... | // StateForScope returns a ScopeRecoveryState for the provided key scope. If one
// does not already exist, a new one will be generated with the RecoveryState's
// recoveryWindow. | [
"StateForScope",
"returns",
"a",
"ScopeRecoveryState",
"for",
"the",
"provided",
"key",
"scope",
".",
"If",
"one",
"does",
"not",
"already",
"exist",
"a",
"new",
"one",
"will",
"be",
"generated",
"with",
"the",
"RecoveryState",
"s",
"recoveryWindow",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L229-L242 | train |
btcsuite/btcwallet | wallet/recovery.go | AddWatchedOutPoint | func (rs *RecoveryState) AddWatchedOutPoint(outPoint *wire.OutPoint,
addr btcutil.Address) {
rs.watchedOutPoints[*outPoint] = addr
} | go | func (rs *RecoveryState) AddWatchedOutPoint(outPoint *wire.OutPoint,
addr btcutil.Address) {
rs.watchedOutPoints[*outPoint] = addr
} | [
"func",
"(",
"rs",
"*",
"RecoveryState",
")",
"AddWatchedOutPoint",
"(",
"outPoint",
"*",
"wire",
".",
"OutPoint",
",",
"addr",
"btcutil",
".",
"Address",
")",
"{",
"rs",
".",
"watchedOutPoints",
"[",
"*",
"outPoint",
"]",
"=",
"addr",
"\n",
"}"
] | // AddWatchedOutPoint updates the recovery state's set of known outpoints that
// we will monitor for spends during recovery. | [
"AddWatchedOutPoint",
"updates",
"the",
"recovery",
"state",
"s",
"set",
"of",
"known",
"outpoints",
"that",
"we",
"will",
"monitor",
"for",
"spends",
"during",
"recovery",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L252-L256 | train |
btcsuite/btcwallet | wallet/recovery.go | NewScopeRecoveryState | func NewScopeRecoveryState(recoveryWindow uint32) *ScopeRecoveryState {
return &ScopeRecoveryState{
ExternalBranch: NewBranchRecoveryState(recoveryWindow),
InternalBranch: NewBranchRecoveryState(recoveryWindow),
}
} | go | func NewScopeRecoveryState(recoveryWindow uint32) *ScopeRecoveryState {
return &ScopeRecoveryState{
ExternalBranch: NewBranchRecoveryState(recoveryWindow),
InternalBranch: NewBranchRecoveryState(recoveryWindow),
}
} | [
"func",
"NewScopeRecoveryState",
"(",
"recoveryWindow",
"uint32",
")",
"*",
"ScopeRecoveryState",
"{",
"return",
"&",
"ScopeRecoveryState",
"{",
"ExternalBranch",
":",
"NewBranchRecoveryState",
"(",
"recoveryWindow",
")",
",",
"InternalBranch",
":",
"NewBranchRecoveryStat... | // NewScopeRecoveryState initializes an ScopeRecoveryState with the chosen
// recovery window. | [
"NewScopeRecoveryState",
"initializes",
"an",
"ScopeRecoveryState",
"with",
"the",
"chosen",
"recovery",
"window",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L273-L278 | train |
btcsuite/btcwallet | wallet/recovery.go | NewBranchRecoveryState | func NewBranchRecoveryState(recoveryWindow uint32) *BranchRecoveryState {
return &BranchRecoveryState{
recoveryWindow: recoveryWindow,
addresses: make(map[uint32]btcutil.Address),
invalidChildren: make(map[uint32]struct{}),
}
} | go | func NewBranchRecoveryState(recoveryWindow uint32) *BranchRecoveryState {
return &BranchRecoveryState{
recoveryWindow: recoveryWindow,
addresses: make(map[uint32]btcutil.Address),
invalidChildren: make(map[uint32]struct{}),
}
} | [
"func",
"NewBranchRecoveryState",
"(",
"recoveryWindow",
"uint32",
")",
"*",
"BranchRecoveryState",
"{",
"return",
"&",
"BranchRecoveryState",
"{",
"recoveryWindow",
":",
"recoveryWindow",
",",
"addresses",
":",
"make",
"(",
"map",
"[",
"uint32",
"]",
"btcutil",
"... | // NewBranchRecoveryState creates a new BranchRecoveryState that can be used to
// track either the external or internal branch of an account's derivation path. | [
"NewBranchRecoveryState",
"creates",
"a",
"new",
"BranchRecoveryState",
"that",
"can",
"be",
"used",
"to",
"track",
"either",
"the",
"external",
"or",
"internal",
"branch",
"of",
"an",
"account",
"s",
"derivation",
"path",
"."
] | 9d95f76e99a72ffaf73b8a6581d8781c52d756f5 | https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/recovery.go#L314-L320 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.