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
snacl/snacl.go
NewSecretKey
func NewSecretKey(password *[]byte, N, r, p int) (*SecretKey, error) { sk := SecretKey{ Key: (*CryptoKey)(&[KeySize]byte{}), } // setup parameters sk.Parameters.N = N sk.Parameters.R = r sk.Parameters.P = p _, err := io.ReadFull(prng, sk.Parameters.Salt[:]) if err != nil { return nil, err } // derive key...
go
func NewSecretKey(password *[]byte, N, r, p int) (*SecretKey, error) { sk := SecretKey{ Key: (*CryptoKey)(&[KeySize]byte{}), } // setup parameters sk.Parameters.N = N sk.Parameters.R = r sk.Parameters.P = p _, err := io.ReadFull(prng, sk.Parameters.Salt[:]) if err != nil { return nil, err } // derive key...
[ "func", "NewSecretKey", "(", "password", "*", "[", "]", "byte", ",", "N", ",", "r", ",", "p", "int", ")", "(", "*", "SecretKey", ",", "error", ")", "{", "sk", ":=", "SecretKey", "{", "Key", ":", "(", "*", "CryptoKey", ")", "(", "&", "[", "KeySi...
// NewSecretKey returns a SecretKey structure based on the passed parameters.
[ "NewSecretKey", "returns", "a", "SecretKey", "structure", "based", "on", "the", "passed", "parameters", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/snacl/snacl.go#L225-L248
train
btcsuite/btcwallet
wallet/txrules/rules.go
GetDustThreshold
func GetDustThreshold(scriptSize int, relayFeePerKb btcutil.Amount) btcutil.Amount { // Calculate the total (estimated) cost to the network. This is // calculated using the serialize size of the output plus the serial // size of a transaction input which redeems it. The output is assumed // to be compressed P2PKH...
go
func GetDustThreshold(scriptSize int, relayFeePerKb btcutil.Amount) btcutil.Amount { // Calculate the total (estimated) cost to the network. This is // calculated using the serialize size of the output plus the serial // size of a transaction input which redeems it. The output is assumed // to be compressed P2PKH...
[ "func", "GetDustThreshold", "(", "scriptSize", "int", ",", "relayFeePerKb", "btcutil", ".", "Amount", ")", "btcutil", ".", "Amount", "{", "// Calculate the total (estimated) cost to the network. This is", "// calculated using the serialize size of the output plus the serial", "// ...
// GetDustThreshold is used to define the amount below which output will be // determined as dust. Threshold is determined as 3 times the relay fee.
[ "GetDustThreshold", "is", "used", "to", "define", "the", "amount", "below", "which", "output", "will", "be", "determined", "as", "dust", ".", "Threshold", "is", "determined", "as", "3", "times", "the", "relay", "fee", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/txrules/rules.go#L22-L35
train
btcsuite/btcwallet
wallet/txrules/rules.go
IsDustAmount
func IsDustAmount(amount btcutil.Amount, scriptSize int, relayFeePerKb btcutil.Amount) bool { return amount < GetDustThreshold(scriptSize, relayFeePerKb) }
go
func IsDustAmount(amount btcutil.Amount, scriptSize int, relayFeePerKb btcutil.Amount) bool { return amount < GetDustThreshold(scriptSize, relayFeePerKb) }
[ "func", "IsDustAmount", "(", "amount", "btcutil", ".", "Amount", ",", "scriptSize", "int", ",", "relayFeePerKb", "btcutil", ".", "Amount", ")", "bool", "{", "return", "amount", "<", "GetDustThreshold", "(", "scriptSize", ",", "relayFeePerKb", ")", "\n", "}" ]
// IsDustAmount determines whether a transaction output value and script length would // cause the output to be considered dust. Transactions with dust outputs are // not standard and are rejected by mempools with default policies.
[ "IsDustAmount", "determines", "whether", "a", "transaction", "output", "value", "and", "script", "length", "would", "cause", "the", "output", "to", "be", "considered", "dust", ".", "Transactions", "with", "dust", "outputs", "are", "not", "standard", "and", "are"...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/txrules/rules.go#L40-L42
train
btcsuite/btcwallet
wallet/txrules/rules.go
IsDustOutput
func IsDustOutput(output *wire.TxOut, relayFeePerKb btcutil.Amount) bool { // Unspendable outputs which solely carry data are not checked for dust. if txscript.GetScriptClass(output.PkScript) == txscript.NullDataTy { return false } // All other unspendable outputs are considered dust. if txscript.IsUnspendable(...
go
func IsDustOutput(output *wire.TxOut, relayFeePerKb btcutil.Amount) bool { // Unspendable outputs which solely carry data are not checked for dust. if txscript.GetScriptClass(output.PkScript) == txscript.NullDataTy { return false } // All other unspendable outputs are considered dust. if txscript.IsUnspendable(...
[ "func", "IsDustOutput", "(", "output", "*", "wire", ".", "TxOut", ",", "relayFeePerKb", "btcutil", ".", "Amount", ")", "bool", "{", "// Unspendable outputs which solely carry data are not checked for dust.", "if", "txscript", ".", "GetScriptClass", "(", "output", ".", ...
// IsDustOutput determines whether a transaction output is considered dust. // Transactions with dust outputs are not standard and are rejected by mempools // with default policies.
[ "IsDustOutput", "determines", "whether", "a", "transaction", "output", "is", "considered", "dust", ".", "Transactions", "with", "dust", "outputs", "are", "not", "standard", "and", "are", "rejected", "by", "mempools", "with", "default", "policies", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/txrules/rules.go#L47-L60
train
btcsuite/btcwallet
wallet/txrules/rules.go
CheckOutput
func CheckOutput(output *wire.TxOut, relayFeePerKb btcutil.Amount) error { if output.Value < 0 { return ErrAmountNegative } if output.Value > btcutil.MaxSatoshi { return ErrAmountExceedsMax } if IsDustOutput(output, relayFeePerKb) { return ErrOutputIsDust } return nil }
go
func CheckOutput(output *wire.TxOut, relayFeePerKb btcutil.Amount) error { if output.Value < 0 { return ErrAmountNegative } if output.Value > btcutil.MaxSatoshi { return ErrAmountExceedsMax } if IsDustOutput(output, relayFeePerKb) { return ErrOutputIsDust } return nil }
[ "func", "CheckOutput", "(", "output", "*", "wire", ".", "TxOut", ",", "relayFeePerKb", "btcutil", ".", "Amount", ")", "error", "{", "if", "output", ".", "Value", "<", "0", "{", "return", "ErrAmountNegative", "\n", "}", "\n", "if", "output", ".", "Value",...
// CheckOutput performs simple consensus and policy tests on a transaction // output.
[ "CheckOutput", "performs", "simple", "consensus", "and", "policy", "tests", "on", "a", "transaction", "output", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/txrules/rules.go#L71-L82
train
btcsuite/btcwallet
wallet/txrules/rules.go
FeeForSerializeSize
func FeeForSerializeSize(relayFeePerKb btcutil.Amount, txSerializeSize int) btcutil.Amount { fee := relayFeePerKb * btcutil.Amount(txSerializeSize) / 1000 if fee == 0 && relayFeePerKb > 0 { fee = relayFeePerKb } if fee < 0 || fee > btcutil.MaxSatoshi { fee = btcutil.MaxSatoshi } return fee }
go
func FeeForSerializeSize(relayFeePerKb btcutil.Amount, txSerializeSize int) btcutil.Amount { fee := relayFeePerKb * btcutil.Amount(txSerializeSize) / 1000 if fee == 0 && relayFeePerKb > 0 { fee = relayFeePerKb } if fee < 0 || fee > btcutil.MaxSatoshi { fee = btcutil.MaxSatoshi } return fee }
[ "func", "FeeForSerializeSize", "(", "relayFeePerKb", "btcutil", ".", "Amount", ",", "txSerializeSize", "int", ")", "btcutil", ".", "Amount", "{", "fee", ":=", "relayFeePerKb", "*", "btcutil", ".", "Amount", "(", "txSerializeSize", ")", "/", "1000", "\n\n", "if...
// FeeForSerializeSize calculates the required fee for a transaction of some // arbitrary size given a mempool's relay fee policy.
[ "FeeForSerializeSize", "calculates", "the", "required", "fee", "for", "a", "transaction", "of", "some", "arbitrary", "size", "given", "a", "mempool", "s", "relay", "fee", "policy", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/txrules/rules.go#L86-L98
train
btcsuite/btcwallet
wtxmgr/kahnsort.go
graphRoots
func graphRoots(graph hashGraph) []*wire.MsgTx { roots := make([]*wire.MsgTx, 0, len(graph)) for _, node := range graph { if node.inDegree == 0 { roots = append(roots, node.value) } } return roots }
go
func graphRoots(graph hashGraph) []*wire.MsgTx { roots := make([]*wire.MsgTx, 0, len(graph)) for _, node := range graph { if node.inDegree == 0 { roots = append(roots, node.value) } } return roots }
[ "func", "graphRoots", "(", "graph", "hashGraph", ")", "[", "]", "*", "wire", ".", "MsgTx", "{", "roots", ":=", "make", "(", "[", "]", "*", "wire", ".", "MsgTx", ",", "0", ",", "len", "(", "graph", ")", ")", "\n", "for", "_", ",", "node", ":=", ...
// graphRoots returns the roots of the graph. That is, it returns the node's // values for all nodes which contain an input degree of 0.
[ "graphRoots", "returns", "the", "roots", "of", "the", "graph", ".", "That", "is", "it", "returns", "the", "node", "s", "values", "for", "all", "nodes", "which", "contain", "an", "input", "degree", "of", "0", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/kahnsort.go#L76-L84
train
btcsuite/btcwallet
wtxmgr/kahnsort.go
DependencySort
func DependencySort(txs map[chainhash.Hash]*wire.MsgTx) []*wire.MsgTx { graph := makeGraph(txs) s := graphRoots(graph) // If there are no edges (no transactions from the map reference each // other), then Kahn's algorithm is unnecessary. if len(s) == len(txs) { return s } sorted := make([]*wire.MsgTx, 0, len...
go
func DependencySort(txs map[chainhash.Hash]*wire.MsgTx) []*wire.MsgTx { graph := makeGraph(txs) s := graphRoots(graph) // If there are no edges (no transactions from the map reference each // other), then Kahn's algorithm is unnecessary. if len(s) == len(txs) { return s } sorted := make([]*wire.MsgTx, 0, len...
[ "func", "DependencySort", "(", "txs", "map", "[", "chainhash", ".", "Hash", "]", "*", "wire", ".", "MsgTx", ")", "[", "]", "*", "wire", ".", "MsgTx", "{", "graph", ":=", "makeGraph", "(", "txs", ")", "\n", "s", ":=", "graphRoots", "(", "graph", ")"...
// DependencySort topologically sorts a set of transactions by their dependency // order. It is implemented using Kahn's algorithm.
[ "DependencySort", "topologically", "sorts", "a", "set", "of", "transactions", "by", "their", "dependency", "order", ".", "It", "is", "implemented", "using", "Kahn", "s", "algorithm", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/kahnsort.go#L88-L117
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
String
func (k *KeyScope) String() string { return fmt.Sprintf("m/%v'/%v'", k.Purpose, k.Coin) }
go
func (k *KeyScope) String() string { return fmt.Sprintf("m/%v'/%v'", k.Purpose, k.Coin) }
[ "func", "(", "k", "*", "KeyScope", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "k", ".", "Purpose", ",", "k", ".", "Coin", ")", "\n", "}" ]
// String returns a human readable version describing the keypath encapsulated // by the target key scope.
[ "String", "returns", "a", "human", "readable", "version", "describing", "the", "keypath", "encapsulated", "by", "the", "target", "key", "scope", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L69-L71
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
zeroSensitivePublicData
func (s *ScopedKeyManager) zeroSensitivePublicData() { // Clear all of the account private keys. for _, acctInfo := range s.acctInfo { acctInfo.acctKeyPub.Zero() acctInfo.acctKeyPub = nil } }
go
func (s *ScopedKeyManager) zeroSensitivePublicData() { // Clear all of the account private keys. for _, acctInfo := range s.acctInfo { acctInfo.acctKeyPub.Zero() acctInfo.acctKeyPub = nil } }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "zeroSensitivePublicData", "(", ")", "{", "// Clear all of the account private keys.", "for", "_", ",", "acctInfo", ":=", "range", "s", ".", "acctInfo", "{", "acctInfo", ".", "acctKeyPub", ".", "Zero", "(", ")", ...
// zeroSensitivePublicData performs a best try effort to remove and zero all // sensitive public data associated with the address manager such as // hierarchical deterministic extended public keys and the crypto public keys.
[ "zeroSensitivePublicData", "performs", "a", "best", "try", "effort", "to", "remove", "and", "zero", "all", "sensitive", "public", "data", "associated", "with", "the", "address", "manager", "such", "as", "hierarchical", "deterministic", "extended", "public", "keys", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L188-L194
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
keyToManaged
func (s *ScopedKeyManager) keyToManaged(derivedKey *hdkeychain.ExtendedKey, account, branch, index uint32) (ManagedAddress, error) { var addrType AddressType if branch == InternalBranch { addrType = s.addrSchema.InternalAddrType } else { addrType = s.addrSchema.ExternalAddrType } derivationPath := Derivatio...
go
func (s *ScopedKeyManager) keyToManaged(derivedKey *hdkeychain.ExtendedKey, account, branch, index uint32) (ManagedAddress, error) { var addrType AddressType if branch == InternalBranch { addrType = s.addrSchema.InternalAddrType } else { addrType = s.addrSchema.ExternalAddrType } derivationPath := Derivatio...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "keyToManaged", "(", "derivedKey", "*", "hdkeychain", ".", "ExtendedKey", ",", "account", ",", "branch", ",", "index", "uint32", ")", "(", "ManagedAddress", ",", "error", ")", "{", "var", "addrType", "AddressTy...
// keyToManaged returns a new managed address for the provided derived key and // its derivation path which consists of the account, branch, and index. // // The passed derivedKey is zeroed after the new address is created. // // This function MUST be called with the manager lock held for writes.
[ "keyToManaged", "returns", "a", "new", "managed", "address", "for", "the", "provided", "derived", "key", "and", "its", "derivation", "path", "which", "consists", "of", "the", "account", "branch", "and", "index", ".", "The", "passed", "derivedKey", "is", "zeroe...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L214-L258
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
deriveKey
func (s *ScopedKeyManager) deriveKey(acctInfo *accountInfo, branch, index uint32, private bool) (*hdkeychain.ExtendedKey, error) { // Choose the public or private extended key based on whether or not // the private flag was specified. This, in turn, allows for public or // private child derivation. acctKey := ac...
go
func (s *ScopedKeyManager) deriveKey(acctInfo *accountInfo, branch, index uint32, private bool) (*hdkeychain.ExtendedKey, error) { // Choose the public or private extended key based on whether or not // the private flag was specified. This, in turn, allows for public or // private child derivation. acctKey := ac...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "deriveKey", "(", "acctInfo", "*", "accountInfo", ",", "branch", ",", "index", "uint32", ",", "private", "bool", ")", "(", "*", "hdkeychain", ".", "ExtendedKey", ",", "error", ")", "{", "// Choose the public or...
// deriveKey returns either a public or private derived extended key based on // the private flag for the given an account info, branch, and index.
[ "deriveKey", "returns", "either", "a", "public", "or", "private", "derived", "extended", "key", "based", "on", "the", "private", "flag", "for", "the", "given", "an", "account", "info", "branch", "and", "index", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L262-L291
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
AccountProperties
func (s *ScopedKeyManager) AccountProperties(ns walletdb.ReadBucket, account uint32) (*AccountProperties, error) { defer s.mtx.RUnlock() s.mtx.RLock() props := &AccountProperties{AccountNumber: account} // Until keys can be imported into any account, special handling is // required for the imported account. /...
go
func (s *ScopedKeyManager) AccountProperties(ns walletdb.ReadBucket, account uint32) (*AccountProperties, error) { defer s.mtx.RUnlock() s.mtx.RLock() props := &AccountProperties{AccountNumber: account} // Until keys can be imported into any account, special handling is // required for the imported account. /...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "AccountProperties", "(", "ns", "walletdb", ".", "ReadBucket", ",", "account", "uint32", ")", "(", "*", "AccountProperties", ",", "error", ")", "{", "defer", "s", ".", "mtx", ".", "RUnlock", "(", ")", "\n",...
// AccountProperties returns properties associated with the account, such as // the account number, name, and the number of derived and imported keys.
[ "AccountProperties", "returns", "properties", "associated", "with", "the", "account", "such", "as", "the", "account", "number", "name", "and", "the", "number", "of", "derived", "and", "imported", "keys", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L405-L449
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
deriveKeyFromPath
func (s *ScopedKeyManager) deriveKeyFromPath(ns walletdb.ReadBucket, account, branch, index uint32, private bool) (*hdkeychain.ExtendedKey, error) { // Look up the account key information. acctInfo, err := s.loadAccountInfo(ns, account) if err != nil { return nil, err } return s.deriveKey(acctInfo, branch, in...
go
func (s *ScopedKeyManager) deriveKeyFromPath(ns walletdb.ReadBucket, account, branch, index uint32, private bool) (*hdkeychain.ExtendedKey, error) { // Look up the account key information. acctInfo, err := s.loadAccountInfo(ns, account) if err != nil { return nil, err } return s.deriveKey(acctInfo, branch, in...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "deriveKeyFromPath", "(", "ns", "walletdb", ".", "ReadBucket", ",", "account", ",", "branch", ",", "index", "uint32", ",", "private", "bool", ")", "(", "*", "hdkeychain", ".", "ExtendedKey", ",", "error", ")"...
// deriveKeyFromPath returns either a public or private derived extended key // based on the private flag for the given an account, branch, and index. // // This function MUST be called with the manager lock held for writes.
[ "deriveKeyFromPath", "returns", "either", "a", "public", "or", "private", "derived", "extended", "key", "based", "on", "the", "private", "flag", "for", "the", "given", "an", "account", "branch", "and", "index", ".", "This", "function", "MUST", "be", "called", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L474-L484
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
chainAddressRowToManaged
func (s *ScopedKeyManager) chainAddressRowToManaged(ns walletdb.ReadBucket, row *dbChainAddressRow) (ManagedAddress, error) { // Since the manger's mutex is assumed to held when invoking this // function, we use the internal isLocked to avoid a deadlock. isLocked := s.rootManager.isLocked() addressKey, err := s....
go
func (s *ScopedKeyManager) chainAddressRowToManaged(ns walletdb.ReadBucket, row *dbChainAddressRow) (ManagedAddress, error) { // Since the manger's mutex is assumed to held when invoking this // function, we use the internal isLocked to avoid a deadlock. isLocked := s.rootManager.isLocked() addressKey, err := s....
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "chainAddressRowToManaged", "(", "ns", "walletdb", ".", "ReadBucket", ",", "row", "*", "dbChainAddressRow", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// Since the manger's mutex is assumed to held when invoking ...
// chainAddressRowToManaged returns a new managed address based on chained // address data loaded from the database. // // This function MUST be called with the manager lock held for writes.
[ "chainAddressRowToManaged", "returns", "a", "new", "managed", "address", "based", "on", "chained", "address", "data", "loaded", "from", "the", "database", ".", "This", "function", "MUST", "be", "called", "with", "the", "manager", "lock", "held", "for", "writes",...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L490-L505
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
importedAddressRowToManaged
func (s *ScopedKeyManager) importedAddressRowToManaged(row *dbImportedAddressRow) (ManagedAddress, error) { // Use the crypto public key to decrypt the imported public key. pubBytes, err := s.rootManager.cryptoKeyPub.Decrypt(row.encryptedPubKey) if err != nil { str := "failed to decrypt public key for imported ad...
go
func (s *ScopedKeyManager) importedAddressRowToManaged(row *dbImportedAddressRow) (ManagedAddress, error) { // Use the crypto public key to decrypt the imported public key. pubBytes, err := s.rootManager.cryptoKeyPub.Decrypt(row.encryptedPubKey) if err != nil { str := "failed to decrypt public key for imported ad...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "importedAddressRowToManaged", "(", "row", "*", "dbImportedAddressRow", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// Use the crypto public key to decrypt the imported public key.", "pubBytes", ",", "err", ":=", ...
// importedAddressRowToManaged returns a new managed address based on imported // address data loaded from the database.
[ "importedAddressRowToManaged", "returns", "a", "new", "managed", "address", "based", "on", "imported", "address", "data", "loaded", "from", "the", "database", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L509-L542
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
scriptAddressRowToManaged
func (s *ScopedKeyManager) scriptAddressRowToManaged(row *dbScriptAddressRow) (ManagedAddress, error) { // Use the crypto public key to decrypt the imported script hash. scriptHash, err := s.rootManager.cryptoKeyPub.Decrypt(row.encryptedHash) if err != nil { str := "failed to decrypt imported script hash" return...
go
func (s *ScopedKeyManager) scriptAddressRowToManaged(row *dbScriptAddressRow) (ManagedAddress, error) { // Use the crypto public key to decrypt the imported script hash. scriptHash, err := s.rootManager.cryptoKeyPub.Decrypt(row.encryptedHash) if err != nil { str := "failed to decrypt imported script hash" return...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "scriptAddressRowToManaged", "(", "row", "*", "dbScriptAddressRow", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// Use the crypto public key to decrypt the imported script hash.", "scriptHash", ",", "err", ":=", "...
// scriptAddressRowToManaged returns a new managed address based on script // address data loaded from the database.
[ "scriptAddressRowToManaged", "returns", "a", "new", "managed", "address", "based", "on", "script", "address", "data", "loaded", "from", "the", "database", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L546-L555
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
rowInterfaceToManaged
func (s *ScopedKeyManager) rowInterfaceToManaged(ns walletdb.ReadBucket, rowInterface interface{}) (ManagedAddress, error) { switch row := rowInterface.(type) { case *dbChainAddressRow: return s.chainAddressRowToManaged(ns, row) case *dbImportedAddressRow: return s.importedAddressRowToManaged(row) case *dbS...
go
func (s *ScopedKeyManager) rowInterfaceToManaged(ns walletdb.ReadBucket, rowInterface interface{}) (ManagedAddress, error) { switch row := rowInterface.(type) { case *dbChainAddressRow: return s.chainAddressRowToManaged(ns, row) case *dbImportedAddressRow: return s.importedAddressRowToManaged(row) case *dbS...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "rowInterfaceToManaged", "(", "ns", "walletdb", ".", "ReadBucket", ",", "rowInterface", "interface", "{", "}", ")", "(", "ManagedAddress", ",", "error", ")", "{", "switch", "row", ":=", "rowInterface", ".", "("...
// rowInterfaceToManaged returns a new managed address based on the given // address data loaded from the database. It will automatically select the // appropriate type. // // This function MUST be called with the manager lock held for writes.
[ "rowInterfaceToManaged", "returns", "a", "new", "managed", "address", "based", "on", "the", "given", "address", "data", "loaded", "from", "the", "database", ".", "It", "will", "automatically", "select", "the", "appropriate", "type", ".", "This", "function", "MUS...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L562-L578
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
loadAndCacheAddress
func (s *ScopedKeyManager) loadAndCacheAddress(ns walletdb.ReadBucket, address btcutil.Address) (ManagedAddress, error) { // Attempt to load the raw address information from the database. rowInterface, err := fetchAddress(ns, &s.scope, address.ScriptAddress()) if err != nil { if merr, ok := err.(*ManagerError); ...
go
func (s *ScopedKeyManager) loadAndCacheAddress(ns walletdb.ReadBucket, address btcutil.Address) (ManagedAddress, error) { // Attempt to load the raw address information from the database. rowInterface, err := fetchAddress(ns, &s.scope, address.ScriptAddress()) if err != nil { if merr, ok := err.(*ManagerError); ...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "loadAndCacheAddress", "(", "ns", "walletdb", ".", "ReadBucket", ",", "address", "btcutil", ".", "Address", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// Attempt to load the raw address information from the dat...
// loadAndCacheAddress attempts to load the passed address from the database // and caches the associated managed address. // // This function MUST be called with the manager lock held for writes.
[ "loadAndCacheAddress", "attempts", "to", "load", "the", "passed", "address", "from", "the", "database", "and", "caches", "the", "associated", "managed", "address", ".", "This", "function", "MUST", "be", "called", "with", "the", "manager", "lock", "held", "for", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L584-L610
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
existsAddress
func (s *ScopedKeyManager) existsAddress(ns walletdb.ReadBucket, addressID []byte) bool { // Check the in-memory map first since it's faster than a db access. if _, ok := s.addrs[addrKey(addressID)]; ok { return true } // Check the database if not already found above. return existsAddress(ns, &s.scope, addressI...
go
func (s *ScopedKeyManager) existsAddress(ns walletdb.ReadBucket, addressID []byte) bool { // Check the in-memory map first since it's faster than a db access. if _, ok := s.addrs[addrKey(addressID)]; ok { return true } // Check the database if not already found above. return existsAddress(ns, &s.scope, addressI...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "existsAddress", "(", "ns", "walletdb", ".", "ReadBucket", ",", "addressID", "[", "]", "byte", ")", "bool", "{", "// Check the in-memory map first since it's faster than a db access.", "if", "_", ",", "ok", ":=", "s"...
// existsAddress returns whether or not the passed address is known to the // address manager. // // This function MUST be called with the manager lock held for reads.
[ "existsAddress", "returns", "whether", "or", "not", "the", "passed", "address", "is", "known", "to", "the", "address", "manager", ".", "This", "function", "MUST", "be", "called", "with", "the", "manager", "lock", "held", "for", "reads", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L616-L624
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
Address
func (s *ScopedKeyManager) Address(ns walletdb.ReadBucket, address btcutil.Address) (ManagedAddress, error) { // ScriptAddress will only return a script hash if we're accessing an // address that is either PKH or SH. In the event we're passed a PK // address, convert the PK to PKH address so that we can access it ...
go
func (s *ScopedKeyManager) Address(ns walletdb.ReadBucket, address btcutil.Address) (ManagedAddress, error) { // ScriptAddress will only return a script hash if we're accessing an // address that is either PKH or SH. In the event we're passed a PK // address, convert the PK to PKH address so that we can access it ...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "Address", "(", "ns", "walletdb", ".", "ReadBucket", ",", "address", "btcutil", ".", "Address", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// ScriptAddress will only return a script hash if we're accessing an",...
// Address returns a managed address given the passed address if it is known to // the address manager. A managed address differs from the passed address in // that it also potentially contains extra information needed to sign // transactions such as the associated private key for pay-to-pubkey and // pay-to-pubkey-ha...
[ "Address", "returns", "a", "managed", "address", "given", "the", "passed", "address", "if", "it", "is", "known", "to", "the", "address", "manager", ".", "A", "managed", "address", "differs", "from", "the", "passed", "address", "in", "that", "it", "also", "...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L632-L659
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
AddrAccount
func (s *ScopedKeyManager) AddrAccount(ns walletdb.ReadBucket, address btcutil.Address) (uint32, error) { account, err := fetchAddrAccount(ns, &s.scope, address.ScriptAddress()) if err != nil { return 0, maybeConvertDbError(err) } return account, nil }
go
func (s *ScopedKeyManager) AddrAccount(ns walletdb.ReadBucket, address btcutil.Address) (uint32, error) { account, err := fetchAddrAccount(ns, &s.scope, address.ScriptAddress()) if err != nil { return 0, maybeConvertDbError(err) } return account, nil }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "AddrAccount", "(", "ns", "walletdb", ".", "ReadBucket", ",", "address", "btcutil", ".", "Address", ")", "(", "uint32", ",", "error", ")", "{", "account", ",", "err", ":=", "fetchAddrAccount", "(", "ns", ",...
// AddrAccount returns the account to which the given address belongs.
[ "AddrAccount", "returns", "the", "account", "to", "which", "the", "given", "address", "belongs", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L662-L671
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
NextExternalAddresses
func (s *ScopedKeyManager) NextExternalAddresses(ns walletdb.ReadWriteBucket, account uint32, numAddresses uint32) ([]ManagedAddress, error) { // Enforce maximum account number. if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return nil, err } s.mtx.Lock() defer s...
go
func (s *ScopedKeyManager) NextExternalAddresses(ns walletdb.ReadWriteBucket, account uint32, numAddresses uint32) ([]ManagedAddress, error) { // Enforce maximum account number. if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return nil, err } s.mtx.Lock() defer s...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "NextExternalAddresses", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "account", "uint32", ",", "numAddresses", "uint32", ")", "(", "[", "]", "ManagedAddress", ",", "error", ")", "{", "// Enforce maximum acc...
// NextExternalAddresses returns the specified number of next chained addresses // that are intended for external use from the address manager.
[ "NextExternalAddresses", "returns", "the", "specified", "number", "of", "next", "chained", "addresses", "that", "are", "intended", "for", "external", "use", "from", "the", "address", "manager", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1053-L1066
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
ExtendExternalAddresses
func (s *ScopedKeyManager) ExtendExternalAddresses(ns walletdb.ReadWriteBucket, account uint32, lastIndex uint32) error { if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return err } s.mtx.Lock() defer s.mtx.Unlock() return s.extendAddresses(ns, account, lastInde...
go
func (s *ScopedKeyManager) ExtendExternalAddresses(ns walletdb.ReadWriteBucket, account uint32, lastIndex uint32) error { if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return err } s.mtx.Lock() defer s.mtx.Unlock() return s.extendAddresses(ns, account, lastInde...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "ExtendExternalAddresses", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "account", "uint32", ",", "lastIndex", "uint32", ")", "error", "{", "if", "account", ">", "MaxAccountNum", "{", "err", ":=", "manager...
// ExtendExternalAddresses ensures that all valid external keys through // lastIndex are derived and stored in the wallet. This is used to ensure that // wallet's persistent state catches up to a external child that was found // during recovery.
[ "ExtendExternalAddresses", "ensures", "that", "all", "valid", "external", "keys", "through", "lastIndex", "are", "derived", "and", "stored", "in", "the", "wallet", ".", "This", "is", "used", "to", "ensure", "that", "wallet", "s", "persistent", "state", "catches"...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1089-L1101
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
LastExternalAddress
func (s *ScopedKeyManager) LastExternalAddress(ns walletdb.ReadBucket, account uint32) (ManagedAddress, error) { // Enforce maximum account number. if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return nil, err } s.mtx.Lock() defer s.mtx.Unlock() // Load accoun...
go
func (s *ScopedKeyManager) LastExternalAddress(ns walletdb.ReadBucket, account uint32) (ManagedAddress, error) { // Enforce maximum account number. if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return nil, err } s.mtx.Lock() defer s.mtx.Unlock() // Load accoun...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "LastExternalAddress", "(", "ns", "walletdb", ".", "ReadBucket", ",", "account", "uint32", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// Enforce maximum account number.", "if", "account", ">", "MaxAccountNu...
// LastExternalAddress returns the most recently requested chained external // address from calling NextExternalAddress for the given account. The first // external address for the account will be returned if none have been // previously requested. // // This function will return an error if the provided account numbe...
[ "LastExternalAddress", "returns", "the", "most", "recently", "requested", "chained", "external", "address", "from", "calling", "NextExternalAddress", "for", "the", "given", "account", ".", "The", "first", "external", "address", "for", "the", "account", "will", "be",...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1129-L1153
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
LastInternalAddress
func (s *ScopedKeyManager) LastInternalAddress(ns walletdb.ReadBucket, account uint32) (ManagedAddress, error) { // Enforce maximum account number. if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return nil, err } s.mtx.Lock() defer s.mtx.Unlock() // Load accoun...
go
func (s *ScopedKeyManager) LastInternalAddress(ns walletdb.ReadBucket, account uint32) (ManagedAddress, error) { // Enforce maximum account number. if account > MaxAccountNum { err := managerError(ErrAccountNumTooHigh, errAcctTooHigh, nil) return nil, err } s.mtx.Lock() defer s.mtx.Unlock() // Load accoun...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "LastInternalAddress", "(", "ns", "walletdb", ".", "ReadBucket", ",", "account", "uint32", ")", "(", "ManagedAddress", ",", "error", ")", "{", "// Enforce maximum account number.", "if", "account", ">", "MaxAccountNu...
// LastInternalAddress returns the most recently requested chained internal // address from calling NextInternalAddress for the given account. The first // internal address for the account will be returned if none have been // previously requested. // // This function will return an error if the provided account numbe...
[ "LastInternalAddress", "returns", "the", "most", "recently", "requested", "chained", "internal", "address", "from", "calling", "NextInternalAddress", "for", "the", "given", "account", ".", "The", "first", "internal", "address", "for", "the", "account", "will", "be",...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1163-L1187
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
RenameAccount
func (s *ScopedKeyManager) RenameAccount(ns walletdb.ReadWriteBucket, account uint32, name string) error { s.mtx.Lock() defer s.mtx.Unlock() // Ensure that a reserved account is not being renamed. if isReservedAccountNum(account) { str := "reserved account cannot be renamed" return managerError(ErrInvalidAcc...
go
func (s *ScopedKeyManager) RenameAccount(ns walletdb.ReadWriteBucket, account uint32, name string) error { s.mtx.Lock() defer s.mtx.Unlock() // Ensure that a reserved account is not being renamed. if isReservedAccountNum(account) { str := "reserved account cannot be renamed" return managerError(ErrInvalidAcc...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "RenameAccount", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "account", "uint32", ",", "name", "string", ")", "error", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mtx", ...
// RenameAccount renames an account stored in the manager based on the given // account number with the given name. If an account with the same name // already exists, ErrDuplicateAccount will be returned.
[ "RenameAccount", "renames", "an", "account", "stored", "in", "the", "manager", "based", "on", "the", "given", "account", "number", "with", "the", "given", "name", ".", "If", "an", "account", "with", "the", "same", "name", "already", "exists", "ErrDuplicateAcco...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1332-L1395
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
ImportScript
func (s *ScopedKeyManager) ImportScript(ns walletdb.ReadWriteBucket, script []byte, bs *BlockStamp) (ManagedScriptAddress, error) { s.mtx.Lock() defer s.mtx.Unlock() // The manager must be unlocked to encrypt the imported script. if s.rootManager.IsLocked() && !s.rootManager.WatchOnly() { return nil, managerEr...
go
func (s *ScopedKeyManager) ImportScript(ns walletdb.ReadWriteBucket, script []byte, bs *BlockStamp) (ManagedScriptAddress, error) { s.mtx.Lock() defer s.mtx.Unlock() // The manager must be unlocked to encrypt the imported script. if s.rootManager.IsLocked() && !s.rootManager.WatchOnly() { return nil, managerEr...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "ImportScript", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "script", "[", "]", "byte", ",", "bs", "*", "BlockStamp", ")", "(", "ManagedScriptAddress", ",", "error", ")", "{", "s", ".", "mtx", ".", ...
// ImportScript imports a user-provided script into the address manager. The // imported script will act as a pay-to-script-hash address. // // All imported script addresses will be part of the account defined by the // ImportedAddrAccount constant. // // When the address manager is watching-only, the script itself wi...
[ "ImportScript", "imports", "a", "user", "-", "provided", "script", "into", "the", "address", "manager", ".", "The", "imported", "script", "will", "act", "as", "a", "pay", "-", "to", "-", "script", "-", "hash", "address", ".", "All", "imported", "script", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1541-L1637
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
lookupAccount
func (s *ScopedKeyManager) lookupAccount(ns walletdb.ReadBucket, name string) (uint32, error) { return fetchAccountByName(ns, &s.scope, name) }
go
func (s *ScopedKeyManager) lookupAccount(ns walletdb.ReadBucket, name string) (uint32, error) { return fetchAccountByName(ns, &s.scope, name) }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "lookupAccount", "(", "ns", "walletdb", ".", "ReadBucket", ",", "name", "string", ")", "(", "uint32", ",", "error", ")", "{", "return", "fetchAccountByName", "(", "ns", ",", "&", "s", ".", "scope", ",", "...
// lookupAccount loads account number stored in the manager for the given // account name // // This function MUST be called with the manager lock held for reads.
[ "lookupAccount", "loads", "account", "number", "stored", "in", "the", "manager", "for", "the", "given", "account", "name", "This", "function", "MUST", "be", "called", "with", "the", "manager", "lock", "held", "for", "reads", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1643-L1645
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
LookupAccount
func (s *ScopedKeyManager) LookupAccount(ns walletdb.ReadBucket, name string) (uint32, error) { s.mtx.RLock() defer s.mtx.RUnlock() return s.lookupAccount(ns, name) }
go
func (s *ScopedKeyManager) LookupAccount(ns walletdb.ReadBucket, name string) (uint32, error) { s.mtx.RLock() defer s.mtx.RUnlock() return s.lookupAccount(ns, name) }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "LookupAccount", "(", "ns", "walletdb", ".", "ReadBucket", ",", "name", "string", ")", "(", "uint32", ",", "error", ")", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "mtx", "...
// LookupAccount loads account number stored in the manager for the given // account name
[ "LookupAccount", "loads", "account", "number", "stored", "in", "the", "manager", "for", "the", "given", "account", "name" ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1649-L1654
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
fetchUsed
func (s *ScopedKeyManager) fetchUsed(ns walletdb.ReadBucket, addressID []byte) bool { return fetchAddressUsed(ns, &s.scope, addressID) }
go
func (s *ScopedKeyManager) fetchUsed(ns walletdb.ReadBucket, addressID []byte) bool { return fetchAddressUsed(ns, &s.scope, addressID) }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "fetchUsed", "(", "ns", "walletdb", ".", "ReadBucket", ",", "addressID", "[", "]", "byte", ")", "bool", "{", "return", "fetchAddressUsed", "(", "ns", ",", "&", "s", ".", "scope", ",", "addressID", ")", "\...
// fetchUsed returns true if the provided address id was flagged used.
[ "fetchUsed", "returns", "true", "if", "the", "provided", "address", "id", "was", "flagged", "used", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1657-L1661
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
AccountName
func (s *ScopedKeyManager) AccountName(ns walletdb.ReadBucket, account uint32) (string, error) { return fetchAccountName(ns, &s.scope, account) }
go
func (s *ScopedKeyManager) AccountName(ns walletdb.ReadBucket, account uint32) (string, error) { return fetchAccountName(ns, &s.scope, account) }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "AccountName", "(", "ns", "walletdb", ".", "ReadBucket", ",", "account", "uint32", ")", "(", "string", ",", "error", ")", "{", "return", "fetchAccountName", "(", "ns", ",", "&", "s", ".", "scope", ",", "a...
// AccountName returns the account name for the given account number stored in // the manager.
[ "AccountName", "returns", "the", "account", "name", "for", "the", "given", "account", "number", "stored", "in", "the", "manager", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1690-L1692
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
ForEachAccount
func (s *ScopedKeyManager) ForEachAccount(ns walletdb.ReadBucket, fn func(account uint32) error) error { return forEachAccount(ns, &s.scope, fn) }
go
func (s *ScopedKeyManager) ForEachAccount(ns walletdb.ReadBucket, fn func(account uint32) error) error { return forEachAccount(ns, &s.scope, fn) }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "ForEachAccount", "(", "ns", "walletdb", ".", "ReadBucket", ",", "fn", "func", "(", "account", "uint32", ")", "error", ")", "error", "{", "return", "forEachAccount", "(", "ns", ",", "&", "s", ".", "scope", ...
// ForEachAccount calls the given function with each account stored in the // manager, breaking early on error.
[ "ForEachAccount", "calls", "the", "given", "function", "with", "each", "account", "stored", "in", "the", "manager", "breaking", "early", "on", "error", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1696-L1700
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
LastAccount
func (s *ScopedKeyManager) LastAccount(ns walletdb.ReadBucket) (uint32, error) { return fetchLastAccount(ns, &s.scope) }
go
func (s *ScopedKeyManager) LastAccount(ns walletdb.ReadBucket) (uint32, error) { return fetchLastAccount(ns, &s.scope) }
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "LastAccount", "(", "ns", "walletdb", ".", "ReadBucket", ")", "(", "uint32", ",", "error", ")", "{", "return", "fetchLastAccount", "(", "ns", ",", "&", "s", ".", "scope", ")", "\n", "}" ]
// LastAccount returns the last account stored in the manager.
[ "LastAccount", "returns", "the", "last", "account", "stored", "in", "the", "manager", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1703-L1705
train
btcsuite/btcwallet
waddrmgr/scoped_manager.go
ForEachAccountAddress
func (s *ScopedKeyManager) ForEachAccountAddress(ns walletdb.ReadBucket, account uint32, fn func(maddr ManagedAddress) error) error { s.mtx.Lock() defer s.mtx.Unlock() addrFn := func(rowInterface interface{}) error { managedAddr, err := s.rowInterfaceToManaged(ns, rowInterface) if err != nil { return err ...
go
func (s *ScopedKeyManager) ForEachAccountAddress(ns walletdb.ReadBucket, account uint32, fn func(maddr ManagedAddress) error) error { s.mtx.Lock() defer s.mtx.Unlock() addrFn := func(rowInterface interface{}) error { managedAddr, err := s.rowInterfaceToManaged(ns, rowInterface) if err != nil { return err ...
[ "func", "(", "s", "*", "ScopedKeyManager", ")", "ForEachAccountAddress", "(", "ns", "walletdb", ".", "ReadBucket", ",", "account", "uint32", ",", "fn", "func", "(", "maddr", "ManagedAddress", ")", "error", ")", "error", "{", "s", ".", "mtx", ".", "Lock", ...
// ForEachAccountAddress calls the given function with each address of the // given account stored in the manager, breaking early on error.
[ "ForEachAccountAddress", "calls", "the", "given", "function", "with", "each", "address", "of", "the", "given", "account", "stored", "in", "the", "manager", "breaking", "early", "on", "error", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/waddrmgr/scoped_manager.go#L1709-L1728
train
btcsuite/btcwallet
wtxmgr/tx.go
NewTxRecord
func NewTxRecord(serializedTx []byte, received time.Time) (*TxRecord, error) { rec := &TxRecord{ Received: received, SerializedTx: serializedTx, } err := rec.MsgTx.Deserialize(bytes.NewReader(serializedTx)) if err != nil { str := "failed to deserialize transaction" return nil, storeError(ErrInput, str, ...
go
func NewTxRecord(serializedTx []byte, received time.Time) (*TxRecord, error) { rec := &TxRecord{ Received: received, SerializedTx: serializedTx, } err := rec.MsgTx.Deserialize(bytes.NewReader(serializedTx)) if err != nil { str := "failed to deserialize transaction" return nil, storeError(ErrInput, str, ...
[ "func", "NewTxRecord", "(", "serializedTx", "[", "]", "byte", ",", "received", "time", ".", "Time", ")", "(", "*", "TxRecord", ",", "error", ")", "{", "rec", ":=", "&", "TxRecord", "{", "Received", ":", "received", ",", "SerializedTx", ":", "serializedTx...
// NewTxRecord creates a new transaction record that may be inserted into the // store. It uses memoization to save the transaction hash and the serialized // transaction.
[ "NewTxRecord", "creates", "a", "new", "transaction", "record", "that", "may", "be", "inserted", "into", "the", "store", ".", "It", "uses", "memoization", "to", "save", "the", "transaction", "hash", "and", "the", "serialized", "transaction", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L88-L100
train
btcsuite/btcwallet
wtxmgr/tx.go
NewTxRecordFromMsgTx
func NewTxRecordFromMsgTx(msgTx *wire.MsgTx, received time.Time) (*TxRecord, error) { buf := bytes.NewBuffer(make([]byte, 0, msgTx.SerializeSize())) err := msgTx.Serialize(buf) if err != nil { str := "failed to serialize transaction" return nil, storeError(ErrInput, str, err) } rec := &TxRecord{ MsgTx: ...
go
func NewTxRecordFromMsgTx(msgTx *wire.MsgTx, received time.Time) (*TxRecord, error) { buf := bytes.NewBuffer(make([]byte, 0, msgTx.SerializeSize())) err := msgTx.Serialize(buf) if err != nil { str := "failed to serialize transaction" return nil, storeError(ErrInput, str, err) } rec := &TxRecord{ MsgTx: ...
[ "func", "NewTxRecordFromMsgTx", "(", "msgTx", "*", "wire", ".", "MsgTx", ",", "received", "time", ".", "Time", ")", "(", "*", "TxRecord", ",", "error", ")", "{", "buf", ":=", "bytes", ".", "NewBuffer", "(", "make", "(", "[", "]", "byte", ",", "0", ...
// NewTxRecordFromMsgTx creates a new transaction record that may be inserted // into the store.
[ "NewTxRecordFromMsgTx", "creates", "a", "new", "transaction", "record", "that", "may", "be", "inserted", "into", "the", "store", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L104-L119
train
btcsuite/btcwallet
wtxmgr/tx.go
Open
func Open(ns walletdb.ReadBucket, chainParams *chaincfg.Params) (*Store, error) { // Open the store. err := openStore(ns) if err != nil { return nil, err } s := &Store{chainParams, nil} // TODO: set callbacks return s, nil }
go
func Open(ns walletdb.ReadBucket, chainParams *chaincfg.Params) (*Store, error) { // Open the store. err := openStore(ns) if err != nil { return nil, err } s := &Store{chainParams, nil} // TODO: set callbacks return s, nil }
[ "func", "Open", "(", "ns", "walletdb", ".", "ReadBucket", ",", "chainParams", "*", "chaincfg", ".", "Params", ")", "(", "*", "Store", ",", "error", ")", "{", "// Open the store.", "err", ":=", "openStore", "(", "ns", ")", "\n", "if", "err", "!=", "nil"...
// Open opens the wallet transaction store from a walletdb namespace. If the // store does not exist, ErrNoExist is returned.
[ "Open", "opens", "the", "wallet", "transaction", "store", "from", "a", "walletdb", "namespace", ".", "If", "the", "store", "does", "not", "exist", "ErrNoExist", "is", "returned", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L145-L153
train
btcsuite/btcwallet
wtxmgr/tx.go
updateMinedBalance
func (s *Store) updateMinedBalance(ns walletdb.ReadWriteBucket, rec *TxRecord, block *BlockMeta) error { // Fetch the mined balance in case we need to update it. minedBalance, err := fetchMinedBalance(ns) if err != nil { return err } // Add a debit record for each unspent credit spent by this transaction. //...
go
func (s *Store) updateMinedBalance(ns walletdb.ReadWriteBucket, rec *TxRecord, block *BlockMeta) error { // Fetch the mined balance in case we need to update it. minedBalance, err := fetchMinedBalance(ns) if err != nil { return err } // Add a debit record for each unspent credit spent by this transaction. //...
[ "func", "(", "s", "*", "Store", ")", "updateMinedBalance", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "rec", "*", "TxRecord", ",", "block", "*", "BlockMeta", ")", "error", "{", "// Fetch the mined balance in case we need to update it.", "minedBalance", ",",...
// updateMinedBalance updates the mined balance within the store, if changed, // after processing the given transaction record.
[ "updateMinedBalance", "updates", "the", "mined", "balance", "within", "the", "store", "if", "changed", "after", "processing", "the", "given", "transaction", "record", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L164-L276
train
btcsuite/btcwallet
wtxmgr/tx.go
InsertTx
func (s *Store) InsertTx(ns walletdb.ReadWriteBucket, rec *TxRecord, block *BlockMeta) error { if block == nil { return s.insertMemPoolTx(ns, rec) } return s.insertMinedTx(ns, rec, block) }
go
func (s *Store) InsertTx(ns walletdb.ReadWriteBucket, rec *TxRecord, block *BlockMeta) error { if block == nil { return s.insertMemPoolTx(ns, rec) } return s.insertMinedTx(ns, rec, block) }
[ "func", "(", "s", "*", "Store", ")", "InsertTx", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "rec", "*", "TxRecord", ",", "block", "*", "BlockMeta", ")", "error", "{", "if", "block", "==", "nil", "{", "return", "s", ".", "insertMemPoolTx", "(",...
// InsertTx records a transaction as belonging to a wallet's transaction // history. If block is nil, the transaction is considered unspent, and the // transaction's index must be unset.
[ "InsertTx", "records", "a", "transaction", "as", "belonging", "to", "a", "wallet", "s", "transaction", "history", ".", "If", "block", "is", "nil", "the", "transaction", "is", "considered", "unspent", "and", "the", "transaction", "s", "index", "must", "be", "...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L295-L300
train
btcsuite/btcwallet
wtxmgr/tx.go
RemoveUnminedTx
func (s *Store) RemoveUnminedTx(ns walletdb.ReadWriteBucket, rec *TxRecord) error { // As we already have a tx record, we can directly call the // removeConflict method. This will do the job of recursively removing // this unmined transaction, and any transactions that depend on it. return s.removeConflict(ns, rec)...
go
func (s *Store) RemoveUnminedTx(ns walletdb.ReadWriteBucket, rec *TxRecord) error { // As we already have a tx record, we can directly call the // removeConflict method. This will do the job of recursively removing // this unmined transaction, and any transactions that depend on it. return s.removeConflict(ns, rec)...
[ "func", "(", "s", "*", "Store", ")", "RemoveUnminedTx", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "rec", "*", "TxRecord", ")", "error", "{", "// As we already have a tx record, we can directly call the", "// removeConflict method. This will do the job of recursively...
// RemoveUnminedTx attempts to remove an unmined transaction from the // transaction store. This is to be used in the scenario that a transaction // that we attempt to rebroadcast, turns out to double spend one of our // existing inputs. This function we remove the conflicting transaction // identified by the tx record...
[ "RemoveUnminedTx", "attempts", "to", "remove", "an", "unmined", "transaction", "from", "the", "transaction", "store", ".", "This", "is", "to", "be", "used", "in", "the", "scenario", "that", "a", "transaction", "that", "we", "attempt", "to", "rebroadcast", "tur...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L308-L313
train
btcsuite/btcwallet
wtxmgr/tx.go
insertMinedTx
func (s *Store) insertMinedTx(ns walletdb.ReadWriteBucket, rec *TxRecord, block *BlockMeta) error { // If a transaction record for this hash and block already exists, we // can exit early. if _, v := existsTxRecord(ns, &rec.Hash, &block.Block); v != nil { return nil } // If a block record does not yet exist f...
go
func (s *Store) insertMinedTx(ns walletdb.ReadWriteBucket, rec *TxRecord, block *BlockMeta) error { // If a transaction record for this hash and block already exists, we // can exit early. if _, v := existsTxRecord(ns, &rec.Hash, &block.Block); v != nil { return nil } // If a block record does not yet exist f...
[ "func", "(", "s", "*", "Store", ")", "insertMinedTx", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "rec", "*", "TxRecord", ",", "block", "*", "BlockMeta", ")", "error", "{", "// If a transaction record for this hash and block already exists, we", "// can exit e...
// insertMinedTx inserts a new transaction record for a mined transaction into // the database under the confirmed bucket. It guarantees that, if the // tranasction was previously unconfirmed, then it will take care of cleaning up // the unconfirmed state. All other unconfirmed double spend attempts will be // removed ...
[ "insertMinedTx", "inserts", "a", "new", "transaction", "record", "for", "a", "mined", "transaction", "into", "the", "database", "under", "the", "confirmed", "bucket", ".", "It", "guarantees", "that", "if", "the", "tranasction", "was", "previously", "unconfirmed", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L320-L373
train
btcsuite/btcwallet
wtxmgr/tx.go
Rollback
func (s *Store) Rollback(ns walletdb.ReadWriteBucket, height int32) error { return s.rollback(ns, height) }
go
func (s *Store) Rollback(ns walletdb.ReadWriteBucket, height int32) error { return s.rollback(ns, height) }
[ "func", "(", "s", "*", "Store", ")", "Rollback", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "height", "int32", ")", "error", "{", "return", "s", ".", "rollback", "(", "ns", ",", "height", ")", "\n", "}" ]
// Rollback removes all blocks at height onwards, moving any transactions within // each block to the unconfirmed pool.
[ "Rollback", "removes", "all", "blocks", "at", "height", "onwards", "moving", "any", "transactions", "within", "each", "block", "to", "the", "unconfirmed", "pool", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/tx.go#L453-L455
train
btcsuite/btcwallet
internal/zero/slice.go
BigInt
func BigInt(x *big.Int) { b := x.Bits() for i := range b { b[i] = 0 } x.SetInt64(0) }
go
func BigInt(x *big.Int) { b := x.Bits() for i := range b { b[i] = 0 } x.SetInt64(0) }
[ "func", "BigInt", "(", "x", "*", "big", ".", "Int", ")", "{", "b", ":=", "x", ".", "Bits", "(", ")", "\n", "for", "i", ":=", "range", "b", "{", "b", "[", "i", "]", "=", "0", "\n", "}", "\n", "x", ".", "SetInt64", "(", "0", ")", "\n", "}...
// BigInt sets all bytes in the passed big int to zero and then sets the // value to 0. This differs from simply setting the value in that it // specifically clears the underlying bytes whereas simply setting the value // does not. This is mostly useful to forcefully clear private keys.
[ "BigInt", "sets", "all", "bytes", "in", "the", "passed", "big", "int", "to", "zero", "and", "then", "sets", "the", "value", "to", "0", ".", "This", "differs", "from", "simply", "setting", "the", "value", "in", "that", "it", "specifically", "clears", "the...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/internal/zero/slice.go#L28-L34
train
btcsuite/btcwallet
rpc/rpcserver/log.go
stripGrpcPrefixArgs
func stripGrpcPrefixArgs(args ...interface{}) []interface{} { if len(args) == 0 { return args } firstArgStr, ok := args[0].(string) if ok { args[0] = stripGrpcPrefix(firstArgStr) } return args }
go
func stripGrpcPrefixArgs(args ...interface{}) []interface{} { if len(args) == 0 { return args } firstArgStr, ok := args[0].(string) if ok { args[0] = stripGrpcPrefix(firstArgStr) } return args }
[ "func", "stripGrpcPrefixArgs", "(", "args", "...", "interface", "{", "}", ")", "[", "]", "interface", "{", "}", "{", "if", "len", "(", "args", ")", "==", "0", "{", "return", "args", "\n", "}", "\n", "firstArgStr", ",", "ok", ":=", "args", "[", "0",...
// stripGrpcPrefixArgs removes the package prefix from the first argument, if it // exists and is a string, returning the same arg slice after reassigning the // first arg.
[ "stripGrpcPrefixArgs", "removes", "the", "package", "prefix", "from", "the", "first", "argument", "if", "it", "exists", "and", "is", "a", "string", "returning", "the", "same", "arg", "slice", "after", "reassigning", "the", "first", "arg", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/rpc/rpcserver/log.go#L45-L54
train
btcsuite/btcwallet
internal/cfgutil/amount.go
UnmarshalFlag
func (a *AmountFlag) UnmarshalFlag(value string) error { value = strings.TrimSuffix(value, " BTC") valueF64, err := strconv.ParseFloat(value, 64) if err != nil { return err } amount, err := btcutil.NewAmount(valueF64) if err != nil { return err } a.Amount = amount return nil }
go
func (a *AmountFlag) UnmarshalFlag(value string) error { value = strings.TrimSuffix(value, " BTC") valueF64, err := strconv.ParseFloat(value, 64) if err != nil { return err } amount, err := btcutil.NewAmount(valueF64) if err != nil { return err } a.Amount = amount return nil }
[ "func", "(", "a", "*", "AmountFlag", ")", "UnmarshalFlag", "(", "value", "string", ")", "error", "{", "value", "=", "strings", ".", "TrimSuffix", "(", "value", ",", "\"", "\"", ")", "\n", "valueF64", ",", "err", ":=", "strconv", ".", "ParseFloat", "(",...
// UnmarshalFlag satisifes the flags.Unmarshaler interface.
[ "UnmarshalFlag", "satisifes", "the", "flags", ".", "Unmarshaler", "interface", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/internal/cfgutil/amount.go#L31-L43
train
btcsuite/btcwallet
wtxmgr/unconfirmed.go
insertMemPoolTx
func (s *Store) insertMemPoolTx(ns walletdb.ReadWriteBucket, rec *TxRecord) error { // Check whether the transaction has already been added to the // unconfirmed bucket. if existsRawUnmined(ns, rec.Hash[:]) != nil { // TODO: compare serialized txs to ensure this isn't a hash // collision? return nil } // Si...
go
func (s *Store) insertMemPoolTx(ns walletdb.ReadWriteBucket, rec *TxRecord) error { // Check whether the transaction has already been added to the // unconfirmed bucket. if existsRawUnmined(ns, rec.Hash[:]) != nil { // TODO: compare serialized txs to ensure this isn't a hash // collision? return nil } // Si...
[ "func", "(", "s", "*", "Store", ")", "insertMemPoolTx", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "rec", "*", "TxRecord", ")", "error", "{", "// Check whether the transaction has already been added to the", "// unconfirmed bucket.", "if", "existsRawUnmined", "...
// insertMemPoolTx inserts the unmined transaction record. It also marks // previous outputs referenced by the inputs as spent.
[ "insertMemPoolTx", "inserts", "the", "unmined", "transaction", "record", ".", "It", "also", "marks", "previous", "outputs", "referenced", "by", "the", "inputs", "as", "spent", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/unconfirmed.go#L16-L59
train
btcsuite/btcwallet
wtxmgr/unconfirmed.go
removeConflict
func (s *Store) removeConflict(ns walletdb.ReadWriteBucket, rec *TxRecord) error { // For each potential credit for this record, each spender (if any) must // be recursively removed as well. Once the spenders are removed, the // credit is deleted. for i := range rec.MsgTx.TxOut { k := canonicalOutPoint(&rec.Hash...
go
func (s *Store) removeConflict(ns walletdb.ReadWriteBucket, rec *TxRecord) error { // For each potential credit for this record, each spender (if any) must // be recursively removed as well. Once the spenders are removed, the // credit is deleted. for i := range rec.MsgTx.TxOut { k := canonicalOutPoint(&rec.Hash...
[ "func", "(", "s", "*", "Store", ")", "removeConflict", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "rec", "*", "TxRecord", ")", "error", "{", "// For each potential credit for this record, each spender (if any) must", "// be recursively removed as well. Once the spen...
// removeConflict removes an unmined transaction record and all spend chains // deriving from it from the store. This is designed to remove transactions // that would otherwise result in double spend conflicts if left in the store, // and to remove transactions that spend coinbase transactions on reorgs.
[ "removeConflict", "removes", "an", "unmined", "transaction", "record", "and", "all", "spend", "chains", "deriving", "from", "it", "from", "the", "store", ".", "This", "is", "designed", "to", "remove", "transactions", "that", "would", "otherwise", "result", "in",...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/unconfirmed.go#L114-L163
train
btcsuite/btcwallet
wtxmgr/unconfirmed.go
UnminedTxs
func (s *Store) UnminedTxs(ns walletdb.ReadBucket) ([]*wire.MsgTx, error) { recSet, err := s.unminedTxRecords(ns) if err != nil { return nil, err } txSet := make(map[chainhash.Hash]*wire.MsgTx, len(recSet)) for txHash, txRec := range recSet { txSet[txHash] = &txRec.MsgTx } return DependencySort(txSet), nil...
go
func (s *Store) UnminedTxs(ns walletdb.ReadBucket) ([]*wire.MsgTx, error) { recSet, err := s.unminedTxRecords(ns) if err != nil { return nil, err } txSet := make(map[chainhash.Hash]*wire.MsgTx, len(recSet)) for txHash, txRec := range recSet { txSet[txHash] = &txRec.MsgTx } return DependencySort(txSet), nil...
[ "func", "(", "s", "*", "Store", ")", "UnminedTxs", "(", "ns", "walletdb", ".", "ReadBucket", ")", "(", "[", "]", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "recSet", ",", "err", ":=", "s", ".", "unminedTxRecords", "(", "ns", ")", "\n", "i...
// UnminedTxs returns the underlying transactions for all unmined transactions // which are not known to have been mined in a block. Transactions are // guaranteed to be sorted by their dependency order.
[ "UnminedTxs", "returns", "the", "underlying", "transactions", "for", "all", "unmined", "transactions", "which", "are", "not", "known", "to", "have", "been", "mined", "in", "a", "block", ".", "Transactions", "are", "guaranteed", "to", "be", "sorted", "by", "the...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/unconfirmed.go#L168-L180
train
btcsuite/btcwallet
wtxmgr/unconfirmed.go
UnminedTxHashes
func (s *Store) UnminedTxHashes(ns walletdb.ReadBucket) ([]*chainhash.Hash, error) { return s.unminedTxHashes(ns) }
go
func (s *Store) UnminedTxHashes(ns walletdb.ReadBucket) ([]*chainhash.Hash, error) { return s.unminedTxHashes(ns) }
[ "func", "(", "s", "*", "Store", ")", "UnminedTxHashes", "(", "ns", "walletdb", ".", "ReadBucket", ")", "(", "[", "]", "*", "chainhash", ".", "Hash", ",", "error", ")", "{", "return", "s", ".", "unminedTxHashes", "(", "ns", ")", "\n", "}" ]
// UnminedTxHashes returns the hashes of all transactions not known to have been // mined in a block.
[ "UnminedTxHashes", "returns", "the", "hashes", "of", "all", "transactions", "not", "known", "to", "have", "been", "mined", "in", "a", "block", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wtxmgr/unconfirmed.go#L204-L206
train
btcsuite/btcwallet
wallet/wallet.go
Start
func (w *Wallet) Start() { w.quitMu.Lock() select { case <-w.quit: // Restart the wallet goroutines after shutdown finishes. w.WaitForShutdown() w.quit = make(chan struct{}) default: // Ignore when the wallet is still running. if w.started { w.quitMu.Unlock() return } w.started = true } w.quit...
go
func (w *Wallet) Start() { w.quitMu.Lock() select { case <-w.quit: // Restart the wallet goroutines after shutdown finishes. w.WaitForShutdown() w.quit = make(chan struct{}) default: // Ignore when the wallet is still running. if w.started { w.quitMu.Unlock() return } w.started = true } w.quit...
[ "func", "(", "w", "*", "Wallet", ")", "Start", "(", ")", "{", "w", ".", "quitMu", ".", "Lock", "(", ")", "\n", "select", "{", "case", "<-", "w", ".", "quit", ":", "// Restart the wallet goroutines after shutdown finishes.", "w", ".", "WaitForShutdown", "("...
// Start starts the goroutines necessary to manage a wallet.
[ "Start", "starts", "the", "goroutines", "necessary", "to", "manage", "a", "wallet", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L124-L144
train
btcsuite/btcwallet
wallet/wallet.go
SynchronizeRPC
func (w *Wallet) SynchronizeRPC(chainClient chain.Interface) { w.quitMu.Lock() select { case <-w.quit: w.quitMu.Unlock() return default: } w.quitMu.Unlock() // TODO: Ignoring the new client when one is already set breaks callers // who are replacing the client, perhaps after a disconnect. w.chainClientLoc...
go
func (w *Wallet) SynchronizeRPC(chainClient chain.Interface) { w.quitMu.Lock() select { case <-w.quit: w.quitMu.Unlock() return default: } w.quitMu.Unlock() // TODO: Ignoring the new client when one is already set breaks callers // who are replacing the client, perhaps after a disconnect. w.chainClientLoc...
[ "func", "(", "w", "*", "Wallet", ")", "SynchronizeRPC", "(", "chainClient", "chain", ".", "Interface", ")", "{", "w", ".", "quitMu", ".", "Lock", "(", ")", "\n", "select", "{", "case", "<-", "w", ".", "quit", ":", "w", ".", "quitMu", ".", "Unlock",...
// SynchronizeRPC associates the wallet with the consensus RPC client, // synchronizes the wallet with the latest changes to the blockchain, and // continuously updates the wallet through RPC notifications. // // This method is unstable and will be removed when all syncing logic is moved // outside of the wallet packag...
[ "SynchronizeRPC", "associates", "the", "wallet", "with", "the", "consensus", "RPC", "client", "synchronizes", "the", "wallet", "with", "the", "latest", "changes", "to", "the", "blockchain", "and", "continuously", "updates", "the", "wallet", "through", "RPC", "noti...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L152-L190
train
btcsuite/btcwallet
wallet/wallet.go
requireChainClient
func (w *Wallet) requireChainClient() (chain.Interface, error) { w.chainClientLock.Lock() chainClient := w.chainClient w.chainClientLock.Unlock() if chainClient == nil { return nil, errors.New("blockchain RPC is inactive") } return chainClient, nil }
go
func (w *Wallet) requireChainClient() (chain.Interface, error) { w.chainClientLock.Lock() chainClient := w.chainClient w.chainClientLock.Unlock() if chainClient == nil { return nil, errors.New("blockchain RPC is inactive") } return chainClient, nil }
[ "func", "(", "w", "*", "Wallet", ")", "requireChainClient", "(", ")", "(", "chain", ".", "Interface", ",", "error", ")", "{", "w", ".", "chainClientLock", ".", "Lock", "(", ")", "\n", "chainClient", ":=", "w", ".", "chainClient", "\n", "w", ".", "cha...
// requireChainClient marks that a wallet method can only be completed when the // consensus RPC server is set. This function and all functions that call it // are unstable and will need to be moved when the syncing code is moved out of // the wallet.
[ "requireChainClient", "marks", "that", "a", "wallet", "method", "can", "only", "be", "completed", "when", "the", "consensus", "RPC", "server", "is", "set", ".", "This", "function", "and", "all", "functions", "that", "call", "it", "are", "unstable", "and", "w...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L196-L204
train
btcsuite/btcwallet
wallet/wallet.go
ChainClient
func (w *Wallet) ChainClient() chain.Interface { w.chainClientLock.Lock() chainClient := w.chainClient w.chainClientLock.Unlock() return chainClient }
go
func (w *Wallet) ChainClient() chain.Interface { w.chainClientLock.Lock() chainClient := w.chainClient w.chainClientLock.Unlock() return chainClient }
[ "func", "(", "w", "*", "Wallet", ")", "ChainClient", "(", ")", "chain", ".", "Interface", "{", "w", ".", "chainClientLock", ".", "Lock", "(", ")", "\n", "chainClient", ":=", "w", ".", "chainClient", "\n", "w", ".", "chainClientLock", ".", "Unlock", "("...
// ChainClient returns the optional consensus RPC client associated with the // wallet. // // This function is unstable and will be removed once sync logic is moved out of // the wallet.
[ "ChainClient", "returns", "the", "optional", "consensus", "RPC", "client", "associated", "with", "the", "wallet", ".", "This", "function", "is", "unstable", "and", "will", "be", "removed", "once", "sync", "logic", "is", "moved", "out", "of", "the", "wallet", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L211-L216
train
btcsuite/btcwallet
wallet/wallet.go
quitChan
func (w *Wallet) quitChan() <-chan struct{} { w.quitMu.Lock() c := w.quit w.quitMu.Unlock() return c }
go
func (w *Wallet) quitChan() <-chan struct{} { w.quitMu.Lock() c := w.quit w.quitMu.Unlock() return c }
[ "func", "(", "w", "*", "Wallet", ")", "quitChan", "(", ")", "<-", "chan", "struct", "{", "}", "{", "w", ".", "quitMu", ".", "Lock", "(", ")", "\n", "c", ":=", "w", ".", "quit", "\n", "w", ".", "quitMu", ".", "Unlock", "(", ")", "\n", "return"...
// quitChan atomically reads the quit channel.
[ "quitChan", "atomically", "reads", "the", "quit", "channel", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L219-L224
train
btcsuite/btcwallet
wallet/wallet.go
Stop
func (w *Wallet) Stop() { w.quitMu.Lock() quit := w.quit w.quitMu.Unlock() select { case <-quit: default: close(quit) w.chainClientLock.Lock() if w.chainClient != nil { w.chainClient.Stop() w.chainClient = nil } w.chainClientLock.Unlock() } }
go
func (w *Wallet) Stop() { w.quitMu.Lock() quit := w.quit w.quitMu.Unlock() select { case <-quit: default: close(quit) w.chainClientLock.Lock() if w.chainClient != nil { w.chainClient.Stop() w.chainClient = nil } w.chainClientLock.Unlock() } }
[ "func", "(", "w", "*", "Wallet", ")", "Stop", "(", ")", "{", "w", ".", "quitMu", ".", "Lock", "(", ")", "\n", "quit", ":=", "w", ".", "quit", "\n", "w", ".", "quitMu", ".", "Unlock", "(", ")", "\n\n", "select", "{", "case", "<-", "quit", ":",...
// Stop signals all wallet goroutines to shutdown.
[ "Stop", "signals", "all", "wallet", "goroutines", "to", "shutdown", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L227-L243
train
btcsuite/btcwallet
wallet/wallet.go
WaitForShutdown
func (w *Wallet) WaitForShutdown() { w.chainClientLock.Lock() if w.chainClient != nil { w.chainClient.WaitForShutdown() } w.chainClientLock.Unlock() w.wg.Wait() }
go
func (w *Wallet) WaitForShutdown() { w.chainClientLock.Lock() if w.chainClient != nil { w.chainClient.WaitForShutdown() } w.chainClientLock.Unlock() w.wg.Wait() }
[ "func", "(", "w", "*", "Wallet", ")", "WaitForShutdown", "(", ")", "{", "w", ".", "chainClientLock", ".", "Lock", "(", ")", "\n", "if", "w", ".", "chainClient", "!=", "nil", "{", "w", ".", "chainClient", ".", "WaitForShutdown", "(", ")", "\n", "}", ...
// WaitForShutdown blocks until all wallet goroutines have finished executing.
[ "WaitForShutdown", "blocks", "until", "all", "wallet", "goroutines", "have", "finished", "executing", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L257-L264
train
btcsuite/btcwallet
wallet/wallet.go
SynchronizingToNetwork
func (w *Wallet) SynchronizingToNetwork() bool { // At the moment, RPC is the only synchronization method. In the // future, when SPV is added, a separate check will also be needed, or // SPV could always be enabled if RPC was not explicitly specified when // creating the wallet. w.chainClientSyncMtx.Lock() sync...
go
func (w *Wallet) SynchronizingToNetwork() bool { // At the moment, RPC is the only synchronization method. In the // future, when SPV is added, a separate check will also be needed, or // SPV could always be enabled if RPC was not explicitly specified when // creating the wallet. w.chainClientSyncMtx.Lock() sync...
[ "func", "(", "w", "*", "Wallet", ")", "SynchronizingToNetwork", "(", ")", "bool", "{", "// At the moment, RPC is the only synchronization method. In the", "// future, when SPV is added, a separate check will also be needed, or", "// SPV could always be enabled if RPC was not explicitly sp...
// SynchronizingToNetwork returns whether the wallet is currently synchronizing // with the Bitcoin network.
[ "SynchronizingToNetwork", "returns", "whether", "the", "wallet", "is", "currently", "synchronizing", "with", "the", "Bitcoin", "network", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L268-L277
train
btcsuite/btcwallet
wallet/wallet.go
ChainSynced
func (w *Wallet) ChainSynced() bool { w.chainClientSyncMtx.Lock() synced := w.chainClientSynced w.chainClientSyncMtx.Unlock() return synced }
go
func (w *Wallet) ChainSynced() bool { w.chainClientSyncMtx.Lock() synced := w.chainClientSynced w.chainClientSyncMtx.Unlock() return synced }
[ "func", "(", "w", "*", "Wallet", ")", "ChainSynced", "(", ")", "bool", "{", "w", ".", "chainClientSyncMtx", ".", "Lock", "(", ")", "\n", "synced", ":=", "w", ".", "chainClientSynced", "\n", "w", ".", "chainClientSyncMtx", ".", "Unlock", "(", ")", "\n",...
// ChainSynced returns whether the wallet has been attached to a chain server // and synced up to the best block on the main chain.
[ "ChainSynced", "returns", "whether", "the", "wallet", "has", "been", "attached", "to", "a", "chain", "server", "and", "synced", "up", "to", "the", "best", "block", "on", "the", "main", "chain", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L281-L286
train
btcsuite/btcwallet
wallet/wallet.go
activeData
func (w *Wallet) activeData(dbtx walletdb.ReadTx) ([]btcutil.Address, []wtxmgr.Credit, error) { addrmgrNs := dbtx.ReadBucket(waddrmgrNamespaceKey) txmgrNs := dbtx.ReadBucket(wtxmgrNamespaceKey) var addrs []btcutil.Address err := w.Manager.ForEachActiveAddress(addrmgrNs, func(addr btcutil.Address) error { addrs =...
go
func (w *Wallet) activeData(dbtx walletdb.ReadTx) ([]btcutil.Address, []wtxmgr.Credit, error) { addrmgrNs := dbtx.ReadBucket(waddrmgrNamespaceKey) txmgrNs := dbtx.ReadBucket(wtxmgrNamespaceKey) var addrs []btcutil.Address err := w.Manager.ForEachActiveAddress(addrmgrNs, func(addr btcutil.Address) error { addrs =...
[ "func", "(", "w", "*", "Wallet", ")", "activeData", "(", "dbtx", "walletdb", ".", "ReadTx", ")", "(", "[", "]", "btcutil", ".", "Address", ",", "[", "]", "wtxmgr", ".", "Credit", ",", "error", ")", "{", "addrmgrNs", ":=", "dbtx", ".", "ReadBucket", ...
// activeData returns the currently-active receiving addresses and all unspent // outputs. This is primarely intended to provide the parameters for a // rescan request.
[ "activeData", "returns", "the", "currently", "-", "active", "receiving", "addresses", "and", "all", "unspent", "outputs", ".", "This", "is", "primarely", "intended", "to", "provide", "the", "parameters", "for", "a", "rescan", "request", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L304-L318
train
btcsuite/btcwallet
wallet/wallet.go
syncWithChain
func (w *Wallet) syncWithChain(birthdayStamp *waddrmgr.BlockStamp) error { // To start, if we've yet to find our birthday stamp, we'll do so now. if birthdayStamp == nil { var err error birthdayStamp, err = w.syncToBirthday() if err != nil { return err } } // If the wallet requested an on-chain recovery...
go
func (w *Wallet) syncWithChain(birthdayStamp *waddrmgr.BlockStamp) error { // To start, if we've yet to find our birthday stamp, we'll do so now. if birthdayStamp == nil { var err error birthdayStamp, err = w.syncToBirthday() if err != nil { return err } } // If the wallet requested an on-chain recovery...
[ "func", "(", "w", "*", "Wallet", ")", "syncWithChain", "(", "birthdayStamp", "*", "waddrmgr", ".", "BlockStamp", ")", "error", "{", "// To start, if we've yet to find our birthday stamp, we'll do so now.", "if", "birthdayStamp", "==", "nil", "{", "var", "err", "error"...
// syncWithChain brings the wallet up to date with the current chain server // connection. It creates a rescan request and blocks until the rescan has // finished. The birthday block can be passed in, if set, to ensure we can // properly detect if it gets rolled back.
[ "syncWithChain", "brings", "the", "wallet", "up", "to", "date", "with", "the", "current", "chain", "server", "connection", ".", "It", "creates", "a", "rescan", "request", "and", "blocks", "until", "the", "rescan", "has", "finished", ".", "The", "birthday", "...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L324-L451
train
btcsuite/btcwallet
wallet/wallet.go
scanChain
func (w *Wallet) scanChain(startHeight int32, onBlock func(int32, *chainhash.Hash, *wire.BlockHeader) error) error { chainClient, err := w.requireChainClient() if err != nil { return err } // isCurrent is a helper function that we'll use to determine if the // chain backend is currently synced. When running w...
go
func (w *Wallet) scanChain(startHeight int32, onBlock func(int32, *chainhash.Hash, *wire.BlockHeader) error) error { chainClient, err := w.requireChainClient() if err != nil { return err } // isCurrent is a helper function that we'll use to determine if the // chain backend is currently synced. When running w...
[ "func", "(", "w", "*", "Wallet", ")", "scanChain", "(", "startHeight", "int32", ",", "onBlock", "func", "(", "int32", ",", "*", "chainhash", ".", "Hash", ",", "*", "wire", ".", "BlockHeader", ")", "error", ")", "error", "{", "chainClient", ",", "err", ...
// scanChain is a helper method that scans the chain from the starting height // until the tip of the chain. The onBlock callback can be used to perform // certain operations for every block that we process as we scan the chain.
[ "scanChain", "is", "a", "helper", "method", "that", "scans", "the", "chain", "from", "the", "starting", "height", "until", "the", "tip", "of", "the", "chain", ".", "The", "onBlock", "callback", "can", "be", "used", "to", "perform", "certain", "operations", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L468-L539
train
btcsuite/btcwallet
wallet/wallet.go
syncToBirthday
func (w *Wallet) syncToBirthday() (*waddrmgr.BlockStamp, error) { var birthdayStamp *waddrmgr.BlockStamp birthday := w.Manager.Birthday() tx, err := w.db.BeginReadWriteTx() if err != nil { return nil, err } ns := tx.ReadWriteBucket(waddrmgrNamespaceKey) // We'll begin scanning the chain from our last sync po...
go
func (w *Wallet) syncToBirthday() (*waddrmgr.BlockStamp, error) { var birthdayStamp *waddrmgr.BlockStamp birthday := w.Manager.Birthday() tx, err := w.db.BeginReadWriteTx() if err != nil { return nil, err } ns := tx.ReadWriteBucket(waddrmgrNamespaceKey) // We'll begin scanning the chain from our last sync po...
[ "func", "(", "w", "*", "Wallet", ")", "syncToBirthday", "(", ")", "(", "*", "waddrmgr", ".", "BlockStamp", ",", "error", ")", "{", "var", "birthdayStamp", "*", "waddrmgr", ".", "BlockStamp", "\n", "birthday", ":=", "w", ".", "Manager", ".", "Birthday", ...
// syncToBirthday attempts to sync the wallet's point of view of the chain until // it finds the first block whose timestamp is above the wallet's birthday. The // wallet's birthday is already two days in the past of its actual birthday, so // this is relatively safe to do.
[ "syncToBirthday", "attempts", "to", "sync", "the", "wallet", "s", "point", "of", "view", "of", "the", "chain", "until", "it", "finds", "the", "first", "block", "whose", "timestamp", "is", "above", "the", "wallet", "s", "birthday", ".", "The", "wallet", "s"...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L545-L646
train
btcsuite/btcwallet
wallet/wallet.go
defaultScopeManagers
func (w *Wallet) defaultScopeManagers() ( map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager, error) { scopedMgrs := make(map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager) for _, scope := range waddrmgr.DefaultKeyScopes { scopedMgr, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err ...
go
func (w *Wallet) defaultScopeManagers() ( map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager, error) { scopedMgrs := make(map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager) for _, scope := range waddrmgr.DefaultKeyScopes { scopedMgr, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err ...
[ "func", "(", "w", "*", "Wallet", ")", "defaultScopeManagers", "(", ")", "(", "map", "[", "waddrmgr", ".", "KeyScope", "]", "*", "waddrmgr", ".", "ScopedKeyManager", ",", "error", ")", "{", "scopedMgrs", ":=", "make", "(", "map", "[", "waddrmgr", ".", "...
// defaultScopeManagers fetches the ScopedKeyManagers from the wallet using the // default set of key scopes.
[ "defaultScopeManagers", "fetches", "the", "ScopedKeyManagers", "from", "the", "wallet", "using", "the", "default", "set", "of", "key", "scopes", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L776-L790
train
btcsuite/btcwallet
wallet/wallet.go
expandScopeHorizons
func expandScopeHorizons(ns walletdb.ReadWriteBucket, scopedMgr *waddrmgr.ScopedKeyManager, scopeState *ScopeRecoveryState) error { // Compute the current external horizon and the number of addresses we // must derive to ensure we maintain a sufficient recovery window for // the external branch. exHorizon, exWin...
go
func expandScopeHorizons(ns walletdb.ReadWriteBucket, scopedMgr *waddrmgr.ScopedKeyManager, scopeState *ScopeRecoveryState) error { // Compute the current external horizon and the number of addresses we // must derive to ensure we maintain a sufficient recovery window for // the external branch. exHorizon, exWin...
[ "func", "expandScopeHorizons", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "scopedMgr", "*", "waddrmgr", ".", "ScopedKeyManager", ",", "scopeState", "*", "ScopeRecoveryState", ")", "error", "{", "// Compute the current external horizon and the number of addresses we",...
// expandScopeHorizons ensures that the ScopeRecoveryState has an adequately // sized look ahead for both its internal and external branches. The keys // derived here are added to the scope's recovery state, but do not affect the // persistent state of the wallet. If any invalid child keys are detected, the // horizon ...
[ "expandScopeHorizons", "ensures", "that", "the", "ScopeRecoveryState", "has", "an", "adequately", "sized", "look", "ahead", "for", "both", "its", "internal", "and", "external", "branches", ".", "The", "keys", "derived", "here", "are", "added", "to", "the", "scop...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L927-L992
train
btcsuite/btcwallet
wallet/wallet.go
newFilterBlocksRequest
func newFilterBlocksRequest(batch []wtxmgr.BlockMeta, scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager, recoveryState *RecoveryState) *chain.FilterBlocksRequest { filterReq := &chain.FilterBlocksRequest{ Blocks: batch, ExternalAddrs: make(map[waddrmgr.ScopedIndex]btcutil.Address), Inte...
go
func newFilterBlocksRequest(batch []wtxmgr.BlockMeta, scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager, recoveryState *RecoveryState) *chain.FilterBlocksRequest { filterReq := &chain.FilterBlocksRequest{ Blocks: batch, ExternalAddrs: make(map[waddrmgr.ScopedIndex]btcutil.Address), Inte...
[ "func", "newFilterBlocksRequest", "(", "batch", "[", "]", "wtxmgr", ".", "BlockMeta", ",", "scopedMgrs", "map", "[", "waddrmgr", ".", "KeyScope", "]", "*", "waddrmgr", ".", "ScopedKeyManager", ",", "recoveryState", "*", "RecoveryState", ")", "*", "chain", ".",...
// newFilterBlocksRequest constructs FilterBlocksRequests using our current // block range, scoped managers, and recovery state.
[ "newFilterBlocksRequest", "constructs", "FilterBlocksRequests", "using", "our", "current", "block", "range", "scoped", "managers", "and", "recovery", "state", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1014-L1046
train
btcsuite/btcwallet
wallet/wallet.go
extendFoundAddresses
func extendFoundAddresses(ns walletdb.ReadWriteBucket, filterResp *chain.FilterBlocksResponse, scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager, recoveryState *RecoveryState) error { // Mark all recovered external addresses as used. This will be done only // for scopes that reported a non-zero number o...
go
func extendFoundAddresses(ns walletdb.ReadWriteBucket, filterResp *chain.FilterBlocksResponse, scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager, recoveryState *RecoveryState) error { // Mark all recovered external addresses as used. This will be done only // for scopes that reported a non-zero number o...
[ "func", "extendFoundAddresses", "(", "ns", "walletdb", ".", "ReadWriteBucket", ",", "filterResp", "*", "chain", ".", "FilterBlocksResponse", ",", "scopedMgrs", "map", "[", "waddrmgr", ".", "KeyScope", "]", "*", "waddrmgr", ".", "ScopedKeyManager", ",", "recoverySt...
// extendFoundAddresses accepts a filter blocks response that contains addresses // found on chain, and advances the state of all relevant derivation paths to // match the highest found child index for each branch.
[ "extendFoundAddresses", "accepts", "a", "filter", "blocks", "response", "that", "contains", "addresses", "found", "on", "chain", "and", "advances", "the", "state", "of", "all", "relevant", "derivation", "paths", "to", "match", "the", "highest", "found", "child", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1051-L1142
train
btcsuite/btcwallet
wallet/wallet.go
logFilterBlocksResp
func logFilterBlocksResp(block wtxmgr.BlockMeta, resp *chain.FilterBlocksResponse) { // Log the number of external addresses found in this block. var nFoundExternal int for _, indexes := range resp.FoundExternalAddrs { nFoundExternal += len(indexes) } if nFoundExternal > 0 { log.Infof("Recovered %d external ...
go
func logFilterBlocksResp(block wtxmgr.BlockMeta, resp *chain.FilterBlocksResponse) { // Log the number of external addresses found in this block. var nFoundExternal int for _, indexes := range resp.FoundExternalAddrs { nFoundExternal += len(indexes) } if nFoundExternal > 0 { log.Infof("Recovered %d external ...
[ "func", "logFilterBlocksResp", "(", "block", "wtxmgr", ".", "BlockMeta", ",", "resp", "*", "chain", ".", "FilterBlocksResponse", ")", "{", "// Log the number of external addresses found in this block.", "var", "nFoundExternal", "int", "\n", "for", "_", ",", "indexes", ...
// logFilterBlocksResp provides useful logging information when filtering // succeeded in finding relevant transactions.
[ "logFilterBlocksResp", "provides", "useful", "logging", "information", "when", "filtering", "succeeded", "in", "finding", "relevant", "transactions", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1146-L1176
train
btcsuite/btcwallet
wallet/wallet.go
Unlock
func (w *Wallet) Unlock(passphrase []byte, lock <-chan time.Time) error { err := make(chan error, 1) w.unlockRequests <- unlockRequest{ passphrase: passphrase, lockAfter: lock, err: err, } return <-err }
go
func (w *Wallet) Unlock(passphrase []byte, lock <-chan time.Time) error { err := make(chan error, 1) w.unlockRequests <- unlockRequest{ passphrase: passphrase, lockAfter: lock, err: err, } return <-err }
[ "func", "(", "w", "*", "Wallet", ")", "Unlock", "(", "passphrase", "[", "]", "byte", ",", "lock", "<-", "chan", "time", ".", "Time", ")", "error", "{", "err", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "w", ".", "unlockRequests", "<...
// Unlock unlocks the wallet's address manager and relocks it after timeout has // expired. If the wallet is already unlocked and the new passphrase is // correct, the current timeout is replaced with the new one. The wallet will // be locked if the passphrase is incorrect or any other error occurs during the // unlo...
[ "Unlock", "unlocks", "the", "wallet", "s", "address", "manager", "and", "relocks", "it", "after", "timeout", "has", "expired", ".", "If", "the", "wallet", "is", "already", "unlocked", "and", "the", "new", "passphrase", "is", "correct", "the", "current", "tim...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1383-L1391
train
btcsuite/btcwallet
wallet/wallet.go
ChangePrivatePassphrase
func (w *Wallet) ChangePrivatePassphrase(old, new []byte) error { err := make(chan error, 1) w.changePassphrase <- changePassphraseRequest{ old: old, new: new, private: true, err: err, } return <-err }
go
func (w *Wallet) ChangePrivatePassphrase(old, new []byte) error { err := make(chan error, 1) w.changePassphrase <- changePassphraseRequest{ old: old, new: new, private: true, err: err, } return <-err }
[ "func", "(", "w", "*", "Wallet", ")", "ChangePrivatePassphrase", "(", "old", ",", "new", "[", "]", "byte", ")", "error", "{", "err", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "w", ".", "changePassphrase", "<-", "changePassphraseRequest", ...
// ChangePrivatePassphrase attempts to change the passphrase for a wallet from // old to new. Changing the passphrase is synchronized with all other address // manager locking and unlocking. The lock state will be the same as it was // before the password change.
[ "ChangePrivatePassphrase", "attempts", "to", "change", "the", "passphrase", "for", "a", "wallet", "from", "old", "to", "new", ".", "Changing", "the", "passphrase", "is", "synchronized", "with", "all", "other", "address", "manager", "locking", "and", "unlocking", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1435-L1444
train
btcsuite/btcwallet
wallet/wallet.go
ChangePublicPassphrase
func (w *Wallet) ChangePublicPassphrase(old, new []byte) error { err := make(chan error, 1) w.changePassphrase <- changePassphraseRequest{ old: old, new: new, private: false, err: err, } return <-err }
go
func (w *Wallet) ChangePublicPassphrase(old, new []byte) error { err := make(chan error, 1) w.changePassphrase <- changePassphraseRequest{ old: old, new: new, private: false, err: err, } return <-err }
[ "func", "(", "w", "*", "Wallet", ")", "ChangePublicPassphrase", "(", "old", ",", "new", "[", "]", "byte", ")", "error", "{", "err", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "w", ".", "changePassphrase", "<-", "changePassphraseRequest", ...
// ChangePublicPassphrase modifies the public passphrase of the wallet.
[ "ChangePublicPassphrase", "modifies", "the", "public", "passphrase", "of", "the", "wallet", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1447-L1456
train
btcsuite/btcwallet
wallet/wallet.go
ChangePassphrases
func (w *Wallet) ChangePassphrases(publicOld, publicNew, privateOld, privateNew []byte) error { err := make(chan error, 1) w.changePassphrases <- changePassphrasesRequest{ publicOld: publicOld, publicNew: publicNew, privateOld: privateOld, privateNew: privateNew, err: err, } return <-err }
go
func (w *Wallet) ChangePassphrases(publicOld, publicNew, privateOld, privateNew []byte) error { err := make(chan error, 1) w.changePassphrases <- changePassphrasesRequest{ publicOld: publicOld, publicNew: publicNew, privateOld: privateOld, privateNew: privateNew, err: err, } return <-err }
[ "func", "(", "w", "*", "Wallet", ")", "ChangePassphrases", "(", "publicOld", ",", "publicNew", ",", "privateOld", ",", "privateNew", "[", "]", "byte", ")", "error", "{", "err", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "w", ".", "chang...
// ChangePassphrases modifies the public and private passphrase of the wallet // atomically.
[ "ChangePassphrases", "modifies", "the", "public", "and", "private", "passphrase", "of", "the", "wallet", "atomically", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1460-L1472
train
btcsuite/btcwallet
wallet/wallet.go
accountUsed
func (w *Wallet) accountUsed(addrmgrNs walletdb.ReadWriteBucket, account uint32) (bool, error) { var used bool err := w.Manager.ForEachAccountAddress(addrmgrNs, account, func(maddr waddrmgr.ManagedAddress) error { used = maddr.Used(addrmgrNs) if used { return waddrmgr.Break } return nil }) if err...
go
func (w *Wallet) accountUsed(addrmgrNs walletdb.ReadWriteBucket, account uint32) (bool, error) { var used bool err := w.Manager.ForEachAccountAddress(addrmgrNs, account, func(maddr waddrmgr.ManagedAddress) error { used = maddr.Used(addrmgrNs) if used { return waddrmgr.Break } return nil }) if err...
[ "func", "(", "w", "*", "Wallet", ")", "accountUsed", "(", "addrmgrNs", "walletdb", ".", "ReadWriteBucket", ",", "account", "uint32", ")", "(", "bool", ",", "error", ")", "{", "var", "used", "bool", "\n", "err", ":=", "w", ".", "Manager", ".", "ForEachA...
// accountUsed returns whether there are any recorded transactions spending to // a given account. It returns true if atleast one address in the account was // used and false if no address in the account was used.
[ "accountUsed", "returns", "whether", "there", "are", "any", "recorded", "transactions", "spending", "to", "a", "given", "account", ".", "It", "returns", "true", "if", "atleast", "one", "address", "in", "the", "account", "was", "used", "and", "false", "if", "...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1477-L1491
train
btcsuite/btcwallet
wallet/wallet.go
AccountAddresses
func (w *Wallet) AccountAddresses(account uint32) (addrs []btcutil.Address, err error) { err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) return w.Manager.ForEachAccountAddress(addrmgrNs, account, func(maddr waddrmgr.ManagedAddress) error { addrs = appe...
go
func (w *Wallet) AccountAddresses(account uint32) (addrs []btcutil.Address, err error) { err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) return w.Manager.ForEachAccountAddress(addrmgrNs, account, func(maddr waddrmgr.ManagedAddress) error { addrs = appe...
[ "func", "(", "w", "*", "Wallet", ")", "AccountAddresses", "(", "account", "uint32", ")", "(", "addrs", "[", "]", "btcutil", ".", "Address", ",", "err", "error", ")", "{", "err", "=", "walletdb", ".", "View", "(", "w", ".", "db", ",", "func", "(", ...
// AccountAddresses returns the addresses for every created address for an // account.
[ "AccountAddresses", "returns", "the", "addresses", "for", "every", "created", "address", "for", "an", "account", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1495-L1504
train
btcsuite/btcwallet
wallet/wallet.go
CalculateAccountBalances
func (w *Wallet) CalculateAccountBalances(account uint32, confirms int32) (Balances, error) { var bals Balances err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) // Get current block. The block height used ...
go
func (w *Wallet) CalculateAccountBalances(account uint32, confirms int32) (Balances, error) { var bals Balances err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) // Get current block. The block height used ...
[ "func", "(", "w", "*", "Wallet", ")", "CalculateAccountBalances", "(", "account", "uint32", ",", "confirms", "int32", ")", "(", "Balances", ",", "error", ")", "{", "var", "bals", "Balances", "\n", "err", ":=", "walletdb", ".", "View", "(", "w", ".", "d...
// CalculateAccountBalances sums the amounts of all unspent transaction // outputs to the given account of a wallet and returns the balance. // // This function is much slower than it needs to be since transactions outputs // are not indexed by the accounts they credit to, and all unspent transaction // outputs must be...
[ "CalculateAccountBalances", "sums", "the", "amounts", "of", "all", "unspent", "transaction", "outputs", "to", "the", "given", "account", "of", "a", "wallet", "and", "returns", "the", "balance", ".", "This", "function", "is", "much", "slower", "than", "it", "ne...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1540-L1578
train
btcsuite/btcwallet
wallet/wallet.go
PubKeyForAddress
func (w *Wallet) PubKeyForAddress(a btcutil.Address) (*btcec.PublicKey, error) { var pubKey *btcec.PublicKey err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) managedAddr, err := w.Manager.Address(addrmgrNs, a) if err != nil { return err } manage...
go
func (w *Wallet) PubKeyForAddress(a btcutil.Address) (*btcec.PublicKey, error) { var pubKey *btcec.PublicKey err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) managedAddr, err := w.Manager.Address(addrmgrNs, a) if err != nil { return err } manage...
[ "func", "(", "w", "*", "Wallet", ")", "PubKeyForAddress", "(", "a", "btcutil", ".", "Address", ")", "(", "*", "btcec", ".", "PublicKey", ",", "error", ")", "{", "var", "pubKey", "*", "btcec", ".", "PublicKey", "\n", "err", ":=", "walletdb", ".", "Vie...
// PubKeyForAddress looks up the associated public key for a P2PKH address.
[ "PubKeyForAddress", "looks", "up", "the", "associated", "public", "key", "for", "a", "P2PKH", "address", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1644-L1660
train
btcsuite/btcwallet
wallet/wallet.go
PrivKeyForAddress
func (w *Wallet) PrivKeyForAddress(a btcutil.Address) (*btcec.PrivateKey, error) { var privKey *btcec.PrivateKey err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) managedAddr, err := w.Manager.Address(addrmgrNs, a) if err != nil { return err } ma...
go
func (w *Wallet) PrivKeyForAddress(a btcutil.Address) (*btcec.PrivateKey, error) { var privKey *btcec.PrivateKey err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) managedAddr, err := w.Manager.Address(addrmgrNs, a) if err != nil { return err } ma...
[ "func", "(", "w", "*", "Wallet", ")", "PrivKeyForAddress", "(", "a", "btcutil", ".", "Address", ")", "(", "*", "btcec", ".", "PrivateKey", ",", "error", ")", "{", "var", "privKey", "*", "btcec", ".", "PrivateKey", "\n", "err", ":=", "walletdb", ".", ...
// PrivKeyForAddress looks up the associated private key for a P2PKH or P2PK // address.
[ "PrivKeyForAddress", "looks", "up", "the", "associated", "private", "key", "for", "a", "P2PKH", "or", "P2PK", "address", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1664-L1680
train
btcsuite/btcwallet
wallet/wallet.go
HaveAddress
func (w *Wallet) HaveAddress(a btcutil.Address) (bool, error) { err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) _, err := w.Manager.Address(addrmgrNs, a) return err }) if err == nil { return true, nil } if waddrmgr.IsError(err, waddrmgr.ErrAddres...
go
func (w *Wallet) HaveAddress(a btcutil.Address) (bool, error) { err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) _, err := w.Manager.Address(addrmgrNs, a) return err }) if err == nil { return true, nil } if waddrmgr.IsError(err, waddrmgr.ErrAddres...
[ "func", "(", "w", "*", "Wallet", ")", "HaveAddress", "(", "a", "btcutil", ".", "Address", ")", "(", "bool", ",", "error", ")", "{", "err", ":=", "walletdb", ".", "View", "(", "w", ".", "db", ",", "func", "(", "tx", "walletdb", ".", "ReadTx", ")",...
// HaveAddress returns whether the wallet is the owner of the address a.
[ "HaveAddress", "returns", "whether", "the", "wallet", "is", "the", "owner", "of", "the", "address", "a", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1683-L1696
train
btcsuite/btcwallet
wallet/wallet.go
AccountOfAddress
func (w *Wallet) AccountOfAddress(a btcutil.Address) (uint32, error) { var account uint32 err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) var err error _, account, err = w.Manager.AddrAccount(addrmgrNs, a) return err }) return account, err }
go
func (w *Wallet) AccountOfAddress(a btcutil.Address) (uint32, error) { var account uint32 err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) var err error _, account, err = w.Manager.AddrAccount(addrmgrNs, a) return err }) return account, err }
[ "func", "(", "w", "*", "Wallet", ")", "AccountOfAddress", "(", "a", "btcutil", ".", "Address", ")", "(", "uint32", ",", "error", ")", "{", "var", "account", "uint32", "\n", "err", ":=", "walletdb", ".", "View", "(", "w", ".", "db", ",", "func", "("...
// AccountOfAddress finds the account that an address is associated with.
[ "AccountOfAddress", "finds", "the", "account", "that", "an", "address", "is", "associated", "with", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1699-L1708
train
btcsuite/btcwallet
wallet/wallet.go
AddressInfo
func (w *Wallet) AddressInfo(a btcutil.Address) (waddrmgr.ManagedAddress, error) { var managedAddress waddrmgr.ManagedAddress err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) var err error managedAddress, err = w.Manager.Address(addrmgrNs, a) return ...
go
func (w *Wallet) AddressInfo(a btcutil.Address) (waddrmgr.ManagedAddress, error) { var managedAddress waddrmgr.ManagedAddress err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) var err error managedAddress, err = w.Manager.Address(addrmgrNs, a) return ...
[ "func", "(", "w", "*", "Wallet", ")", "AddressInfo", "(", "a", "btcutil", ".", "Address", ")", "(", "waddrmgr", ".", "ManagedAddress", ",", "error", ")", "{", "var", "managedAddress", "waddrmgr", ".", "ManagedAddress", "\n", "err", ":=", "walletdb", ".", ...
// AddressInfo returns detailed information regarding a wallet address.
[ "AddressInfo", "returns", "detailed", "information", "regarding", "a", "wallet", "address", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1711-L1720
train
btcsuite/btcwallet
wallet/wallet.go
AccountNumber
func (w *Wallet) AccountNumber(scope waddrmgr.KeyScope, accountName string) (uint32, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return 0, err } var account uint32 err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) ...
go
func (w *Wallet) AccountNumber(scope waddrmgr.KeyScope, accountName string) (uint32, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return 0, err } var account uint32 err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) ...
[ "func", "(", "w", "*", "Wallet", ")", "AccountNumber", "(", "scope", "waddrmgr", ".", "KeyScope", ",", "accountName", "string", ")", "(", "uint32", ",", "error", ")", "{", "manager", ",", "err", ":=", "w", ".", "Manager", ".", "FetchScopedKeyManager", "(...
// AccountNumber returns the account number for an account name under a // particular key scope.
[ "AccountNumber", "returns", "the", "account", "number", "for", "an", "account", "name", "under", "a", "particular", "key", "scope", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1724-L1738
train
btcsuite/btcwallet
wallet/wallet.go
AccountProperties
func (w *Wallet) AccountProperties(scope waddrmgr.KeyScope, acct uint32) (*waddrmgr.AccountProperties, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err } var props *waddrmgr.AccountProperties err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { waddrmgrNs :...
go
func (w *Wallet) AccountProperties(scope waddrmgr.KeyScope, acct uint32) (*waddrmgr.AccountProperties, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err } var props *waddrmgr.AccountProperties err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { waddrmgrNs :...
[ "func", "(", "w", "*", "Wallet", ")", "AccountProperties", "(", "scope", "waddrmgr", ".", "KeyScope", ",", "acct", "uint32", ")", "(", "*", "waddrmgr", ".", "AccountProperties", ",", "error", ")", "{", "manager", ",", "err", ":=", "w", ".", "Manager", ...
// AccountProperties returns the properties of an account, including address // indexes and name. It first fetches the desynced information from the address // manager, then updates the indexes based on the address pools.
[ "AccountProperties", "returns", "the", "properties", "of", "an", "account", "including", "address", "indexes", "and", "name", ".", "It", "first", "fetches", "the", "desynced", "information", "from", "the", "address", "manager", "then", "updates", "the", "indexes",...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1760-L1774
train
btcsuite/btcwallet
wallet/wallet.go
RenameAccount
func (w *Wallet) RenameAccount(scope waddrmgr.KeyScope, account uint32, newName string) error { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return err } var props *waddrmgr.AccountProperties err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error { addrmgrNs := tx.ReadWriteB...
go
func (w *Wallet) RenameAccount(scope waddrmgr.KeyScope, account uint32, newName string) error { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return err } var props *waddrmgr.AccountProperties err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error { addrmgrNs := tx.ReadWriteB...
[ "func", "(", "w", "*", "Wallet", ")", "RenameAccount", "(", "scope", "waddrmgr", ".", "KeyScope", ",", "account", "uint32", ",", "newName", "string", ")", "error", "{", "manager", ",", "err", ":=", "w", ".", "Manager", ".", "FetchScopedKeyManager", "(", ...
// RenameAccount sets the name for an account number to newName.
[ "RenameAccount", "sets", "the", "name", "for", "an", "account", "number", "to", "newName", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L1777-L1797
train
btcsuite/btcwallet
wallet/wallet.go
ListSinceBlock
func (w *Wallet) ListSinceBlock(start, end, syncHeight int32) ([]btcjson.ListTransactionsResult, error) { txList := []btcjson.ListTransactionsResult{} err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) rangeFn := func(details []wtxmgr.TxDetails) (bool, error)...
go
func (w *Wallet) ListSinceBlock(start, end, syncHeight int32) ([]btcjson.ListTransactionsResult, error) { txList := []btcjson.ListTransactionsResult{} err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) rangeFn := func(details []wtxmgr.TxDetails) (bool, error)...
[ "func", "(", "w", "*", "Wallet", ")", "ListSinceBlock", "(", "start", ",", "end", ",", "syncHeight", "int32", ")", "(", "[", "]", "btcjson", ".", "ListTransactionsResult", ",", "error", ")", "{", "txList", ":=", "[", "]", "btcjson", ".", "ListTransaction...
// ListSinceBlock returns a slice of objects with details about transactions // since the given block. If the block is -1 then all transactions are included. // This is intended to be used for listsinceblock RPC replies.
[ "ListSinceBlock", "returns", "a", "slice", "of", "objects", "with", "details", "about", "transactions", "since", "the", "given", "block", ".", "If", "the", "block", "is", "-", "1", "then", "all", "transactions", "are", "included", ".", "This", "is", "intende...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2014-L2031
train
btcsuite/btcwallet
wallet/wallet.go
ListTransactions
func (w *Wallet) ListTransactions(from, count int) ([]btcjson.ListTransactionsResult, error) { txList := []btcjson.ListTransactionsResult{} err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) // Get current block. The block height used for calculating // t...
go
func (w *Wallet) ListTransactions(from, count int) ([]btcjson.ListTransactionsResult, error) { txList := []btcjson.ListTransactionsResult{} err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) // Get current block. The block height used for calculating // t...
[ "func", "(", "w", "*", "Wallet", ")", "ListTransactions", "(", "from", ",", "count", "int", ")", "(", "[", "]", "btcjson", ".", "ListTransactionsResult", ",", "error", ")", "{", "txList", ":=", "[", "]", "btcjson", ".", "ListTransactionsResult", "{", "}"...
// ListTransactions returns a slice of objects with details about a recorded // transaction. This is intended to be used for listtransactions RPC // replies.
[ "ListTransactions", "returns", "a", "slice", "of", "objects", "with", "details", "about", "a", "recorded", "transaction", ".", "This", "is", "intended", "to", "be", "used", "for", "listtransactions", "RPC", "replies", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2036-L2084
train
btcsuite/btcwallet
wallet/wallet.go
ListAddressTransactions
func (w *Wallet) ListAddressTransactions(pkHashes map[string]struct{}) ([]btcjson.ListTransactionsResult, error) { txList := []btcjson.ListTransactionsResult{} err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) // Get current block. The block height used for...
go
func (w *Wallet) ListAddressTransactions(pkHashes map[string]struct{}) ([]btcjson.ListTransactionsResult, error) { txList := []btcjson.ListTransactionsResult{} err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) // Get current block. The block height used for...
[ "func", "(", "w", "*", "Wallet", ")", "ListAddressTransactions", "(", "pkHashes", "map", "[", "string", "]", "struct", "{", "}", ")", "(", "[", "]", "btcjson", ".", "ListTransactionsResult", ",", "error", ")", "{", "txList", ":=", "[", "]", "btcjson", ...
// ListAddressTransactions returns a slice of objects with details about // recorded transactions to or from any address belonging to a set. This is // intended to be used for listaddresstransactions RPC replies.
[ "ListAddressTransactions", "returns", "a", "slice", "of", "objects", "with", "details", "about", "recorded", "transactions", "to", "or", "from", "any", "address", "belonging", "to", "a", "set", ".", "This", "is", "intended", "to", "be", "used", "for", "listadd...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2089-L2133
train
btcsuite/btcwallet
wallet/wallet.go
AccountBalances
func (w *Wallet) AccountBalances(scope waddrmgr.KeyScope, requiredConfs int32) ([]AccountBalanceResult, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err } var results []AccountBalanceResult err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs :=...
go
func (w *Wallet) AccountBalances(scope waddrmgr.KeyScope, requiredConfs int32) ([]AccountBalanceResult, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err } var results []AccountBalanceResult err = walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs :=...
[ "func", "(", "w", "*", "Wallet", ")", "AccountBalances", "(", "scope", "waddrmgr", ".", "KeyScope", ",", "requiredConfs", "int32", ")", "(", "[", "]", "AccountBalanceResult", ",", "error", ")", "{", "manager", ",", "err", ":=", "w", ".", "Manager", ".", ...
// AccountBalances returns all accounts in the wallet and their balances. // Balances are determined by excluding transactions that have not met // requiredConfs confirmations.
[ "AccountBalances", "returns", "all", "accounts", "in", "the", "wallet", "and", "their", "balances", ".", "Balances", "are", "determined", "by", "excluding", "transactions", "that", "have", "not", "met", "requiredConfs", "confirmations", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2406-L2475
train
btcsuite/btcwallet
wallet/wallet.go
DumpPrivKeys
func (w *Wallet) DumpPrivKeys() ([]string, error) { var privkeys []string err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) // Iterate over each active address, appending the private key to // privkeys. return w.Manager.ForEachActiveAddress(addrmgrNs,...
go
func (w *Wallet) DumpPrivKeys() ([]string, error) { var privkeys []string err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) // Iterate over each active address, appending the private key to // privkeys. return w.Manager.ForEachActiveAddress(addrmgrNs,...
[ "func", "(", "w", "*", "Wallet", ")", "DumpPrivKeys", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "privkeys", "[", "]", "string", "\n", "err", ":=", "walletdb", ".", "View", "(", "w", ".", "db", ",", "func", "(", "tx", "wa...
// DumpPrivKeys returns the WIF-encoded private keys for all addresses with // private keys in a wallet.
[ "DumpPrivKeys", "returns", "the", "WIF", "-", "encoded", "private", "keys", "for", "all", "addresses", "with", "private", "keys", "in", "a", "wallet", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2657-L2687
train
btcsuite/btcwallet
wallet/wallet.go
DumpWIFPrivateKey
func (w *Wallet) DumpWIFPrivateKey(addr btcutil.Address) (string, error) { var maddr waddrmgr.ManagedAddress err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { waddrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) // Get private key from wallet if it exists. var err error maddr, err = w.Manager.Address(w...
go
func (w *Wallet) DumpWIFPrivateKey(addr btcutil.Address) (string, error) { var maddr waddrmgr.ManagedAddress err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { waddrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) // Get private key from wallet if it exists. var err error maddr, err = w.Manager.Address(w...
[ "func", "(", "w", "*", "Wallet", ")", "DumpWIFPrivateKey", "(", "addr", "btcutil", ".", "Address", ")", "(", "string", ",", "error", ")", "{", "var", "maddr", "waddrmgr", ".", "ManagedAddress", "\n", "err", ":=", "walletdb", ".", "View", "(", "w", ".",...
// DumpWIFPrivateKey returns the WIF encoded private key for a // single wallet address.
[ "DumpWIFPrivateKey", "returns", "the", "WIF", "encoded", "private", "key", "for", "a", "single", "wallet", "address", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2691-L2714
train
btcsuite/btcwallet
wallet/wallet.go
LockedOutpoint
func (w *Wallet) LockedOutpoint(op wire.OutPoint) bool { _, locked := w.lockedOutpoints[op] return locked }
go
func (w *Wallet) LockedOutpoint(op wire.OutPoint) bool { _, locked := w.lockedOutpoints[op] return locked }
[ "func", "(", "w", "*", "Wallet", ")", "LockedOutpoint", "(", "op", "wire", ".", "OutPoint", ")", "bool", "{", "_", ",", "locked", ":=", "w", ".", "lockedOutpoints", "[", "op", "]", "\n", "return", "locked", "\n", "}" ]
// LockedOutpoint returns whether an outpoint has been marked as locked and // should not be used as an input for created transactions.
[ "LockedOutpoint", "returns", "whether", "an", "outpoint", "has", "been", "marked", "as", "locked", "and", "should", "not", "be", "used", "as", "an", "input", "for", "created", "transactions", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2822-L2825
train
btcsuite/btcwallet
wallet/wallet.go
UnlockOutpoint
func (w *Wallet) UnlockOutpoint(op wire.OutPoint) { delete(w.lockedOutpoints, op) }
go
func (w *Wallet) UnlockOutpoint(op wire.OutPoint) { delete(w.lockedOutpoints, op) }
[ "func", "(", "w", "*", "Wallet", ")", "UnlockOutpoint", "(", "op", "wire", ".", "OutPoint", ")", "{", "delete", "(", "w", ".", "lockedOutpoints", ",", "op", ")", "\n", "}" ]
// UnlockOutpoint marks an outpoint as unlocked, that is, it may be used as an // input for newly created transactions.
[ "UnlockOutpoint", "marks", "an", "outpoint", "as", "unlocked", "that", "is", "it", "may", "be", "used", "as", "an", "input", "for", "newly", "created", "transactions", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2835-L2837
train
btcsuite/btcwallet
wallet/wallet.go
LockedOutpoints
func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput { locked := make([]btcjson.TransactionInput, len(w.lockedOutpoints)) i := 0 for op := range w.lockedOutpoints { locked[i] = btcjson.TransactionInput{ Txid: op.Hash.String(), Vout: op.Index, } i++ } return locked }
go
func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput { locked := make([]btcjson.TransactionInput, len(w.lockedOutpoints)) i := 0 for op := range w.lockedOutpoints { locked[i] = btcjson.TransactionInput{ Txid: op.Hash.String(), Vout: op.Index, } i++ } return locked }
[ "func", "(", "w", "*", "Wallet", ")", "LockedOutpoints", "(", ")", "[", "]", "btcjson", ".", "TransactionInput", "{", "locked", ":=", "make", "(", "[", "]", "btcjson", ".", "TransactionInput", ",", "len", "(", "w", ".", "lockedOutpoints", ")", ")", "\n...
// LockedOutpoints returns a slice of currently locked outpoints. This is // intended to be used by marshaling the result as a JSON array for // listlockunspent RPC results.
[ "LockedOutpoints", "returns", "a", "slice", "of", "currently", "locked", "outpoints", ".", "This", "is", "intended", "to", "be", "used", "by", "marshaling", "the", "result", "as", "a", "JSON", "array", "for", "listlockunspent", "RPC", "results", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2848-L2859
train
btcsuite/btcwallet
wallet/wallet.go
resendUnminedTxs
func (w *Wallet) resendUnminedTxs() { var txs []*wire.MsgTx err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) var err error txs, err = w.TxStore.UnminedTxs(txmgrNs) return err }) if err != nil { log.Errorf("Unable to retrieve unconfirmed transactions ...
go
func (w *Wallet) resendUnminedTxs() { var txs []*wire.MsgTx err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) var err error txs, err = w.TxStore.UnminedTxs(txmgrNs) return err }) if err != nil { log.Errorf("Unable to retrieve unconfirmed transactions ...
[ "func", "(", "w", "*", "Wallet", ")", "resendUnminedTxs", "(", ")", "{", "var", "txs", "[", "]", "*", "wire", ".", "MsgTx", "\n", "err", ":=", "walletdb", ".", "View", "(", "w", ".", "db", ",", "func", "(", "tx", "walletdb", ".", "ReadTx", ")", ...
// resendUnminedTxs iterates through all transactions that spend from wallet // credits that are not known to have been mined into a block, and attempts // to send each to the chain server for relay.
[ "resendUnminedTxs", "iterates", "through", "all", "transactions", "that", "spend", "from", "wallet", "credits", "that", "are", "not", "known", "to", "have", "been", "mined", "into", "a", "block", "and", "attempts", "to", "send", "each", "to", "the", "chain", ...
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2864-L2889
train
btcsuite/btcwallet
wallet/wallet.go
SortedActivePaymentAddresses
func (w *Wallet) SortedActivePaymentAddresses() ([]string, error) { var addrStrs []string err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) return w.Manager.ForEachActiveAddress(addrmgrNs, func(addr btcutil.Address) error { addrStrs = append(addrStrs, ...
go
func (w *Wallet) SortedActivePaymentAddresses() ([]string, error) { var addrStrs []string err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { addrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey) return w.Manager.ForEachActiveAddress(addrmgrNs, func(addr btcutil.Address) error { addrStrs = append(addrStrs, ...
[ "func", "(", "w", "*", "Wallet", ")", "SortedActivePaymentAddresses", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "addrStrs", "[", "]", "string", "\n", "err", ":=", "walletdb", ".", "View", "(", "w", ".", "db", ",", "func", "(...
// SortedActivePaymentAddresses returns a slice of all active payment // addresses in a wallet.
[ "SortedActivePaymentAddresses", "returns", "a", "slice", "of", "all", "active", "payment", "addresses", "in", "a", "wallet", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2893-L2908
train
btcsuite/btcwallet
wallet/wallet.go
NewAddress
func (w *Wallet) NewAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) { chainClient, err := w.requireChainClient() if err != nil { return nil, err } var ( addr btcutil.Address props *waddrmgr.AccountProperties ) err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error { ...
go
func (w *Wallet) NewAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) { chainClient, err := w.requireChainClient() if err != nil { return nil, err } var ( addr btcutil.Address props *waddrmgr.AccountProperties ) err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error { ...
[ "func", "(", "w", "*", "Wallet", ")", "NewAddress", "(", "account", "uint32", ",", "scope", "waddrmgr", ".", "KeyScope", ")", "(", "btcutil", ".", "Address", ",", "error", ")", "{", "chainClient", ",", "err", ":=", "w", ".", "requireChainClient", "(", ...
// NewAddress returns the next external chained address for a wallet.
[ "NewAddress", "returns", "the", "next", "external", "chained", "address", "for", "a", "wallet", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2911-L2942
train
btcsuite/btcwallet
wallet/wallet.go
NewChangeAddress
func (w *Wallet) NewChangeAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) { chainClient, err := w.requireChainClient() if err != nil { return nil, err } var addr btcutil.Address err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error { addrmgrNs := tx.ReadWriteBucket(waddrm...
go
func (w *Wallet) NewChangeAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) { chainClient, err := w.requireChainClient() if err != nil { return nil, err } var addr btcutil.Address err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error { addrmgrNs := tx.ReadWriteBucket(waddrm...
[ "func", "(", "w", "*", "Wallet", ")", "NewChangeAddress", "(", "account", "uint32", ",", "scope", "waddrmgr", ".", "KeyScope", ")", "(", "btcutil", ".", "Address", ",", "error", ")", "{", "chainClient", ",", "err", ":=", "w", ".", "requireChainClient", "...
// NewChangeAddress returns a new change address for a wallet.
[ "NewChangeAddress", "returns", "a", "new", "change", "address", "for", "a", "wallet", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L2969-L2995
train
btcsuite/btcwallet
wallet/wallet.go
confirmed
func confirmed(minconf, txHeight, curHeight int32) bool { return confirms(txHeight, curHeight) >= minconf }
go
func confirmed(minconf, txHeight, curHeight int32) bool { return confirms(txHeight, curHeight) >= minconf }
[ "func", "confirmed", "(", "minconf", ",", "txHeight", ",", "curHeight", "int32", ")", "bool", "{", "return", "confirms", "(", "txHeight", ",", "curHeight", ")", ">=", "minconf", "\n", "}" ]
// confirmed checks whether a transaction at height txHeight has met minconf // confirmations for a blockchain at height curHeight.
[ "confirmed", "checks", "whether", "a", "transaction", "at", "height", "txHeight", "has", "met", "minconf", "confirmations", "for", "a", "blockchain", "at", "height", "curHeight", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L3026-L3028
train
btcsuite/btcwallet
wallet/wallet.go
TotalReceivedForAccounts
func (w *Wallet) TotalReceivedForAccounts(scope waddrmgr.KeyScope, minConf int32) ([]AccountTotalReceivedResult, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err } var results []AccountTotalReceivedResult err = walletdb.View(w.db, func(tx walletdb.ReadTx) error {...
go
func (w *Wallet) TotalReceivedForAccounts(scope waddrmgr.KeyScope, minConf int32) ([]AccountTotalReceivedResult, error) { manager, err := w.Manager.FetchScopedKeyManager(scope) if err != nil { return nil, err } var results []AccountTotalReceivedResult err = walletdb.View(w.db, func(tx walletdb.ReadTx) error {...
[ "func", "(", "w", "*", "Wallet", ")", "TotalReceivedForAccounts", "(", "scope", "waddrmgr", ".", "KeyScope", ",", "minConf", "int32", ")", "(", "[", "]", "AccountTotalReceivedResult", ",", "error", ")", "{", "manager", ",", "err", ":=", "w", ".", "Manager"...
// TotalReceivedForAccounts iterates through a wallet's transaction history, // returning the total amount of Bitcoin received for all accounts.
[ "TotalReceivedForAccounts", "iterates", "through", "a", "wallet", "s", "transaction", "history", "returning", "the", "total", "amount", "of", "Bitcoin", "received", "for", "all", "accounts", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L3053-L3118
train
btcsuite/btcwallet
wallet/wallet.go
TotalReceivedForAddr
func (w *Wallet) TotalReceivedForAddr(addr btcutil.Address, minConf int32) (btcutil.Amount, error) { var amount btcutil.Amount err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) syncBlock := w.Manager.SyncedTo() var ( addrStr = addr.EncodeAddress() ...
go
func (w *Wallet) TotalReceivedForAddr(addr btcutil.Address, minConf int32) (btcutil.Amount, error) { var amount btcutil.Amount err := walletdb.View(w.db, func(tx walletdb.ReadTx) error { txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey) syncBlock := w.Manager.SyncedTo() var ( addrStr = addr.EncodeAddress() ...
[ "func", "(", "w", "*", "Wallet", ")", "TotalReceivedForAddr", "(", "addr", "btcutil", ".", "Address", ",", "minConf", "int32", ")", "(", "btcutil", ".", "Amount", ",", "error", ")", "{", "var", "amount", "btcutil", ".", "Amount", "\n", "err", ":=", "wa...
// TotalReceivedForAddr iterates through a wallet's transaction history, // returning the total amount of bitcoins received for a single wallet // address.
[ "TotalReceivedForAddr", "iterates", "through", "a", "wallet", "s", "transaction", "history", "returning", "the", "total", "amount", "of", "bitcoins", "received", "for", "a", "single", "wallet", "address", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L3123-L3165
train
btcsuite/btcwallet
wallet/wallet.go
SendOutputs
func (w *Wallet) SendOutputs(outputs []*wire.TxOut, account uint32, minconf int32, satPerKb btcutil.Amount) (*wire.MsgTx, error) { // Ensure the outputs to be created adhere to the network's consensus // rules. for _, output := range outputs { if err := txrules.CheckOutput(output, satPerKb); err != nil { retu...
go
func (w *Wallet) SendOutputs(outputs []*wire.TxOut, account uint32, minconf int32, satPerKb btcutil.Amount) (*wire.MsgTx, error) { // Ensure the outputs to be created adhere to the network's consensus // rules. for _, output := range outputs { if err := txrules.CheckOutput(output, satPerKb); err != nil { retu...
[ "func", "(", "w", "*", "Wallet", ")", "SendOutputs", "(", "outputs", "[", "]", "*", "wire", ".", "TxOut", ",", "account", "uint32", ",", "minconf", "int32", ",", "satPerKb", "btcutil", ".", "Amount", ")", "(", "*", "wire", ".", "MsgTx", ",", "error",...
// SendOutputs creates and sends payment transactions. It returns the // transaction upon success.
[ "SendOutputs", "creates", "and", "sends", "payment", "transactions", ".", "It", "returns", "the", "transaction", "upon", "success", "." ]
9d95f76e99a72ffaf73b8a6581d8781c52d756f5
https://github.com/btcsuite/btcwallet/blob/9d95f76e99a72ffaf73b8a6581d8781c52d756f5/wallet/wallet.go#L3169-L3202
train