id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
129,600
lightningnetwork/lnd
lnwallet/btcwallet/blockchain.go
GetBestBlock
func (b *BtcWallet) GetBestBlock() (*chainhash.Hash, int32, error) { return b.chain.GetBestBlock() }
go
func (b *BtcWallet) GetBestBlock() (*chainhash.Hash, int32, error) { return b.chain.GetBestBlock() }
[ "func", "(", "b", "*", "BtcWallet", ")", "GetBestBlock", "(", ")", "(", "*", "chainhash", ".", "Hash", ",", "int32", ",", "error", ")", "{", "return", "b", ".", "chain", ".", "GetBestBlock", "(", ")", "\n", "}" ]
// GetBestBlock returns the current height and hash of the best known block // within the main chain. // // This method is a part of the lnwallet.BlockChainIO interface.
[ "GetBestBlock", "returns", "the", "current", "height", "and", "hash", "of", "the", "best", "known", "block", "within", "the", "main", "chain", ".", "This", "method", "is", "a", "part", "of", "the", "lnwallet", ".", "BlockChainIO", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/blockchain.go#L32-L34
129,601
lightningnetwork/lnd
lnwallet/btcwallet/blockchain.go
GetUtxo
func (b *BtcWallet) GetUtxo(op *wire.OutPoint, pkScript []byte, heightHint uint32) (*wire.TxOut, error) { switch backend := b.chain.(type) { case *chain.NeutrinoClient: spendReport, err := backend.CS.GetUtxo( neutrino.WatchInputs(neutrino.InputWithScript{ OutPoint: *op, PkScript: pkScript, }), n...
go
func (b *BtcWallet) GetUtxo(op *wire.OutPoint, pkScript []byte, heightHint uint32) (*wire.TxOut, error) { switch backend := b.chain.(type) { case *chain.NeutrinoClient: spendReport, err := backend.CS.GetUtxo( neutrino.WatchInputs(neutrino.InputWithScript{ OutPoint: *op, PkScript: pkScript, }), n...
[ "func", "(", "b", "*", "BtcWallet", ")", "GetUtxo", "(", "op", "*", "wire", ".", "OutPoint", ",", "pkScript", "[", "]", "byte", ",", "heightHint", "uint32", ")", "(", "*", "wire", ".", "TxOut", ",", "error", ")", "{", "switch", "backend", ":=", "b"...
// GetUtxo returns the original output referenced by the passed outpoint that // creates the target pkScript. // // This method is a part of the lnwallet.BlockChainIO interface.
[ "GetUtxo", "returns", "the", "original", "output", "referenced", "by", "the", "passed", "outpoint", "that", "creates", "the", "target", "pkScript", ".", "This", "method", "is", "a", "part", "of", "the", "lnwallet", ".", "BlockChainIO", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/blockchain.go#L40-L127
129,602
lightningnetwork/lnd
lnwallet/btcwallet/blockchain.go
GetBlock
func (b *BtcWallet) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error) { return b.chain.GetBlock(blockHash) }
go
func (b *BtcWallet) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error) { return b.chain.GetBlock(blockHash) }
[ "func", "(", "b", "*", "BtcWallet", ")", "GetBlock", "(", "blockHash", "*", "chainhash", ".", "Hash", ")", "(", "*", "wire", ".", "MsgBlock", ",", "error", ")", "{", "return", "b", ".", "chain", ".", "GetBlock", "(", "blockHash", ")", "\n", "}" ]
// GetBlock returns a raw block from the server given its hash. // // This method is a part of the lnwallet.BlockChainIO interface.
[ "GetBlock", "returns", "a", "raw", "block", "from", "the", "server", "given", "its", "hash", ".", "This", "method", "is", "a", "part", "of", "the", "lnwallet", ".", "BlockChainIO", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/blockchain.go#L132-L134
129,603
lightningnetwork/lnd
lnwallet/btcwallet/blockchain.go
GetBlockHash
func (b *BtcWallet) GetBlockHash(blockHeight int64) (*chainhash.Hash, error) { return b.chain.GetBlockHash(blockHeight) }
go
func (b *BtcWallet) GetBlockHash(blockHeight int64) (*chainhash.Hash, error) { return b.chain.GetBlockHash(blockHeight) }
[ "func", "(", "b", "*", "BtcWallet", ")", "GetBlockHash", "(", "blockHeight", "int64", ")", "(", "*", "chainhash", ".", "Hash", ",", "error", ")", "{", "return", "b", ".", "chain", ".", "GetBlockHash", "(", "blockHeight", ")", "\n", "}" ]
// GetBlockHash returns the hash of the block in the best blockchain at the // given height. // // This method is a part of the lnwallet.BlockChainIO interface.
[ "GetBlockHash", "returns", "the", "hash", "of", "the", "block", "in", "the", "best", "blockchain", "at", "the", "given", "height", ".", "This", "method", "is", "a", "part", "of", "the", "lnwallet", ".", "BlockChainIO", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/blockchain.go#L140-L142
129,604
lightningnetwork/lnd
cmd/lncli/autopilotrpc_active.go
autopilotCommands
func autopilotCommands() []cli.Command { return []cli.Command{ { Name: "autopilot", Category: "Autopilot", Usage: "Interact with a running autopilot.", Description: "", Subcommands: []cli.Command{ getStatusCommand, enableCommand, disableCommand, queryScoresCommand, }...
go
func autopilotCommands() []cli.Command { return []cli.Command{ { Name: "autopilot", Category: "Autopilot", Usage: "Interact with a running autopilot.", Description: "", Subcommands: []cli.Command{ getStatusCommand, enableCommand, disableCommand, queryScoresCommand, }...
[ "func", "autopilotCommands", "(", ")", "[", "]", "cli", ".", "Command", "{", "return", "[", "]", "cli", ".", "Command", "{", "{", "Name", ":", "\"", "\"", ",", "Category", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Description", ":", "...
// autopilotCommands will return the set of commands to enable for autopilotrpc // builds.
[ "autopilotCommands", "will", "return", "the", "set", "of", "commands", "to", "enable", "for", "autopilotrpc", "builds", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/autopilotrpc_active.go#L148-L163
129,605
lightningnetwork/lnd
channeldb/migrations.go
migrateInvoiceTimeSeriesOutgoingPayments
func migrateInvoiceTimeSeriesOutgoingPayments(tx *bbolt.Tx) error { payBucket := tx.Bucket(paymentBucket) if payBucket == nil { return nil } log.Infof("Migrating invoice database to new outgoing payment format") err := payBucket.ForEach(func(payID, paymentBytes []byte) error { log.Tracef("Migrating payment %...
go
func migrateInvoiceTimeSeriesOutgoingPayments(tx *bbolt.Tx) error { payBucket := tx.Bucket(paymentBucket) if payBucket == nil { return nil } log.Infof("Migrating invoice database to new outgoing payment format") err := payBucket.ForEach(func(payID, paymentBytes []byte) error { log.Tracef("Migrating payment %...
[ "func", "migrateInvoiceTimeSeriesOutgoingPayments", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "payBucket", ":=", "tx", ".", "Bucket", "(", "paymentBucket", ")", "\n", "if", "payBucket", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "lo...
// migrateInvoiceTimeSeriesOutgoingPayments is a follow up to the // migrateInvoiceTimeSeries migration. As at the time of writing, the // OutgoingPayment struct embeddeds an instance of the Invoice struct. As a // result, we also need to migrate the internal invoice to the new format.
[ "migrateInvoiceTimeSeriesOutgoingPayments", "is", "a", "follow", "up", "to", "the", "migrateInvoiceTimeSeries", "migration", ".", "As", "at", "the", "time", "of", "writing", "the", "OutgoingPayment", "struct", "embeddeds", "an", "instance", "of", "the", "Invoice", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/migrations.go#L242-L305
129,606
lightningnetwork/lnd
channeldb/migrations.go
migrateEdgePolicies
func migrateEdgePolicies(tx *bbolt.Tx) error { nodes := tx.Bucket(nodeBucket) if nodes == nil { return nil } edges := tx.Bucket(edgeBucket) if edges == nil { return nil } edgeIndex := edges.Bucket(edgeIndexBucket) if edgeIndex == nil { return nil } // checkKey gets the policy from the database with a...
go
func migrateEdgePolicies(tx *bbolt.Tx) error { nodes := tx.Bucket(nodeBucket) if nodes == nil { return nil } edges := tx.Bucket(edgeBucket) if edges == nil { return nil } edgeIndex := edges.Bucket(edgeIndexBucket) if edgeIndex == nil { return nil } // checkKey gets the policy from the database with a...
[ "func", "migrateEdgePolicies", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "nodes", ":=", "tx", ".", "Bucket", "(", "nodeBucket", ")", "\n", "if", "nodes", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "edges", ":=", "tx", ".", "...
// migrateEdgePolicies is a migration function that will update the edges // bucket. It ensure that edges with unknown policies will also have an entry // in the bucket. After the migration, there will be two edge entries for // every channel, regardless of whether the policies are known.
[ "migrateEdgePolicies", "is", "a", "migration", "function", "that", "will", "update", "the", "edges", "bucket", ".", "It", "ensure", "that", "edges", "with", "unknown", "policies", "will", "also", "have", "an", "entry", "in", "the", "bucket", ".", "After", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/migrations.go#L311-L378
129,607
lightningnetwork/lnd
channeldb/migrations.go
paymentStatusesMigration
func paymentStatusesMigration(tx *bbolt.Tx) error { // Get the bucket dedicated to storing statuses of payments, // where a key is payment hash, value is payment status. paymentStatuses, err := tx.CreateBucketIfNotExists(paymentStatusBucket) if err != nil { return err } log.Infof("Migrating database to support...
go
func paymentStatusesMigration(tx *bbolt.Tx) error { // Get the bucket dedicated to storing statuses of payments, // where a key is payment hash, value is payment status. paymentStatuses, err := tx.CreateBucketIfNotExists(paymentStatusBucket) if err != nil { return err } log.Infof("Migrating database to support...
[ "func", "paymentStatusesMigration", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "// Get the bucket dedicated to storing statuses of payments,", "// where a key is payment hash, value is payment status.", "paymentStatuses", ",", "err", ":=", "tx", ".", "CreateBucketIf...
// paymentStatusesMigration is a database migration intended for adding payment // statuses for each existing payment entity in bucket to be able control // transitions of statuses and prevent cases such as double payment
[ "paymentStatusesMigration", "is", "a", "database", "migration", "intended", "for", "adding", "payment", "statuses", "for", "each", "existing", "payment", "entity", "in", "bucket", "to", "be", "able", "control", "transitions", "of", "statuses", "and", "prevent", "c...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/migrations.go#L383-L461
129,608
lightningnetwork/lnd
channeldb/migrations.go
migratePruneEdgeUpdateIndex
func migratePruneEdgeUpdateIndex(tx *bbolt.Tx) error { // To begin the migration, we'll retrieve the update index bucket. If it // does not exist, we have nothing left to do so we can simply exit. edges := tx.Bucket(edgeBucket) if edges == nil { return nil } edgeUpdateIndex := edges.Bucket(edgeUpdateIndexBucket...
go
func migratePruneEdgeUpdateIndex(tx *bbolt.Tx) error { // To begin the migration, we'll retrieve the update index bucket. If it // does not exist, we have nothing left to do so we can simply exit. edges := tx.Bucket(edgeBucket) if edges == nil { return nil } edgeUpdateIndex := edges.Bucket(edgeUpdateIndexBucket...
[ "func", "migratePruneEdgeUpdateIndex", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "// To begin the migration, we'll retrieve the update index bucket. If it", "// does not exist, we have nothing left to do so we can simply exit.", "edges", ":=", "tx", ".", "Bucket", "(...
// migratePruneEdgeUpdateIndex is a database migration that attempts to resolve // some lingering bugs with regards to edge policies and their update index. // Stale entries within the edge update index were not being properly pruned due // to a miscalculation on the offset of an edge's policy last update. This // migr...
[ "migratePruneEdgeUpdateIndex", "is", "a", "database", "migration", "that", "attempts", "to", "resolve", "some", "lingering", "bugs", "with", "regards", "to", "edge", "policies", "and", "their", "update", "index", ".", "Stale", "entries", "within", "the", "edge", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/migrations.go#L470-L576
129,609
lightningnetwork/lnd
channeldb/migrations.go
migrateOptionalChannelCloseSummaryFields
func migrateOptionalChannelCloseSummaryFields(tx *bbolt.Tx) error { closedChanBucket := tx.Bucket(closedChannelBucket) if closedChanBucket == nil { return nil } log.Info("Migrating to new closed channel format...") err := closedChanBucket.ForEach(func(chanID, summary []byte) error { r := bytes.NewReader(summa...
go
func migrateOptionalChannelCloseSummaryFields(tx *bbolt.Tx) error { closedChanBucket := tx.Bucket(closedChannelBucket) if closedChanBucket == nil { return nil } log.Info("Migrating to new closed channel format...") err := closedChanBucket.ForEach(func(chanID, summary []byte) error { r := bytes.NewReader(summa...
[ "func", "migrateOptionalChannelCloseSummaryFields", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "closedChanBucket", ":=", "tx", ".", "Bucket", "(", "closedChannelBucket", ")", "\n", "if", "closedChanBucket", "==", "nil", "{", "return", "nil", "\n", ...
// migrateOptionalChannelCloseSummaryFields migrates the serialized format of // ChannelCloseSummary to a format where optional fields' presence is indicated // with boolean markers.
[ "migrateOptionalChannelCloseSummaryFields", "migrates", "the", "serialized", "format", "of", "ChannelCloseSummary", "to", "a", "format", "where", "optional", "fields", "presence", "is", "indicated", "with", "boolean", "markers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/migrations.go#L581-L613
129,610
lightningnetwork/lnd
channeldb/migrations.go
migrateGossipMessageStoreKeys
func migrateGossipMessageStoreKeys(tx *bbolt.Tx) error { // We'll start by retrieving the bucket in which these messages are // stored within. If there isn't one, there's nothing left for us to do // so we can avoid the migration. messageStore := tx.Bucket(messageStoreBucket) if messageStore == nil { return nil ...
go
func migrateGossipMessageStoreKeys(tx *bbolt.Tx) error { // We'll start by retrieving the bucket in which these messages are // stored within. If there isn't one, there's nothing left for us to do // so we can avoid the migration. messageStore := tx.Bucket(messageStoreBucket) if messageStore == nil { return nil ...
[ "func", "migrateGossipMessageStoreKeys", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "// We'll start by retrieving the bucket in which these messages are", "// stored within. If there isn't one, there's nothing left for us to do", "// so we can avoid the migration.", "messageS...
// migrateGossipMessageStoreKeys migrates the key format for gossip messages // found in the message store to a new one that takes into consideration the of // the message being stored.
[ "migrateGossipMessageStoreKeys", "migrates", "the", "key", "format", "for", "gossip", "messages", "found", "in", "the", "message", "store", "to", "a", "new", "one", "that", "takes", "into", "consideration", "the", "of", "the", "message", "being", "stored", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/migrations.go#L620-L685
129,611
lightningnetwork/lnd
subscribe/subscribe.go
Start
func (s *Server) Start() error { if !atomic.CompareAndSwapUint32(&s.started, 0, 1) { return nil } s.wg.Add(1) go s.subscriptionHandler() return nil }
go
func (s *Server) Start() error { if !atomic.CompareAndSwapUint32(&s.started, 0, 1) { return nil } s.wg.Add(1) go s.subscriptionHandler() return nil }
[ "func", "(", "s", "*", "Server", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "s", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "s", ".", "wg", ".", "Add"...
// Start starts the Server, making it ready to accept subscriptions and // updates.
[ "Start", "starts", "the", "Server", "making", "it", "ready", "to", "accept", "subscriptions", "and", "updates", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/subscribe/subscribe.go#L85-L94
129,612
lightningnetwork/lnd
subscribe/subscribe.go
Subscribe
func (s *Server) Subscribe() (*Client, error) { // We'll first atomically obtain the next ID for this client from the // incrementing client ID counter. clientID := atomic.AddUint64(&s.clientCounter, 1) // Create the client that will be returned. The Cancel method is // populated to send the cancellation intent t...
go
func (s *Server) Subscribe() (*Client, error) { // We'll first atomically obtain the next ID for this client from the // incrementing client ID counter. clientID := atomic.AddUint64(&s.clientCounter, 1) // Create the client that will be returned. The Cancel method is // populated to send the cancellation intent t...
[ "func", "(", "s", "*", "Server", ")", "Subscribe", "(", ")", "(", "*", "Client", ",", "error", ")", "{", "// We'll first atomically obtain the next ID for this client from the", "// incrementing client ID counter.", "clientID", ":=", "atomic", ".", "AddUint64", "(", "...
// Subscribe returns a Client that will receive updates any time the Server is // made aware of a new event.
[ "Subscribe", "returns", "a", "Client", "that", "will", "receive", "updates", "any", "time", "the", "Server", "is", "made", "aware", "of", "a", "new", "event", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/subscribe/subscribe.go#L110-L144
129,613
lightningnetwork/lnd
subscribe/subscribe.go
SendUpdate
func (s *Server) SendUpdate(update interface{}) error { select { case s.updates <- update: return nil case <-s.quit: return ErrServerShuttingDown } }
go
func (s *Server) SendUpdate(update interface{}) error { select { case s.updates <- update: return nil case <-s.quit: return ErrServerShuttingDown } }
[ "func", "(", "s", "*", "Server", ")", "SendUpdate", "(", "update", "interface", "{", "}", ")", "error", "{", "select", "{", "case", "s", ".", "updates", "<-", "update", ":", "return", "nil", "\n", "case", "<-", "s", ".", "quit", ":", "return", "Err...
// SendUpdate is called to send the passed update to all currently active // subscription clients.
[ "SendUpdate", "is", "called", "to", "send", "the", "passed", "update", "to", "all", "currently", "active", "subscription", "clients", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/subscribe/subscribe.go#L148-L156
129,614
lightningnetwork/lnd
watchtower/wtdb/tower.go
AddAddress
func (t *Tower) AddAddress(addr net.Addr) { t.mu.Lock() defer t.mu.Unlock() // Ensure we don't add a duplicate address. addrStr := addr.String() for _, existingAddr := range t.Addresses { if existingAddr.String() == addrStr { return } } // Add this address to the front of the list, on the assumption tha...
go
func (t *Tower) AddAddress(addr net.Addr) { t.mu.Lock() defer t.mu.Unlock() // Ensure we don't add a duplicate address. addrStr := addr.String() for _, existingAddr := range t.Addresses { if existingAddr.String() == addrStr { return } } // Add this address to the front of the list, on the assumption tha...
[ "func", "(", "t", "*", "Tower", ")", "AddAddress", "(", "addr", "net", ".", "Addr", ")", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Ensure we don't add a duplicate address.", "addrStr...
// AddAddress adds the given address to the tower's in-memory list of addresses. // If the address's string is already present, the Tower will be left // unmodified. Otherwise, the adddress is prepended to the beginning of the // Tower's addresses, on the assumption that it is fresher than the others.
[ "AddAddress", "adds", "the", "given", "address", "to", "the", "tower", "s", "in", "-", "memory", "list", "of", "addresses", ".", "If", "the", "address", "s", "string", "is", "already", "present", "the", "Tower", "will", "be", "left", "unmodified", ".", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower.go#L39-L54
129,615
lightningnetwork/lnd
watchtower/wtdb/tower.go
LNAddrs
func (t *Tower) LNAddrs() []*lnwire.NetAddress { t.mu.RLock() defer t.mu.RUnlock() addrs := make([]*lnwire.NetAddress, 0, len(t.Addresses)) for _, addr := range t.Addresses { addrs = append(addrs, &lnwire.NetAddress{ IdentityKey: t.IdentityKey, Address: addr, }) } return addrs }
go
func (t *Tower) LNAddrs() []*lnwire.NetAddress { t.mu.RLock() defer t.mu.RUnlock() addrs := make([]*lnwire.NetAddress, 0, len(t.Addresses)) for _, addr := range t.Addresses { addrs = append(addrs, &lnwire.NetAddress{ IdentityKey: t.IdentityKey, Address: addr, }) } return addrs }
[ "func", "(", "t", "*", "Tower", ")", "LNAddrs", "(", ")", "[", "]", "*", "lnwire", ".", "NetAddress", "{", "t", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "addrs", ":=", "make", "(", "[...
// LNAddrs generates a list of lnwire.NetAddress from a Tower instance's // addresses. This can be used to have a client try multiple addresses for the // same Tower.
[ "LNAddrs", "generates", "a", "list", "of", "lnwire", ".", "NetAddress", "from", "a", "Tower", "instance", "s", "addresses", ".", "This", "can", "be", "used", "to", "have", "a", "client", "try", "multiple", "addresses", "for", "the", "same", "Tower", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower.go#L59-L72
129,616
lightningnetwork/lnd
brontide/noise.go
Encrypt
func (c *cipherState) Encrypt(associatedData, cipherText, plainText []byte) []byte { defer func() { c.nonce++ if c.nonce == keyRotationInterval { c.rotateKey() } }() var nonce [12]byte binary.LittleEndian.PutUint64(nonce[4:], c.nonce) return c.cipher.Seal(cipherText, nonce[:], plainText, associatedData...
go
func (c *cipherState) Encrypt(associatedData, cipherText, plainText []byte) []byte { defer func() { c.nonce++ if c.nonce == keyRotationInterval { c.rotateKey() } }() var nonce [12]byte binary.LittleEndian.PutUint64(nonce[4:], c.nonce) return c.cipher.Seal(cipherText, nonce[:], plainText, associatedData...
[ "func", "(", "c", "*", "cipherState", ")", "Encrypt", "(", "associatedData", ",", "cipherText", ",", "plainText", "[", "]", "byte", ")", "[", "]", "byte", "{", "defer", "func", "(", ")", "{", "c", ".", "nonce", "++", "\n\n", "if", "c", ".", "nonce"...
// Encrypt returns a ciphertext which is the encryption of the plainText // observing the passed associatedData within the AEAD construction.
[ "Encrypt", "returns", "a", "ciphertext", "which", "is", "the", "encryption", "of", "the", "plainText", "observing", "the", "passed", "associatedData", "within", "the", "AEAD", "construction", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L112-L125
129,617
lightningnetwork/lnd
brontide/noise.go
Decrypt
func (c *cipherState) Decrypt(associatedData, plainText, cipherText []byte) ([]byte, error) { defer func() { c.nonce++ if c.nonce == keyRotationInterval { c.rotateKey() } }() var nonce [12]byte binary.LittleEndian.PutUint64(nonce[4:], c.nonce) return c.cipher.Open(plainText, nonce[:], cipherText, assoc...
go
func (c *cipherState) Decrypt(associatedData, plainText, cipherText []byte) ([]byte, error) { defer func() { c.nonce++ if c.nonce == keyRotationInterval { c.rotateKey() } }() var nonce [12]byte binary.LittleEndian.PutUint64(nonce[4:], c.nonce) return c.cipher.Open(plainText, nonce[:], cipherText, assoc...
[ "func", "(", "c", "*", "cipherState", ")", "Decrypt", "(", "associatedData", ",", "plainText", ",", "cipherText", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "defer", "func", "(", ")", "{", "c", ".", "nonce", "++", "\n\n",...
// Decrypt attempts to decrypt the passed ciphertext observing the specified // associatedData within the AEAD construction. In the case that the final MAC // check fails, then a non-nil error will be returned.
[ "Decrypt", "attempts", "to", "decrypt", "the", "passed", "ciphertext", "observing", "the", "specified", "associatedData", "within", "the", "AEAD", "construction", ".", "In", "the", "case", "that", "the", "final", "MAC", "check", "fails", "then", "a", "non", "-...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L130-L143
129,618
lightningnetwork/lnd
brontide/noise.go
InitializeKey
func (c *cipherState) InitializeKey(key [32]byte) { c.secretKey = key c.nonce = 0 // Safe to ignore the error here as our key is properly sized // (32-bytes). c.cipher, _ = chacha20poly1305.New(c.secretKey[:]) }
go
func (c *cipherState) InitializeKey(key [32]byte) { c.secretKey = key c.nonce = 0 // Safe to ignore the error here as our key is properly sized // (32-bytes). c.cipher, _ = chacha20poly1305.New(c.secretKey[:]) }
[ "func", "(", "c", "*", "cipherState", ")", "InitializeKey", "(", "key", "[", "32", "]", "byte", ")", "{", "c", ".", "secretKey", "=", "key", "\n", "c", ".", "nonce", "=", "0", "\n\n", "// Safe to ignore the error here as our key is properly sized", "// (32-byt...
// InitializeKey initializes the secret key and AEAD cipher scheme based off of // the passed key.
[ "InitializeKey", "initializes", "the", "secret", "key", "and", "AEAD", "cipher", "scheme", "based", "off", "of", "the", "passed", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L147-L154
129,619
lightningnetwork/lnd
brontide/noise.go
InitializeKeyWithSalt
func (c *cipherState) InitializeKeyWithSalt(salt, key [32]byte) { c.salt = salt c.InitializeKey(key) }
go
func (c *cipherState) InitializeKeyWithSalt(salt, key [32]byte) { c.salt = salt c.InitializeKey(key) }
[ "func", "(", "c", "*", "cipherState", ")", "InitializeKeyWithSalt", "(", "salt", ",", "key", "[", "32", "]", "byte", ")", "{", "c", ".", "salt", "=", "salt", "\n", "c", ".", "InitializeKey", "(", "key", ")", "\n", "}" ]
// InitializeKeyWithSalt is identical to InitializeKey however it also sets the // cipherState's salt field which is used for key rotation.
[ "InitializeKeyWithSalt", "is", "identical", "to", "InitializeKey", "however", "it", "also", "sets", "the", "cipherState", "s", "salt", "field", "which", "is", "used", "for", "key", "rotation", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L158-L161
129,620
lightningnetwork/lnd
brontide/noise.go
mixKey
func (s *symmetricState) mixKey(input []byte) { var info []byte secret := input salt := s.chainingKey h := hkdf.New(sha256.New, secret, salt[:], info) // hkdf(ck, input, zero) // | // | \ // | \ // ck k h.Read(s.chainingKey[:]) h.Read(s.tempKey[:]) // cipher.k = temp_key s.InitializeKey(s.tempKey) }
go
func (s *symmetricState) mixKey(input []byte) { var info []byte secret := input salt := s.chainingKey h := hkdf.New(sha256.New, secret, salt[:], info) // hkdf(ck, input, zero) // | // | \ // | \ // ck k h.Read(s.chainingKey[:]) h.Read(s.tempKey[:]) // cipher.k = temp_key s.InitializeKey(s.tempKey) }
[ "func", "(", "s", "*", "symmetricState", ")", "mixKey", "(", "input", "[", "]", "byte", ")", "{", "var", "info", "[", "]", "byte", "\n\n", "secret", ":=", "input", "\n", "salt", ":=", "s", ".", "chainingKey", "\n", "h", ":=", "hkdf", ".", "New", ...
// mixKey is implements a basic HKDF-based key ratchet. This method is called // with the result of each DH output generated during the handshake process. // The first 32 bytes extract from the HKDF reader is the next chaining key, // then latter 32 bytes become the temp secret key using within any future AEAD // opera...
[ "mixKey", "is", "implements", "a", "basic", "HKDF", "-", "based", "key", "ratchet", ".", "This", "method", "is", "called", "with", "the", "result", "of", "each", "DH", "output", "generated", "during", "the", "handshake", "process", ".", "The", "first", "32...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L217-L234
129,621
lightningnetwork/lnd
brontide/noise.go
newHandshakeState
func newHandshakeState(initiator bool, prologue []byte, localPub *btcec.PrivateKey, remotePub *btcec.PublicKey) handshakeState { h := handshakeState{ initiator: initiator, localStatic: localPub, remoteStatic: remotePub, } // Set the current chaining key and handshake digest to the hash of the // protoc...
go
func newHandshakeState(initiator bool, prologue []byte, localPub *btcec.PrivateKey, remotePub *btcec.PublicKey) handshakeState { h := handshakeState{ initiator: initiator, localStatic: localPub, remoteStatic: remotePub, } // Set the current chaining key and handshake digest to the hash of the // protoc...
[ "func", "newHandshakeState", "(", "initiator", "bool", ",", "prologue", "[", "]", "byte", ",", "localPub", "*", "btcec", ".", "PrivateKey", ",", "remotePub", "*", "btcec", ".", "PublicKey", ")", "handshakeState", "{", "h", ":=", "handshakeState", "{", "initi...
// newHandshakeState returns a new instance of the handshake state initialized // with the prologue and protocol name. If this is the responder's handshake // state, then the remotePub can be nil.
[ "newHandshakeState", "returns", "a", "new", "instance", "of", "the", "handshake", "state", "initialized", "with", "the", "prologue", "and", "protocol", "name", ".", "If", "this", "is", "the", "responder", "s", "handshake", "state", "then", "the", "remotePub", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L302-L329
129,622
lightningnetwork/lnd
brontide/noise.go
EphemeralGenerator
func EphemeralGenerator(gen func() (*btcec.PrivateKey, error)) func(*Machine) { return func(m *Machine) { m.ephemeralGen = gen } }
go
func EphemeralGenerator(gen func() (*btcec.PrivateKey, error)) func(*Machine) { return func(m *Machine) { m.ephemeralGen = gen } }
[ "func", "EphemeralGenerator", "(", "gen", "func", "(", ")", "(", "*", "btcec", ".", "PrivateKey", ",", "error", ")", ")", "func", "(", "*", "Machine", ")", "{", "return", "func", "(", "m", "*", "Machine", ")", "{", "m", ".", "ephemeralGen", "=", "g...
// EphemeralGenerator is a functional option that allows callers to substitute // a custom function for use when generating ephemeral keys for ActOne or // ActTwo. The function closure return by this function can be passed into // NewBrontideMachine as a function option parameter.
[ "EphemeralGenerator", "is", "a", "functional", "option", "that", "allows", "callers", "to", "substitute", "a", "custom", "function", "for", "use", "when", "generating", "ephemeral", "keys", "for", "ActOne", "or", "ActTwo", ".", "The", "function", "closure", "ret...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L335-L339
129,623
lightningnetwork/lnd
brontide/noise.go
RecvActOne
func (b *Machine) RecvActOne(actOne [ActOneSize]byte) error { var ( err error e [33]byte p [16]byte ) // If the handshake version is unknown, then the handshake fails // immediately. if actOne[0] != HandshakeVersion { return fmt.Errorf("Act One: invalid handshake version: %v, "+ "only %v is valid, ...
go
func (b *Machine) RecvActOne(actOne [ActOneSize]byte) error { var ( err error e [33]byte p [16]byte ) // If the handshake version is unknown, then the handshake fails // immediately. if actOne[0] != HandshakeVersion { return fmt.Errorf("Act One: invalid handshake version: %v, "+ "only %v is valid, ...
[ "func", "(", "b", "*", "Machine", ")", "RecvActOne", "(", "actOne", "[", "ActOneSize", "]", "byte", ")", "error", "{", "var", "(", "err", "error", "\n", "e", "[", "33", "]", "byte", "\n", "p", "[", "16", "]", "byte", "\n", ")", "\n\n", "// If the...
// RecvActOne processes the act one packet sent by the initiator. The responder // executes the mirrored actions to that of the initiator extending the // handshake digest and deriving a new shared secret based on an ECDH with the // initiator's ephemeral key and responder's static key.
[ "RecvActOne", "processes", "the", "act", "one", "packet", "sent", "by", "the", "initiator", ".", "The", "responder", "executes", "the", "mirrored", "actions", "to", "that", "of", "the", "initiator", "extending", "the", "handshake", "digest", "and", "deriving", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L486-L519
129,624
lightningnetwork/lnd
brontide/noise.go
ReadMessage
func (b *Machine) ReadMessage(r io.Reader) ([]byte, error) { pktLen, err := b.ReadHeader(r) if err != nil { return nil, err } buf := make([]byte, pktLen) return b.ReadBody(r, buf) }
go
func (b *Machine) ReadMessage(r io.Reader) ([]byte, error) { pktLen, err := b.ReadHeader(r) if err != nil { return nil, err } buf := make([]byte, pktLen) return b.ReadBody(r, buf) }
[ "func", "(", "b", "*", "Machine", ")", "ReadMessage", "(", "r", "io", ".", "Reader", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "pktLen", ",", "err", ":=", "b", ".", "ReadHeader", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "...
// ReadMessage attempts to read the next message from the passed io.Reader. In // the case of an authentication error, a non-nil error is returned.
[ "ReadMessage", "attempts", "to", "read", "the", "next", "message", "from", "the", "passed", "io", ".", "Reader", ".", "In", "the", "case", "of", "an", "authentication", "error", "a", "non", "-", "nil", "error", "is", "returned", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L817-L825
129,625
lightningnetwork/lnd
brontide/noise.go
ReadBody
func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) { // Next, using the length read from the packet header, read the // encrypted packet itself into the buffer allocated by the read // pool. _, err := io.ReadFull(r, buf) if err != nil { return nil, err } // Finally, decrypt the message held i...
go
func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) { // Next, using the length read from the packet header, read the // encrypted packet itself into the buffer allocated by the read // pool. _, err := io.ReadFull(r, buf) if err != nil { return nil, err } // Finally, decrypt the message held i...
[ "func", "(", "b", "*", "Machine", ")", "ReadBody", "(", "r", "io", ".", "Reader", ",", "buf", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Next, using the length read from the packet header, read the", "// encrypted packet itself int...
// ReadBody attempts to ready the next message body from the passed io.Reader. // The provided buffer MUST be the length indicated by the packet length // returned by the preceding call to ReadHeader. In the case of an // authentication eerror, a non-nil error is returned.
[ "ReadBody", "attempts", "to", "ready", "the", "next", "message", "body", "from", "the", "passed", "io", ".", "Reader", ".", "The", "provided", "buffer", "MUST", "be", "the", "length", "indicated", "by", "the", "packet", "length", "returned", "by", "the", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/noise.go#L860-L873
129,626
lightningnetwork/lnd
watchtower/wtclient/backup_task.go
newBackupTask
func newBackupTask(chanID *lnwire.ChannelID, breachInfo *lnwallet.BreachRetribution, sweepPkScript []byte) *backupTask { // Parse the non-dust outputs from the breach transaction, // simultaneously computing the total amount contained in the inputs // present. We can't compute the exact output values at this time...
go
func newBackupTask(chanID *lnwire.ChannelID, breachInfo *lnwallet.BreachRetribution, sweepPkScript []byte) *backupTask { // Parse the non-dust outputs from the breach transaction, // simultaneously computing the total amount contained in the inputs // present. We can't compute the exact output values at this time...
[ "func", "newBackupTask", "(", "chanID", "*", "lnwire", ".", "ChannelID", ",", "breachInfo", "*", "lnwallet", ".", "BreachRetribution", ",", "sweepPkScript", "[", "]", "byte", ")", "*", "backupTask", "{", "// Parse the non-dust outputs from the breach transaction,", "/...
// newBackupTask initializes a new backupTask and populates all state-dependent // variables.
[ "newBackupTask", "initializes", "a", "new", "backupTask", "and", "populates", "all", "state", "-", "dependent", "variables", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/backup_task.go#L55-L108
129,627
lightningnetwork/lnd
watchtower/wtclient/backup_task.go
bindSession
func (t *backupTask) bindSession(session *wtdb.ClientSession) error { // First we'll begin by deriving a weight estimate for the justice // transaction. The final weight can be different depending on whether // the watchtower is taking a reward. var weightEstimate input.TxWeightEstimator // Next, add the contrib...
go
func (t *backupTask) bindSession(session *wtdb.ClientSession) error { // First we'll begin by deriving a weight estimate for the justice // transaction. The final weight can be different depending on whether // the watchtower is taking a reward. var weightEstimate input.TxWeightEstimator // Next, add the contrib...
[ "func", "(", "t", "*", "backupTask", ")", "bindSession", "(", "session", "*", "wtdb", ".", "ClientSession", ")", "error", "{", "// First we'll begin by deriving a weight estimate for the justice", "// transaction. The final weight can be different depending on whether", "// the w...
// bindSession determines if the backupTask is compatible with the passed // SessionInfo's policy. If no error is returned, the task has been bound to the // session and can be queued to upload to the tower. Otherwise, the bind failed // and should be rescheduled with a different session.
[ "bindSession", "determines", "if", "the", "backupTask", "is", "compatible", "with", "the", "passed", "SessionInfo", "s", "policy", ".", "If", "no", "error", "is", "returned", "the", "task", "has", "been", "bound", "to", "the", "session", "and", "can", "be", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/backup_task.go#L129-L168
129,628
lightningnetwork/lnd
watchtower/wtclient/backup_task.go
craftSessionPayload
func (t *backupTask) craftSessionPayload( signer input.Signer) (wtdb.BreachHint, []byte, error) { var hint wtdb.BreachHint // First, copy over the sweep pkscript, the pubkeys used to derive the // to-local script, and the remote CSV delay. keyRing := t.breachInfo.KeyRing justiceKit := &blob.JusticeKit{ SweepA...
go
func (t *backupTask) craftSessionPayload( signer input.Signer) (wtdb.BreachHint, []byte, error) { var hint wtdb.BreachHint // First, copy over the sweep pkscript, the pubkeys used to derive the // to-local script, and the remote CSV delay. keyRing := t.breachInfo.KeyRing justiceKit := &blob.JusticeKit{ SweepA...
[ "func", "(", "t", "*", "backupTask", ")", "craftSessionPayload", "(", "signer", "input", ".", "Signer", ")", "(", "wtdb", ".", "BreachHint", ",", "[", "]", "byte", ",", "error", ")", "{", "var", "hint", "wtdb", ".", "BreachHint", "\n\n", "// First, copy ...
// craftSessionPayload is the final stage for a backupTask, and generates the // encrypted payload and breach hint that should be sent to the tower. This // method computes the final justice transaction using the bound // session-dependent variables, and signs the resulting transaction. The // required pieces from sign...
[ "craftSessionPayload", "is", "the", "final", "stage", "for", "a", "backupTask", "and", "generates", "the", "encrypted", "payload", "and", "breach", "hint", "that", "should", "be", "sent", "to", "the", "tower", ".", "This", "method", "computes", "the", "final",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/backup_task.go#L176-L297
129,629
lightningnetwork/lnd
watchtower/wtclient/backup_task.go
toBlobPubKey
func toBlobPubKey(pubKey *btcec.PublicKey) blob.PubKey { var blobPubKey blob.PubKey copy(blobPubKey[:], pubKey.SerializeCompressed()) return blobPubKey }
go
func toBlobPubKey(pubKey *btcec.PublicKey) blob.PubKey { var blobPubKey blob.PubKey copy(blobPubKey[:], pubKey.SerializeCompressed()) return blobPubKey }
[ "func", "toBlobPubKey", "(", "pubKey", "*", "btcec", ".", "PublicKey", ")", "blob", ".", "PubKey", "{", "var", "blobPubKey", "blob", ".", "PubKey", "\n", "copy", "(", "blobPubKey", "[", ":", "]", ",", "pubKey", ".", "SerializeCompressed", "(", ")", ")", ...
// toBlobPubKey serializes the given pubkey into a blob.PubKey that can be set // as a field on a blob.JusticeKit.
[ "toBlobPubKey", "serializes", "the", "given", "pubkey", "into", "a", "blob", ".", "PubKey", "that", "can", "be", "set", "as", "a", "field", "on", "a", "blob", ".", "JusticeKit", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/backup_task.go#L301-L305
129,630
lightningnetwork/lnd
htlcswitch/circuit.go
newPaymentCircuit
func newPaymentCircuit(hash *[32]byte, pkt *htlcPacket) *PaymentCircuit { var addRef channeldb.AddRef if pkt.sourceRef != nil { addRef = *pkt.sourceRef } return &PaymentCircuit{ AddRef: addRef, Incoming: CircuitKey{ ChanID: pkt.incomingChanID, HtlcID: pkt.incomingHTLCID, }, PaymentHash: *hash, ...
go
func newPaymentCircuit(hash *[32]byte, pkt *htlcPacket) *PaymentCircuit { var addRef channeldb.AddRef if pkt.sourceRef != nil { addRef = *pkt.sourceRef } return &PaymentCircuit{ AddRef: addRef, Incoming: CircuitKey{ ChanID: pkt.incomingChanID, HtlcID: pkt.incomingHTLCID, }, PaymentHash: *hash, ...
[ "func", "newPaymentCircuit", "(", "hash", "*", "[", "32", "]", "byte", ",", "pkt", "*", "htlcPacket", ")", "*", "PaymentCircuit", "{", "var", "addRef", "channeldb", ".", "AddRef", "\n", "if", "pkt", ".", "sourceRef", "!=", "nil", "{", "addRef", "=", "*...
// newPaymentCircuit initializes a payment circuit on the heap using the payment // hash and an in-memory htlc packet.
[ "newPaymentCircuit", "initializes", "a", "payment", "circuit", "on", "the", "heap", "using", "the", "payment", "hash", "and", "an", "in", "-", "memory", "htlc", "packet", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit.go#L72-L89
129,631
lightningnetwork/lnd
htlcswitch/circuit.go
Encode
func (c *PaymentCircuit) Encode(w io.Writer) error { if err := c.AddRef.Encode(w); err != nil { return err } if err := c.Incoming.Encode(w); err != nil { return err } if _, err := w.Write(c.PaymentHash[:]); err != nil { return err } var scratch [8]byte binary.BigEndian.PutUint64(scratch[:], uint64(c.I...
go
func (c *PaymentCircuit) Encode(w io.Writer) error { if err := c.AddRef.Encode(w); err != nil { return err } if err := c.Incoming.Encode(w); err != nil { return err } if _, err := w.Write(c.PaymentHash[:]); err != nil { return err } var scratch [8]byte binary.BigEndian.PutUint64(scratch[:], uint64(c.I...
[ "func", "(", "c", "*", "PaymentCircuit", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "if", "err", ":=", "c", ".", "AddRef", ".", "Encode", "(", "w", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if...
// Encode writes a PaymentCircuit to the provided io.Writer.
[ "Encode", "writes", "a", "PaymentCircuit", "to", "the", "provided", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit.go#L113-L155
129,632
lightningnetwork/lnd
htlcswitch/circuit.go
Decode
func (c *PaymentCircuit) Decode(r io.Reader) error { if err := c.AddRef.Decode(r); err != nil { return err } if err := c.Incoming.Decode(r); err != nil { return err } if _, err := io.ReadFull(r, c.PaymentHash[:]); err != nil { return err } var scratch [8]byte if _, err := io.ReadFull(r, scratch[:]); e...
go
func (c *PaymentCircuit) Decode(r io.Reader) error { if err := c.AddRef.Decode(r); err != nil { return err } if err := c.Incoming.Decode(r); err != nil { return err } if _, err := io.ReadFull(r, c.PaymentHash[:]); err != nil { return err } var scratch [8]byte if _, err := io.ReadFull(r, scratch[:]); e...
[ "func", "(", "c", "*", "PaymentCircuit", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "if", "err", ":=", "c", ".", "AddRef", ".", "Decode", "(", "r", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if...
// Decode reads a PaymentCircuit from the provided io.Reader.
[ "Decode", "reads", "a", "PaymentCircuit", "from", "the", "provided", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit.go#L158-L211
129,633
lightningnetwork/lnd
htlcswitch/circuit.go
OutKey
func (c *PaymentCircuit) OutKey() CircuitKey { if c.Outgoing != nil { return *c.Outgoing } return EmptyCircuitKey }
go
func (c *PaymentCircuit) OutKey() CircuitKey { if c.Outgoing != nil { return *c.Outgoing } return EmptyCircuitKey }
[ "func", "(", "c", "*", "PaymentCircuit", ")", "OutKey", "(", ")", "CircuitKey", "{", "if", "c", ".", "Outgoing", "!=", "nil", "{", "return", "*", "c", ".", "Outgoing", "\n", "}", "\n\n", "return", "EmptyCircuitKey", "\n", "}" ]
// OutKey returns the keystone identifying the outgoing link and HTLC ID. If the // circuit hasn't been completed, this method returns an EmptyKeystone, which is // an invalid outgoing circuit key. Only call this method if HasKeystone returns // true.
[ "OutKey", "returns", "the", "keystone", "identifying", "the", "outgoing", "link", "and", "HTLC", "ID", ".", "If", "the", "circuit", "hasn", "t", "been", "completed", "this", "method", "returns", "an", "EmptyKeystone", "which", "is", "an", "invalid", "outgoing"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit.go#L223-L229
129,634
lightningnetwork/lnd
lnwire/commit_sig.go
Decode
func (c *CommitSig) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, &c.CommitSig, &c.HtlcSigs, ) }
go
func (c *CommitSig) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, &c.CommitSig, &c.HtlcSigs, ) }
[ "func", "(", "c", "*", "CommitSig", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "c", ".", "ChanID", ",", "&", "c", ".", "CommitSig", ",", "&", "c", ".", "...
// Decode deserializes a serialized CommitSig message stored in the // passed io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "CommitSig", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", "....
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/commit_sig.go#L50-L56
129,635
lightningnetwork/lnd
lnwire/commit_sig.go
Encode
func (c *CommitSig) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.CommitSig, c.HtlcSigs, ) }
go
func (c *CommitSig) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.CommitSig, c.HtlcSigs, ) }
[ "func", "(", "c", "*", "CommitSig", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "c", ".", "ChanID", ",", "c", ".", "CommitSig", ",", "c", ".", "HtlcSigs", ",", ...
// Encode serializes the target CommitSig into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "CommitSig", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/commit_sig.go#L62-L68
129,636
lightningnetwork/lnd
contractcourt/chain_watcher.go
newChainWatcher
func newChainWatcher(cfg chainWatcherConfig) (*chainWatcher, error) { // In order to be able to detect the nature of a potential channel // closure we'll need to reconstruct the state hint bytes used to // obfuscate the commitment state number encoded in the lock time and // sequence fields. var stateHint [lnwalle...
go
func newChainWatcher(cfg chainWatcherConfig) (*chainWatcher, error) { // In order to be able to detect the nature of a potential channel // closure we'll need to reconstruct the state hint bytes used to // obfuscate the commitment state number encoded in the lock time and // sequence fields. var stateHint [lnwalle...
[ "func", "newChainWatcher", "(", "cfg", "chainWatcherConfig", ")", "(", "*", "chainWatcher", ",", "error", ")", "{", "// In order to be able to detect the nature of a potential channel", "// closure we'll need to reconstruct the state hint bytes used to", "// obfuscate the commitment st...
// newChainWatcher returns a new instance of a chainWatcher for a channel given // the chan point to watch, and also a notifier instance that will allow us to // detect on chain events.
[ "newChainWatcher", "returns", "a", "new", "instance", "of", "a", "chainWatcher", "for", "a", "channel", "given", "the", "chan", "point", "to", "watch", "and", "also", "a", "notifier", "instance", "that", "will", "allow", "us", "to", "detect", "on", "chain", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_watcher.go#L150-L175
129,637
lightningnetwork/lnd
contractcourt/chain_watcher.go
Start
func (c *chainWatcher) Start() error { if !atomic.CompareAndSwapInt32(&c.started, 0, 1) { return nil } chanState := c.cfg.chanState log.Debugf("Starting chain watcher for ChannelPoint(%v)", chanState.FundingOutpoint) // First, we'll register for a notification to be dispatched if the // funding output is sp...
go
func (c *chainWatcher) Start() error { if !atomic.CompareAndSwapInt32(&c.started, 0, 1) { return nil } chanState := c.cfg.chanState log.Debugf("Starting chain watcher for ChannelPoint(%v)", chanState.FundingOutpoint) // First, we'll register for a notification to be dispatched if the // funding output is sp...
[ "func", "(", "c", "*", "chainWatcher", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapInt32", "(", "&", "c", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "chanState", ":=", "c", ...
// Start starts all goroutines that the chainWatcher needs to perform its // duties.
[ "Start", "starts", "all", "goroutines", "that", "the", "chainWatcher", "needs", "to", "perform", "its", "duties", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_watcher.go#L179-L226
129,638
lightningnetwork/lnd
contractcourt/chain_watcher.go
Stop
func (c *chainWatcher) Stop() error { if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) { return nil } close(c.quit) c.wg.Wait() return nil }
go
func (c *chainWatcher) Stop() error { if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) { return nil } close(c.quit) c.wg.Wait() return nil }
[ "func", "(", "c", "*", "chainWatcher", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapInt32", "(", "&", "c", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "close", "(", "c", ".", ...
// Stop signals the close observer to gracefully exit.
[ "Stop", "signals", "the", "close", "observer", "to", "gracefully", "exit", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_watcher.go#L229-L239
129,639
lightningnetwork/lnd
contractcourt/chain_watcher.go
toSelfAmount
func (c *chainWatcher) toSelfAmount(tx *wire.MsgTx) btcutil.Amount { var selfAmt btcutil.Amount for _, txOut := range tx.TxOut { _, addrs, _, err := txscript.ExtractPkScriptAddrs( // Doesn't matter what net we actually pass in. txOut.PkScript, &chaincfg.TestNet3Params, ) if err != nil { continue } ...
go
func (c *chainWatcher) toSelfAmount(tx *wire.MsgTx) btcutil.Amount { var selfAmt btcutil.Amount for _, txOut := range tx.TxOut { _, addrs, _, err := txscript.ExtractPkScriptAddrs( // Doesn't matter what net we actually pass in. txOut.PkScript, &chaincfg.TestNet3Params, ) if err != nil { continue } ...
[ "func", "(", "c", "*", "chainWatcher", ")", "toSelfAmount", "(", "tx", "*", "wire", ".", "MsgTx", ")", "btcutil", ".", "Amount", "{", "var", "selfAmt", "btcutil", ".", "Amount", "\n", "for", "_", ",", "txOut", ":=", "range", "tx", ".", "TxOut", "{", ...
// toSelfAmount takes a transaction and returns the sum of all outputs that pay // to a script that the wallet controls. If no outputs pay to us, then we // return zero. This is possible as our output may have been trimmed due to // being dust.
[ "toSelfAmount", "takes", "a", "transaction", "and", "returns", "the", "sum", "of", "all", "outputs", "that", "pay", "to", "a", "script", "that", "the", "wallet", "controls", ".", "If", "no", "outputs", "pay", "to", "us", "then", "we", "return", "zero", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_watcher.go#L607-L626
129,640
lightningnetwork/lnd
contractcourt/chain_watcher.go
dispatchCooperativeClose
func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDetail) error { broadcastTx := commitSpend.SpendingTx log.Infof("Cooperative closure for ChannelPoint(%v): %v", c.cfg.chanState.FundingOutpoint, spew.Sdump(broadcastTx)) // If the input *is* final, then we'll check to see which output i...
go
func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDetail) error { broadcastTx := commitSpend.SpendingTx log.Infof("Cooperative closure for ChannelPoint(%v): %v", c.cfg.chanState.FundingOutpoint, spew.Sdump(broadcastTx)) // If the input *is* final, then we'll check to see which output i...
[ "func", "(", "c", "*", "chainWatcher", ")", "dispatchCooperativeClose", "(", "commitSpend", "*", "chainntnfs", ".", "SpendDetail", ")", "error", "{", "broadcastTx", ":=", "commitSpend", ".", "SpendingTx", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ",", "c...
// dispatchCooperativeClose processed a detect cooperative channel closure. // We'll use the spending transaction to locate our output within the // transaction, then clean up the database state. We'll also dispatch a // notification to all subscribers that the channel has been closed in this // manner.
[ "dispatchCooperativeClose", "processed", "a", "detect", "cooperative", "channel", "closure", ".", "We", "ll", "use", "the", "spending", "transaction", "to", "locate", "our", "output", "within", "the", "transaction", "then", "clean", "up", "the", "database", "state...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_watcher.go#L633-L694
129,641
lightningnetwork/lnd
contractcourt/chain_watcher.go
dispatchLocalForceClose
func (c *chainWatcher) dispatchLocalForceClose( commitSpend *chainntnfs.SpendDetail, localCommit channeldb.ChannelCommitment) error { log.Infof("Local unilateral close of ChannelPoint(%v) "+ "detected", c.cfg.chanState.FundingOutpoint) forceClose, err := lnwallet.NewLocalForceCloseSummary( c.cfg.chanState, c....
go
func (c *chainWatcher) dispatchLocalForceClose( commitSpend *chainntnfs.SpendDetail, localCommit channeldb.ChannelCommitment) error { log.Infof("Local unilateral close of ChannelPoint(%v) "+ "detected", c.cfg.chanState.FundingOutpoint) forceClose, err := lnwallet.NewLocalForceCloseSummary( c.cfg.chanState, c....
[ "func", "(", "c", "*", "chainWatcher", ")", "dispatchLocalForceClose", "(", "commitSpend", "*", "chainntnfs", ".", "SpendDetail", ",", "localCommit", "channeldb", ".", "ChannelCommitment", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", "+", "\"", "...
// dispatchLocalForceClose processes a unilateral close by us being confirmed.
[ "dispatchLocalForceClose", "processes", "a", "unilateral", "close", "by", "us", "being", "confirmed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_watcher.go#L697-L771
129,642
lightningnetwork/lnd
chainregistry.go
newChainRegistry
func newChainRegistry() *chainRegistry { return &chainRegistry{ activeChains: make(map[chainCode]*chainControl), netParams: make(map[chainCode]*bitcoinNetParams), } }
go
func newChainRegistry() *chainRegistry { return &chainRegistry{ activeChains: make(map[chainCode]*chainControl), netParams: make(map[chainCode]*bitcoinNetParams), } }
[ "func", "newChainRegistry", "(", ")", "*", "chainRegistry", "{", "return", "&", "chainRegistry", "{", "activeChains", ":", "make", "(", "map", "[", "chainCode", "]", "*", "chainControl", ")", ",", "netParams", ":", "make", "(", "map", "[", "chainCode", "]"...
// newChainRegistry creates a new chainRegistry.
[ "newChainRegistry", "creates", "a", "new", "chainRegistry", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L600-L605
129,643
lightningnetwork/lnd
chainregistry.go
RegisterChain
func (c *chainRegistry) RegisterChain(newChain chainCode, cc *chainControl) { c.Lock() c.activeChains[newChain] = cc c.Unlock() }
go
func (c *chainRegistry) RegisterChain(newChain chainCode, cc *chainControl) { c.Lock() c.activeChains[newChain] = cc c.Unlock() }
[ "func", "(", "c", "*", "chainRegistry", ")", "RegisterChain", "(", "newChain", "chainCode", ",", "cc", "*", "chainControl", ")", "{", "c", ".", "Lock", "(", ")", "\n", "c", ".", "activeChains", "[", "newChain", "]", "=", "cc", "\n", "c", ".", "Unlock...
// RegisterChain assigns an active chainControl instance to a target chain // identified by its chainCode.
[ "RegisterChain", "assigns", "an", "active", "chainControl", "instance", "to", "a", "target", "chain", "identified", "by", "its", "chainCode", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L609-L613
129,644
lightningnetwork/lnd
chainregistry.go
LookupChain
func (c *chainRegistry) LookupChain(targetChain chainCode) (*chainControl, bool) { c.RLock() cc, ok := c.activeChains[targetChain] c.RUnlock() return cc, ok }
go
func (c *chainRegistry) LookupChain(targetChain chainCode) (*chainControl, bool) { c.RLock() cc, ok := c.activeChains[targetChain] c.RUnlock() return cc, ok }
[ "func", "(", "c", "*", "chainRegistry", ")", "LookupChain", "(", "targetChain", "chainCode", ")", "(", "*", "chainControl", ",", "bool", ")", "{", "c", ".", "RLock", "(", ")", "\n", "cc", ",", "ok", ":=", "c", ".", "activeChains", "[", "targetChain", ...
// LookupChain attempts to lookup an active chainControl instance for the // target chain.
[ "LookupChain", "attempts", "to", "lookup", "an", "active", "chainControl", "instance", "for", "the", "target", "chain", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L617-L622
129,645
lightningnetwork/lnd
chainregistry.go
LookupChainByHash
func (c *chainRegistry) LookupChainByHash(chainHash chainhash.Hash) (*chainControl, bool) { c.RLock() defer c.RUnlock() targetChain, ok := chainMap[chainHash] if !ok { return nil, ok } cc, ok := c.activeChains[targetChain] return cc, ok }
go
func (c *chainRegistry) LookupChainByHash(chainHash chainhash.Hash) (*chainControl, bool) { c.RLock() defer c.RUnlock() targetChain, ok := chainMap[chainHash] if !ok { return nil, ok } cc, ok := c.activeChains[targetChain] return cc, ok }
[ "func", "(", "c", "*", "chainRegistry", ")", "LookupChainByHash", "(", "chainHash", "chainhash", ".", "Hash", ")", "(", "*", "chainControl", ",", "bool", ")", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n\n", "ta...
// LookupChainByHash attempts to look up an active chainControl which // corresponds to the passed genesis hash.
[ "LookupChainByHash", "attempts", "to", "look", "up", "an", "active", "chainControl", "which", "corresponds", "to", "the", "passed", "genesis", "hash", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L626-L637
129,646
lightningnetwork/lnd
chainregistry.go
RegisterPrimaryChain
func (c *chainRegistry) RegisterPrimaryChain(cc chainCode) { c.Lock() defer c.Unlock() c.primaryChain = cc }
go
func (c *chainRegistry) RegisterPrimaryChain(cc chainCode) { c.Lock() defer c.Unlock() c.primaryChain = cc }
[ "func", "(", "c", "*", "chainRegistry", ")", "RegisterPrimaryChain", "(", "cc", "chainCode", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", "c", ".", "primaryChain", "=", "cc", "\n", "}" ]
// RegisterPrimaryChain sets a target chain as the "home chain" for lnd.
[ "RegisterPrimaryChain", "sets", "a", "target", "chain", "as", "the", "home", "chain", "for", "lnd", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L640-L645
129,647
lightningnetwork/lnd
chainregistry.go
PrimaryChain
func (c *chainRegistry) PrimaryChain() chainCode { c.RLock() defer c.RUnlock() return c.primaryChain }
go
func (c *chainRegistry) PrimaryChain() chainCode { c.RLock() defer c.RUnlock() return c.primaryChain }
[ "func", "(", "c", "*", "chainRegistry", ")", "PrimaryChain", "(", ")", "chainCode", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "primaryChain", "\n", "}" ]
// PrimaryChain returns the primary chain for this running lnd instance. The // primary chain is considered the "home base" while the other registered // chains are treated as secondary chains.
[ "PrimaryChain", "returns", "the", "primary", "chain", "for", "this", "running", "lnd", "instance", ".", "The", "primary", "chain", "is", "considered", "the", "home", "base", "while", "the", "other", "registered", "chains", "are", "treated", "as", "secondary", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L650-L655
129,648
lightningnetwork/lnd
chainregistry.go
ActiveChains
func (c *chainRegistry) ActiveChains() []chainCode { c.RLock() defer c.RUnlock() chains := make([]chainCode, 0, len(c.activeChains)) for activeChain := range c.activeChains { chains = append(chains, activeChain) } return chains }
go
func (c *chainRegistry) ActiveChains() []chainCode { c.RLock() defer c.RUnlock() chains := make([]chainCode, 0, len(c.activeChains)) for activeChain := range c.activeChains { chains = append(chains, activeChain) } return chains }
[ "func", "(", "c", "*", "chainRegistry", ")", "ActiveChains", "(", ")", "[", "]", "chainCode", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n\n", "chains", ":=", "make", "(", "[", "]", "chainCode", ",", "0", ",...
// ActiveChains returns a slice containing the active chains.
[ "ActiveChains", "returns", "a", "slice", "containing", "the", "active", "chains", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L658-L668
129,649
lightningnetwork/lnd
chainregistry.go
NumActiveChains
func (c *chainRegistry) NumActiveChains() uint32 { c.RLock() defer c.RUnlock() return uint32(len(c.activeChains)) }
go
func (c *chainRegistry) NumActiveChains() uint32 { c.RLock() defer c.RUnlock() return uint32(len(c.activeChains)) }
[ "func", "(", "c", "*", "chainRegistry", ")", "NumActiveChains", "(", ")", "uint32", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n\n", "return", "uint32", "(", "len", "(", "c", ".", "activeChains", ")", ")", "\n...
// NumActiveChains returns the total number of active chains.
[ "NumActiveChains", "returns", "the", "total", "number", "of", "active", "chains", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L671-L676
129,650
lightningnetwork/lnd
chainregistry.go
initNeutrinoBackend
func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error) { // First we'll open the database file for neutrino, creating the // database if needed. We append the normalized network name here to // match the behavior of btcwallet. dbPath := filepath.Join( chainDir, normalizeNetwork(active...
go
func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error) { // First we'll open the database file for neutrino, creating the // database if needed. We append the normalized network name here to // match the behavior of btcwallet. dbPath := filepath.Join( chainDir, normalizeNetwork(active...
[ "func", "initNeutrinoBackend", "(", "chainDir", "string", ")", "(", "*", "neutrino", ".", "ChainService", ",", "func", "(", ")", ",", "error", ")", "{", "// First we'll open the database file for neutrino, creating the", "// database if needed. We append the normalized networ...
// initNeutrinoBackend inits a new instance of the neutrino light client // backend given a target chain directory to store the chain state.
[ "initNeutrinoBackend", "inits", "a", "new", "instance", "of", "the", "neutrino", "light", "client", "backend", "given", "a", "target", "chain", "directory", "to", "store", "the", "chain", "state", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainregistry.go#L680-L753
129,651
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
OpenTowerDB
func OpenTowerDB(dbPath string) (*TowerDB, error) { path := filepath.Join(dbPath, dbName) // If the database file doesn't exist, this indicates we much initialize // a fresh database with the latest version. firstInit := !fileExists(path) if firstInit { // Ensure all parent directories are initialized. err :=...
go
func OpenTowerDB(dbPath string) (*TowerDB, error) { path := filepath.Join(dbPath, dbName) // If the database file doesn't exist, this indicates we much initialize // a fresh database with the latest version. firstInit := !fileExists(path) if firstInit { // Ensure all parent directories are initialized. err :=...
[ "func", "OpenTowerDB", "(", "dbPath", "string", ")", "(", "*", "TowerDB", ",", "error", ")", "{", "path", ":=", "filepath", ".", "Join", "(", "dbPath", ",", "dbName", ")", "\n\n", "// If the database file doesn't exist, this indicates we much initialize", "// a fres...
// OpenTowerDB opens the tower database given the path to the database's // directory. If no such database exists, this method will initialize a fresh // one using the latest version number and bucket structure. If a database // exists but has a lower version number than the current version, any necessary // migrations...
[ "OpenTowerDB", "opens", "the", "tower", "database", "given", "the", "path", "to", "the", "database", "s", "directory", ".", "If", "no", "such", "database", "exists", "this", "method", "will", "initialize", "a", "fresh", "one", "using", "the", "latest", "vers...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L88-L164
129,652
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
initTowerDBBuckets
func initTowerDBBuckets(tx *bbolt.Tx) error { buckets := [][]byte{ sessionsBkt, updateIndexBkt, updatesBkt, lookoutTipBkt, } for _, bucket := range buckets { _, err := tx.CreateBucketIfNotExists(bucket) if err != nil { return err } } return nil }
go
func initTowerDBBuckets(tx *bbolt.Tx) error { buckets := [][]byte{ sessionsBkt, updateIndexBkt, updatesBkt, lookoutTipBkt, } for _, bucket := range buckets { _, err := tx.CreateBucketIfNotExists(bucket) if err != nil { return err } } return nil }
[ "func", "initTowerDBBuckets", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "buckets", ":=", "[", "]", "[", "]", "byte", "{", "sessionsBkt", ",", "updateIndexBkt", ",", "updatesBkt", ",", "lookoutTipBkt", ",", "}", "\n\n", "for", "_", ",", "bu...
// initTowerDBBuckets creates all top-level buckets required to handle database // operations required by the latest version.
[ "initTowerDBBuckets", "creates", "all", "top", "-", "level", "buckets", "required", "to", "handle", "database", "operations", "required", "by", "the", "latest", "version", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L179-L195
129,653
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
syncVersions
func (t *TowerDB) syncVersions(versions []version) error { curVersion, err := t.Version() if err != nil { return err } latestVersion := getLatestDBVersion(versions) switch { // Current version is higher than any known version, fail to prevent // reversion. case curVersion > latestVersion: return channeldb...
go
func (t *TowerDB) syncVersions(versions []version) error { curVersion, err := t.Version() if err != nil { return err } latestVersion := getLatestDBVersion(versions) switch { // Current version is higher than any known version, fail to prevent // reversion. case curVersion > latestVersion: return channeldb...
[ "func", "(", "t", "*", "TowerDB", ")", "syncVersions", "(", "versions", "[", "]", "version", ")", "error", "{", "curVersion", ",", "err", ":=", "t", ".", "Version", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", ...
// syncVersions ensures the database version is consistent with the highest // known database version, applying any migrations that have not been made. If // the highest known version number is lower than the database's version, this // method will fail to prevent accidental reversions.
[ "syncVersions", "ensures", "the", "database", "version", "is", "consistent", "with", "the", "highest", "known", "database", "version", "applying", "any", "migrations", "that", "have", "not", "been", "made", ".", "If", "the", "highest", "known", "version", "numbe...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L201-L241
129,654
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
Version
func (t *TowerDB) Version() (uint32, error) { var version uint32 err := t.db.View(func(tx *bbolt.Tx) error { var err error version, err = getDBVersion(tx) return err }) if err != nil { return 0, err } return version, nil }
go
func (t *TowerDB) Version() (uint32, error) { var version uint32 err := t.db.View(func(tx *bbolt.Tx) error { var err error version, err = getDBVersion(tx) return err }) if err != nil { return 0, err } return version, nil }
[ "func", "(", "t", "*", "TowerDB", ")", "Version", "(", ")", "(", "uint32", ",", "error", ")", "{", "var", "version", "uint32", "\n", "err", ":=", "t", ".", "db", ".", "View", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", ...
// Version returns the database's current version number.
[ "Version", "returns", "the", "database", "s", "current", "version", "number", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L244-L256
129,655
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
getSession
func getSession(sessions *bbolt.Bucket, id []byte) (*SessionInfo, error) { sessionBytes := sessions.Get(id) if sessionBytes == nil { return nil, ErrSessionNotFound } var session SessionInfo err := session.Decode(bytes.NewReader(sessionBytes)) if err != nil { return nil, err } return &session, nil }
go
func getSession(sessions *bbolt.Bucket, id []byte) (*SessionInfo, error) { sessionBytes := sessions.Get(id) if sessionBytes == nil { return nil, ErrSessionNotFound } var session SessionInfo err := session.Decode(bytes.NewReader(sessionBytes)) if err != nil { return nil, err } return &session, nil }
[ "func", "getSession", "(", "sessions", "*", "bbolt", ".", "Bucket", ",", "id", "[", "]", "byte", ")", "(", "*", "SessionInfo", ",", "error", ")", "{", "sessionBytes", ":=", "sessions", ".", "Get", "(", "id", ")", "\n", "if", "sessionBytes", "==", "ni...
// getSession retrieves the session info from the sessions bucket identified by // its session id. An error is returned if the session is not found or a // deserialization error occurs.
[ "getSession", "retrieves", "the", "session", "info", "from", "the", "sessions", "bucket", "identified", "by", "its", "session", "id", ".", "An", "error", "is", "returned", "if", "the", "session", "is", "not", "found", "or", "a", "deserialization", "error", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L609-L622
129,656
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
putSession
func putSession(sessions *bbolt.Bucket, session *SessionInfo) error { var b bytes.Buffer err := session.Encode(&b) if err != nil { return err } return sessions.Put(session.ID[:], b.Bytes()) }
go
func putSession(sessions *bbolt.Bucket, session *SessionInfo) error { var b bytes.Buffer err := session.Encode(&b) if err != nil { return err } return sessions.Put(session.ID[:], b.Bytes()) }
[ "func", "putSession", "(", "sessions", "*", "bbolt", ".", "Bucket", ",", "session", "*", "SessionInfo", ")", "error", "{", "var", "b", "bytes", ".", "Buffer", "\n", "err", ":=", "session", ".", "Encode", "(", "&", "b", ")", "\n", "if", "err", "!=", ...
// putSession stores the session info in the sessions bucket identified by its // session id. An error is returned if a serialization error occurs.
[ "putSession", "stores", "the", "session", "info", "in", "the", "sessions", "bucket", "identified", "by", "its", "session", "id", ".", "An", "error", "is", "returned", "if", "a", "serialization", "error", "occurs", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L626-L634
129,657
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
touchSessionHintBkt
func touchSessionHintBkt(updateIndex *bbolt.Bucket, id *SessionID) error { _, err := updateIndex.CreateBucketIfNotExists(id[:]) return err }
go
func touchSessionHintBkt(updateIndex *bbolt.Bucket, id *SessionID) error { _, err := updateIndex.CreateBucketIfNotExists(id[:]) return err }
[ "func", "touchSessionHintBkt", "(", "updateIndex", "*", "bbolt", ".", "Bucket", ",", "id", "*", "SessionID", ")", "error", "{", "_", ",", "err", ":=", "updateIndex", ".", "CreateBucketIfNotExists", "(", "id", "[", ":", "]", ")", "\n", "return", "err", "\...
// touchSessionHintBkt initializes the session-hint bucket for a particular // session id. This ensures that future calls to getHintsForSession or // putHintForSession can rely on the bucket already being created, and fail if // index has not been initialized as this points to improper usage.
[ "touchSessionHintBkt", "initializes", "the", "session", "-", "hint", "bucket", "for", "a", "particular", "session", "id", ".", "This", "ensures", "that", "future", "calls", "to", "getHintsForSession", "or", "putHintForSession", "can", "rely", "on", "the", "bucket"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L640-L643
129,658
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
removeSessionHintBkt
func removeSessionHintBkt(updateIndex *bbolt.Bucket, id *SessionID) error { return updateIndex.DeleteBucket(id[:]) }
go
func removeSessionHintBkt(updateIndex *bbolt.Bucket, id *SessionID) error { return updateIndex.DeleteBucket(id[:]) }
[ "func", "removeSessionHintBkt", "(", "updateIndex", "*", "bbolt", ".", "Bucket", ",", "id", "*", "SessionID", ")", "error", "{", "return", "updateIndex", ".", "DeleteBucket", "(", "id", "[", ":", "]", ")", "\n", "}" ]
// removeSessionHintBkt prunes the session-hint bucket for the given session id // and all of the hints contained inside. This should be used to clean up the // index upon session deletion.
[ "removeSessionHintBkt", "prunes", "the", "session", "-", "hint", "bucket", "for", "the", "given", "session", "id", "and", "all", "of", "the", "hints", "contained", "inside", ".", "This", "should", "be", "used", "to", "clean", "up", "the", "index", "upon", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L648-L650
129,659
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
getHintsForSession
func getHintsForSession(updateIndex *bbolt.Bucket, id *SessionID) ([]BreachHint, error) { sessionHints := updateIndex.Bucket(id[:]) if sessionHints == nil { return nil, ErrNoSessionHintIndex } var hints []BreachHint err := sessionHints.ForEach(func(k, _ []byte) error { if len(k) != BreachHintSize { retur...
go
func getHintsForSession(updateIndex *bbolt.Bucket, id *SessionID) ([]BreachHint, error) { sessionHints := updateIndex.Bucket(id[:]) if sessionHints == nil { return nil, ErrNoSessionHintIndex } var hints []BreachHint err := sessionHints.ForEach(func(k, _ []byte) error { if len(k) != BreachHintSize { retur...
[ "func", "getHintsForSession", "(", "updateIndex", "*", "bbolt", ".", "Bucket", ",", "id", "*", "SessionID", ")", "(", "[", "]", "BreachHint", ",", "error", ")", "{", "sessionHints", ":=", "updateIndex", ".", "Bucket", "(", "id", "[", ":", "]", ")", "\n...
// getHintsForSession returns all known hints belonging to the given session id. // If the index for the session has not been initialized, this method returns // ErrNoSessionHintIndex.
[ "getHintsForSession", "returns", "all", "known", "hints", "belonging", "to", "the", "given", "session", "id", ".", "If", "the", "index", "for", "the", "session", "has", "not", "been", "initialized", "this", "method", "returns", "ErrNoSessionHintIndex", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L655-L679
129,660
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
putLookoutEpoch
func putLookoutEpoch(bkt *bbolt.Bucket, epoch *chainntnfs.BlockEpoch) error { epochBytes := make([]byte, 36) copy(epochBytes, epoch.Hash[:]) byteOrder.PutUint32(epochBytes[32:], uint32(epoch.Height)) return bkt.Put(lookoutTipKey, epochBytes) }
go
func putLookoutEpoch(bkt *bbolt.Bucket, epoch *chainntnfs.BlockEpoch) error { epochBytes := make([]byte, 36) copy(epochBytes, epoch.Hash[:]) byteOrder.PutUint32(epochBytes[32:], uint32(epoch.Height)) return bkt.Put(lookoutTipKey, epochBytes) }
[ "func", "putLookoutEpoch", "(", "bkt", "*", "bbolt", ".", "Bucket", ",", "epoch", "*", "chainntnfs", ".", "BlockEpoch", ")", "error", "{", "epochBytes", ":=", "make", "(", "[", "]", "byte", ",", "36", ")", "\n", "copy", "(", "epochBytes", ",", "epoch",...
// putLookoutEpoch stores the given lookout tip block epoch in provided bucket.
[ "putLookoutEpoch", "stores", "the", "given", "lookout", "tip", "block", "epoch", "in", "provided", "bucket", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L698-L704
129,661
lightningnetwork/lnd
watchtower/wtdb/tower_db.go
getLookoutEpoch
func getLookoutEpoch(bkt *bbolt.Bucket) *chainntnfs.BlockEpoch { epochBytes := bkt.Get(lookoutTipKey) if len(epochBytes) != 36 { return nil } var hash chainhash.Hash copy(hash[:], epochBytes[:32]) height := byteOrder.Uint32(epochBytes[32:]) return &chainntnfs.BlockEpoch{ Hash: &hash, Height: int32(heig...
go
func getLookoutEpoch(bkt *bbolt.Bucket) *chainntnfs.BlockEpoch { epochBytes := bkt.Get(lookoutTipKey) if len(epochBytes) != 36 { return nil } var hash chainhash.Hash copy(hash[:], epochBytes[:32]) height := byteOrder.Uint32(epochBytes[32:]) return &chainntnfs.BlockEpoch{ Hash: &hash, Height: int32(heig...
[ "func", "getLookoutEpoch", "(", "bkt", "*", "bbolt", ".", "Bucket", ")", "*", "chainntnfs", ".", "BlockEpoch", "{", "epochBytes", ":=", "bkt", ".", "Get", "(", "lookoutTipKey", ")", "\n", "if", "len", "(", "epochBytes", ")", "!=", "36", "{", "return", ...
// getLookoutEpoch retrieves the lookout tip block epoch from the given bucket. // A nil epoch is returned if no update exists.
[ "getLookoutEpoch", "retrieves", "the", "lookout", "tip", "block", "epoch", "from", "the", "given", "bucket", ".", "A", "nil", "epoch", "is", "returned", "if", "no", "update", "exists", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/tower_db.go#L708-L722
129,662
lightningnetwork/lnd
htlcswitch/failure.go
Error
func (f *ForwardingError) Error() string { if f.ExtraMsg == "" { return f.FailureMessage.Error() } return fmt.Sprintf("%v: %v", f.FailureMessage.Error(), f.ExtraMsg) }
go
func (f *ForwardingError) Error() string { if f.ExtraMsg == "" { return f.FailureMessage.Error() } return fmt.Sprintf("%v: %v", f.FailureMessage.Error(), f.ExtraMsg) }
[ "func", "(", "f", "*", "ForwardingError", ")", "Error", "(", ")", "string", "{", "if", "f", ".", "ExtraMsg", "==", "\"", "\"", "{", "return", "f", ".", "FailureMessage", ".", "Error", "(", ")", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(...
// Error implements the built-in error interface. We use this method to allow // the switch or any callers to insert additional context to the error message // returned.
[ "Error", "implements", "the", "built", "-", "in", "error", "interface", ".", "We", "use", "this", "method", "to", "allow", "the", "switch", "or", "any", "callers", "to", "insert", "additional", "context", "to", "the", "error", "message", "returned", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/failure.go#L31-L37
129,663
lightningnetwork/lnd
htlcswitch/failure.go
Encode
func (s *SphinxErrorEncrypter) Encode(w io.Writer) error { ephemeral := s.EphemeralKey.SerializeCompressed() _, err := w.Write(ephemeral) return err }
go
func (s *SphinxErrorEncrypter) Encode(w io.Writer) error { ephemeral := s.EphemeralKey.SerializeCompressed() _, err := w.Write(ephemeral) return err }
[ "func", "(", "s", "*", "SphinxErrorEncrypter", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "ephemeral", ":=", "s", ".", "EphemeralKey", ".", "SerializeCompressed", "(", ")", "\n", "_", ",", "err", ":=", "w", ".", "Write", "(", "e...
// Encode serializes the error encrypter' ephemeral public key to the provided // io.Writer.
[ "Encode", "serializes", "the", "error", "encrypter", "ephemeral", "public", "key", "to", "the", "provided", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/failure.go#L174-L178
129,664
lightningnetwork/lnd
htlcswitch/failure.go
Decode
func (s *SphinxErrorEncrypter) Decode(r io.Reader) error { var ephemeral [33]byte if _, err := io.ReadFull(r, ephemeral[:]); err != nil { return err } var err error s.EphemeralKey, err = btcec.ParsePubKey(ephemeral[:], btcec.S256()) if err != nil { return err } return nil }
go
func (s *SphinxErrorEncrypter) Decode(r io.Reader) error { var ephemeral [33]byte if _, err := io.ReadFull(r, ephemeral[:]); err != nil { return err } var err error s.EphemeralKey, err = btcec.ParsePubKey(ephemeral[:], btcec.S256()) if err != nil { return err } return nil }
[ "func", "(", "s", "*", "SphinxErrorEncrypter", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "var", "ephemeral", "[", "33", "]", "byte", "\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "ephemeral", "[", ...
// Decode reconstructs the error encrypter's ephemeral public key from the // provided io.Reader.
[ "Decode", "reconstructs", "the", "error", "encrypter", "s", "ephemeral", "public", "key", "from", "the", "provided", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/failure.go#L182-L195
129,665
lightningnetwork/lnd
htlcswitch/failure.go
Reextract
func (s *SphinxErrorEncrypter) Reextract( extract ErrorEncrypterExtracter) error { obfuscator, failcode := extract(s.EphemeralKey) if failcode != lnwire.CodeNone { // This should never happen, since we already validated that // this obfuscator can be extracted when it was received in the // link. return fmt...
go
func (s *SphinxErrorEncrypter) Reextract( extract ErrorEncrypterExtracter) error { obfuscator, failcode := extract(s.EphemeralKey) if failcode != lnwire.CodeNone { // This should never happen, since we already validated that // this obfuscator can be extracted when it was received in the // link. return fmt...
[ "func", "(", "s", "*", "SphinxErrorEncrypter", ")", "Reextract", "(", "extract", "ErrorEncrypterExtracter", ")", "error", "{", "obfuscator", ",", "failcode", ":=", "extract", "(", "s", ".", "EphemeralKey", ")", "\n", "if", "failcode", "!=", "lnwire", ".", "C...
// Reextract rederives the error encrypter from the currently held EphemeralKey. // This intended to be used shortly after Decode, to fully initialize a // SphinxErrorEncrypter.
[ "Reextract", "rederives", "the", "error", "encrypter", "from", "the", "currently", "held", "EphemeralKey", ".", "This", "intended", "to", "be", "used", "shortly", "after", "Decode", "to", "fully", "initialize", "a", "SphinxErrorEncrypter", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/failure.go#L200-L222
129,666
lightningnetwork/lnd
tor/net.go
Dial
func (r *ClearNet) Dial(network, address string) (net.Conn, error) { return net.Dial(network, address) }
go
func (r *ClearNet) Dial(network, address string) (net.Conn, error) { return net.Dial(network, address) }
[ "func", "(", "r", "*", "ClearNet", ")", "Dial", "(", "network", ",", "address", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "return", "net", ".", "Dial", "(", "network", ",", "address", ")", "\n", "}" ]
// Dial on the regular network uses net.Dial
[ "Dial", "on", "the", "regular", "network", "uses", "net", ".", "Dial" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L35-L37
129,667
lightningnetwork/lnd
tor/net.go
LookupHost
func (r *ClearNet) LookupHost(host string) ([]string, error) { return net.LookupHost(host) }
go
func (r *ClearNet) LookupHost(host string) ([]string, error) { return net.LookupHost(host) }
[ "func", "(", "r", "*", "ClearNet", ")", "LookupHost", "(", "host", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "net", ".", "LookupHost", "(", "host", ")", "\n", "}" ]
// LookupHost for regular network uses the net.LookupHost function
[ "LookupHost", "for", "regular", "network", "uses", "the", "net", ".", "LookupHost", "function" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L40-L42
129,668
lightningnetwork/lnd
tor/net.go
LookupSRV
func (r *ClearNet) LookupSRV(service, proto, name string) (string, []*net.SRV, error) { return net.LookupSRV(service, proto, name) }
go
func (r *ClearNet) LookupSRV(service, proto, name string) (string, []*net.SRV, error) { return net.LookupSRV(service, proto, name) }
[ "func", "(", "r", "*", "ClearNet", ")", "LookupSRV", "(", "service", ",", "proto", ",", "name", "string", ")", "(", "string", ",", "[", "]", "*", "net", ".", "SRV", ",", "error", ")", "{", "return", "net", ".", "LookupSRV", "(", "service", ",", "...
// LookupSRV for regular network uses net.LookupSRV function
[ "LookupSRV", "for", "regular", "network", "uses", "net", ".", "LookupSRV", "function" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L45-L47
129,669
lightningnetwork/lnd
tor/net.go
ResolveTCPAddr
func (r *ClearNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error) { return net.ResolveTCPAddr(network, address) }
go
func (r *ClearNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error) { return net.ResolveTCPAddr(network, address) }
[ "func", "(", "r", "*", "ClearNet", ")", "ResolveTCPAddr", "(", "network", ",", "address", "string", ")", "(", "*", "net", ".", "TCPAddr", ",", "error", ")", "{", "return", "net", ".", "ResolveTCPAddr", "(", "network", ",", "address", ")", "\n", "}" ]
// ResolveTCPAddr for regular network uses net.ResolveTCPAddr function
[ "ResolveTCPAddr", "for", "regular", "network", "uses", "net", ".", "ResolveTCPAddr", "function" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L50-L52
129,670
lightningnetwork/lnd
tor/net.go
Dial
func (p *ProxyNet) Dial(network, address string) (net.Conn, error) { switch network { case "tcp", "tcp4", "tcp6": default: return nil, errors.New("cannot dial non-tcp network via Tor") } return Dial(address, p.SOCKS, p.StreamIsolation) }
go
func (p *ProxyNet) Dial(network, address string) (net.Conn, error) { switch network { case "tcp", "tcp4", "tcp6": default: return nil, errors.New("cannot dial non-tcp network via Tor") } return Dial(address, p.SOCKS, p.StreamIsolation) }
[ "func", "(", "p", "*", "ProxyNet", ")", "Dial", "(", "network", ",", "address", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "switch", "network", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "default", ":", ...
// Dial uses the Tor Dial function in order to establish connections through // Tor. Since Tor only supports TCP connections, only TCP networks are allowed.
[ "Dial", "uses", "the", "Tor", "Dial", "function", "in", "order", "to", "establish", "connections", "through", "Tor", ".", "Since", "Tor", "only", "supports", "TCP", "connections", "only", "TCP", "networks", "are", "allowed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L74-L81
129,671
lightningnetwork/lnd
tor/net.go
LookupHost
func (p *ProxyNet) LookupHost(host string) ([]string, error) { return LookupHost(host, p.SOCKS) }
go
func (p *ProxyNet) LookupHost(host string) ([]string, error) { return LookupHost(host, p.SOCKS) }
[ "func", "(", "p", "*", "ProxyNet", ")", "LookupHost", "(", "host", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "LookupHost", "(", "host", ",", "p", ".", "SOCKS", ")", "\n", "}" ]
// LookupHost uses the Tor LookupHost function in order to resolve hosts over // Tor.
[ "LookupHost", "uses", "the", "Tor", "LookupHost", "function", "in", "order", "to", "resolve", "hosts", "over", "Tor", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L85-L87
129,672
lightningnetwork/lnd
tor/net.go
LookupSRV
func (p *ProxyNet) LookupSRV(service, proto, name string) (string, []*net.SRV, error) { return LookupSRV(service, proto, name, p.SOCKS, p.DNS, p.StreamIsolation) }
go
func (p *ProxyNet) LookupSRV(service, proto, name string) (string, []*net.SRV, error) { return LookupSRV(service, proto, name, p.SOCKS, p.DNS, p.StreamIsolation) }
[ "func", "(", "p", "*", "ProxyNet", ")", "LookupSRV", "(", "service", ",", "proto", ",", "name", "string", ")", "(", "string", ",", "[", "]", "*", "net", ".", "SRV", ",", "error", ")", "{", "return", "LookupSRV", "(", "service", ",", "proto", ",", ...
// LookupSRV uses the Tor LookupSRV function in order to resolve SRV DNS queries // over Tor.
[ "LookupSRV", "uses", "the", "Tor", "LookupSRV", "function", "in", "order", "to", "resolve", "SRV", "DNS", "queries", "over", "Tor", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L91-L93
129,673
lightningnetwork/lnd
tor/net.go
ResolveTCPAddr
func (p *ProxyNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error) { switch network { case "tcp", "tcp4", "tcp6": default: return nil, errors.New("cannot dial non-tcp network via Tor") } return ResolveTCPAddr(address, p.SOCKS) }
go
func (p *ProxyNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error) { switch network { case "tcp", "tcp4", "tcp6": default: return nil, errors.New("cannot dial non-tcp network via Tor") } return ResolveTCPAddr(address, p.SOCKS) }
[ "func", "(", "p", "*", "ProxyNet", ")", "ResolveTCPAddr", "(", "network", ",", "address", "string", ")", "(", "*", "net", ".", "TCPAddr", ",", "error", ")", "{", "switch", "network", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", ...
// ResolveTCPAddr uses the Tor ResolveTCPAddr function in order to resolve TCP // addresses over Tor.
[ "ResolveTCPAddr", "uses", "the", "Tor", "ResolveTCPAddr", "function", "in", "order", "to", "resolve", "TCP", "addresses", "over", "Tor", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/net.go#L97-L104
129,674
lightningnetwork/lnd
subrpcserver_config.go
extractReflectValue
func extractReflectValue(instance interface{}) reflect.Value { var val reflect.Value // If the type of the instance is a pointer, then we need to deference // the pointer one level to get its value. Otherwise, we can access the // value directly. if reflect.TypeOf(instance).Kind() == reflect.Ptr { val = reflect...
go
func extractReflectValue(instance interface{}) reflect.Value { var val reflect.Value // If the type of the instance is a pointer, then we need to deference // the pointer one level to get its value. Otherwise, we can access the // value directly. if reflect.TypeOf(instance).Kind() == reflect.Ptr { val = reflect...
[ "func", "extractReflectValue", "(", "instance", "interface", "{", "}", ")", "reflect", ".", "Value", "{", "var", "val", "reflect", ".", "Value", "\n\n", "// If the type of the instance is a pointer, then we need to deference", "// the pointer one level to get its value. Otherwi...
// extractReflectValue attempts to extract the value from an interface using // the reflect package. The resulting reflect.Value allows the caller to // programmatically examine and manipulate the underlying value.
[ "extractReflectValue", "attempts", "to", "extract", "the", "value", "from", "an", "interface", "using", "the", "reflect", "package", ".", "The", "resulting", "reflect", ".", "Value", "allows", "the", "caller", "to", "programmatically", "examine", "and", "manipulat...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/subrpcserver_config.go#L254-L267
129,675
lightningnetwork/lnd
lnwire/revoke_and_ack.go
Decode
func (c *RevokeAndAck) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, c.Revocation[:], &c.NextRevocationKey, ) }
go
func (c *RevokeAndAck) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, c.Revocation[:], &c.NextRevocationKey, ) }
[ "func", "(", "c", "*", "RevokeAndAck", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "c", ".", "ChanID", ",", "c", ".", "Revocation", "[", ":", "]", ",", "&",...
// Decode deserializes a serialized RevokeAndAck message stored in the // passed io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "RevokeAndAck", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/revoke_and_ack.go#L48-L54
129,676
lightningnetwork/lnd
lnwire/revoke_and_ack.go
Encode
func (c *RevokeAndAck) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.Revocation[:], c.NextRevocationKey, ) }
go
func (c *RevokeAndAck) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.Revocation[:], c.NextRevocationKey, ) }
[ "func", "(", "c", "*", "RevokeAndAck", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "c", ".", "ChanID", ",", "c", ".", "Revocation", "[", ":", "]", ",", "c", "."...
// Encode serializes the target RevokeAndAck into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "RevokeAndAck", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/revoke_and_ack.go#L60-L66
129,677
lightningnetwork/lnd
macaroons/auth.go
GetRequestMetadata
func (m MacaroonCredential) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { macBytes, err := m.MarshalBinary() if err != nil { return nil, err } md := make(map[string]string) md["macaroon"] = hex.EncodeToString(macBytes) return md, nil }
go
func (m MacaroonCredential) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { macBytes, err := m.MarshalBinary() if err != nil { return nil, err } md := make(map[string]string) md["macaroon"] = hex.EncodeToString(macBytes) return md, nil }
[ "func", "(", "m", "MacaroonCredential", ")", "GetRequestMetadata", "(", "ctx", "context", ".", "Context", ",", "uri", "...", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "macBytes", ",", "err", ":=", "m", ".", "Marsh...
// GetRequestMetadata implements the PerRPCCredentials interface. This method // is required in order to pass the wrapped macaroon into the gRPC context. // With this, the macaroon will be available within the request handling scope // of the ultimate gRPC server implementation.
[ "GetRequestMetadata", "implements", "the", "PerRPCCredentials", "interface", ".", "This", "method", "is", "required", "in", "order", "to", "pass", "the", "wrapped", "macaroon", "into", "the", "gRPC", "context", ".", "With", "this", "the", "macaroon", "will", "be...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/macaroons/auth.go#L26-L37
129,678
lightningnetwork/lnd
macaroons/auth.go
NewMacaroonCredential
func NewMacaroonCredential(m *macaroon.Macaroon) MacaroonCredential { ms := MacaroonCredential{} ms.Macaroon = m.Clone() return ms }
go
func NewMacaroonCredential(m *macaroon.Macaroon) MacaroonCredential { ms := MacaroonCredential{} ms.Macaroon = m.Clone() return ms }
[ "func", "NewMacaroonCredential", "(", "m", "*", "macaroon", ".", "Macaroon", ")", "MacaroonCredential", "{", "ms", ":=", "MacaroonCredential", "{", "}", "\n", "ms", ".", "Macaroon", "=", "m", ".", "Clone", "(", ")", "\n", "return", "ms", "\n", "}" ]
// NewMacaroonCredential returns a copy of the passed macaroon wrapped in a // MacaroonCredential struct which implements PerRPCCredentials.
[ "NewMacaroonCredential", "returns", "a", "copy", "of", "the", "passed", "macaroon", "wrapped", "in", "a", "MacaroonCredential", "struct", "which", "implements", "PerRPCCredentials", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/macaroons/auth.go#L41-L45
129,679
lightningnetwork/lnd
pool/read_buffer.go
NewReadBuffer
func NewReadBuffer(gcInterval, expiryInterval time.Duration) *ReadBuffer { return &ReadBuffer{ pool: NewRecycle( func() interface{} { return new(buffer.Read) }, 100, gcInterval, expiryInterval, ), } }
go
func NewReadBuffer(gcInterval, expiryInterval time.Duration) *ReadBuffer { return &ReadBuffer{ pool: NewRecycle( func() interface{} { return new(buffer.Read) }, 100, gcInterval, expiryInterval, ), } }
[ "func", "NewReadBuffer", "(", "gcInterval", ",", "expiryInterval", "time", ".", "Duration", ")", "*", "ReadBuffer", "{", "return", "&", "ReadBuffer", "{", "pool", ":", "NewRecycle", "(", "func", "(", ")", "interface", "{", "}", "{", "return", "new", "(", ...
// NewReadBuffer returns a freshly instantiated ReadBuffer, using the given // gcInterval and expieryInterval.
[ "NewReadBuffer", "returns", "a", "freshly", "instantiated", "ReadBuffer", "using", "the", "given", "gcInterval", "and", "expieryInterval", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/read_buffer.go#L30-L37
129,680
lightningnetwork/lnd
pool/read_buffer.go
Take
func (p *ReadBuffer) Take() *buffer.Read { return p.pool.Take().(*buffer.Read) }
go
func (p *ReadBuffer) Take() *buffer.Read { return p.pool.Take().(*buffer.Read) }
[ "func", "(", "p", "*", "ReadBuffer", ")", "Take", "(", ")", "*", "buffer", ".", "Read", "{", "return", "p", ".", "pool", ".", "Take", "(", ")", ".", "(", "*", "buffer", ".", "Read", ")", "\n", "}" ]
// Take returns a fresh buffer.Read to the caller.
[ "Take", "returns", "a", "fresh", "buffer", ".", "Read", "to", "the", "caller", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/read_buffer.go#L40-L42
129,681
lightningnetwork/lnd
pool/read_buffer.go
Return
func (p *ReadBuffer) Return(buf *buffer.Read) { p.pool.Return(buf) }
go
func (p *ReadBuffer) Return(buf *buffer.Read) { p.pool.Return(buf) }
[ "func", "(", "p", "*", "ReadBuffer", ")", "Return", "(", "buf", "*", "buffer", ".", "Read", ")", "{", "p", ".", "pool", ".", "Return", "(", "buf", ")", "\n", "}" ]
// Return returns the buffer.Read to the pool, so that it can be cycled or // released.
[ "Return", "returns", "the", "buffer", ".", "Read", "to", "the", "pool", "so", "that", "it", "can", "be", "cycled", "or", "released", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/read_buffer.go#L46-L48
129,682
lightningnetwork/lnd
htlcswitch/iterator.go
makeSphinxHopIterator
func makeSphinxHopIterator(ogPacket *sphinx.OnionPacket, packet *sphinx.ProcessedPacket) *sphinxHopIterator { return &sphinxHopIterator{ ogPacket: ogPacket, processedPacket: packet, } }
go
func makeSphinxHopIterator(ogPacket *sphinx.OnionPacket, packet *sphinx.ProcessedPacket) *sphinxHopIterator { return &sphinxHopIterator{ ogPacket: ogPacket, processedPacket: packet, } }
[ "func", "makeSphinxHopIterator", "(", "ogPacket", "*", "sphinx", ".", "OnionPacket", ",", "packet", "*", "sphinx", ".", "ProcessedPacket", ")", "*", "sphinxHopIterator", "{", "return", "&", "sphinxHopIterator", "{", "ogPacket", ":", "ogPacket", ",", "processedPack...
// makeSphinxHopIterator converts a processed packet returned from a sphinx // router and converts it into an hop iterator for usage in the link.
[ "makeSphinxHopIterator", "converts", "a", "processed", "packet", "returned", "from", "a", "sphinx", "router", "and", "converts", "it", "into", "an", "hop", "iterator", "for", "usage", "in", "the", "link", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/iterator.go#L116-L123
129,683
lightningnetwork/lnd
htlcswitch/iterator.go
DecodeHopIterator
func (p *OnionProcessor) DecodeHopIterator(r io.Reader, rHash []byte, incomingCltv uint32) (HopIterator, lnwire.FailCode) { onionPkt := &sphinx.OnionPacket{} if err := onionPkt.Decode(r); err != nil { switch err { case sphinx.ErrInvalidOnionVersion: return nil, lnwire.CodeInvalidOnionVersion case sphinx.Er...
go
func (p *OnionProcessor) DecodeHopIterator(r io.Reader, rHash []byte, incomingCltv uint32) (HopIterator, lnwire.FailCode) { onionPkt := &sphinx.OnionPacket{} if err := onionPkt.Decode(r); err != nil { switch err { case sphinx.ErrInvalidOnionVersion: return nil, lnwire.CodeInvalidOnionVersion case sphinx.Er...
[ "func", "(", "p", "*", "OnionProcessor", ")", "DecodeHopIterator", "(", "r", "io", ".", "Reader", ",", "rHash", "[", "]", "byte", ",", "incomingCltv", "uint32", ")", "(", "HopIterator", ",", "lnwire", ".", "FailCode", ")", "{", "onionPkt", ":=", "&", "...
// DecodeHopIterator attempts to decode a valid sphinx packet from the passed io.Reader // instance using the rHash as the associated data when checking the relevant // MACs during the decoding process.
[ "DecodeHopIterator", "attempts", "to", "decode", "a", "valid", "sphinx", "packet", "from", "the", "passed", "io", ".", "Reader", "instance", "using", "the", "rHash", "as", "the", "associated", "data", "when", "checking", "the", "relevant", "MACs", "during", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/iterator.go#L206-L245
129,684
lightningnetwork/lnd
htlcswitch/iterator.go
ExtractErrorEncrypter
func (p *OnionProcessor) ExtractErrorEncrypter(ephemeralKey *btcec.PublicKey) ( ErrorEncrypter, lnwire.FailCode) { onionObfuscator, err := sphinx.NewOnionErrorEncrypter( p.router, ephemeralKey, ) if err != nil { switch err { case sphinx.ErrInvalidOnionVersion: return nil, lnwire.CodeInvalidOnionVersion ...
go
func (p *OnionProcessor) ExtractErrorEncrypter(ephemeralKey *btcec.PublicKey) ( ErrorEncrypter, lnwire.FailCode) { onionObfuscator, err := sphinx.NewOnionErrorEncrypter( p.router, ephemeralKey, ) if err != nil { switch err { case sphinx.ErrInvalidOnionVersion: return nil, lnwire.CodeInvalidOnionVersion ...
[ "func", "(", "p", "*", "OnionProcessor", ")", "ExtractErrorEncrypter", "(", "ephemeralKey", "*", "btcec", ".", "PublicKey", ")", "(", "ErrorEncrypter", ",", "lnwire", ".", "FailCode", ")", "{", "onionObfuscator", ",", "err", ":=", "sphinx", ".", "NewOnionError...
// ExtractErrorEncrypter takes an io.Reader which should contain the onion // packet as original received by a forwarding node and creates an // ErrorEncrypter instance using the derived shared secret. In the case that en // error occurs, a lnwire failure code detailing the parsing failure will be // returned.
[ "ExtractErrorEncrypter", "takes", "an", "io", ".", "Reader", "which", "should", "contain", "the", "onion", "packet", "as", "original", "received", "by", "a", "forwarding", "node", "and", "creates", "an", "ErrorEncrypter", "instance", "using", "the", "derived", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/iterator.go#L405-L429
129,685
lightningnetwork/lnd
utxonursery.go
Start
func (u *utxoNursery) Start() error { if !atomic.CompareAndSwapUint32(&u.started, 0, 1) { return nil } utxnLog.Tracef("Starting UTXO nursery") // Retrieve the currently best known block. This is needed to have the // state machine catch up with the blocks we missed when we were down. bestHash, bestHeight, err...
go
func (u *utxoNursery) Start() error { if !atomic.CompareAndSwapUint32(&u.started, 0, 1) { return nil } utxnLog.Tracef("Starting UTXO nursery") // Retrieve the currently best known block. This is needed to have the // state machine catch up with the blocks we missed when we were down. bestHash, bestHeight, err...
[ "func", "(", "u", "*", "utxoNursery", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "u", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "utxnLog", ".", "Tracef",...
// Start launches all goroutines the utxoNursery needs to properly carry out // its duties.
[ "Start", "launches", "all", "goroutines", "the", "utxoNursery", "needs", "to", "properly", "carry", "out", "its", "duties", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L234-L306
129,686
lightningnetwork/lnd
utxonursery.go
Stop
func (u *utxoNursery) Stop() error { if !atomic.CompareAndSwapUint32(&u.stopped, 0, 1) { return nil } utxnLog.Infof("UTXO nursery shutting down") close(u.quit) u.wg.Wait() return nil }
go
func (u *utxoNursery) Stop() error { if !atomic.CompareAndSwapUint32(&u.stopped, 0, 1) { return nil } utxnLog.Infof("UTXO nursery shutting down") close(u.quit) u.wg.Wait() return nil }
[ "func", "(", "u", "*", "utxoNursery", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "u", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "utxnLog", ".", "Infof", ...
// Stop gracefully shuts down any lingering goroutines launched during normal // operation of the utxoNursery.
[ "Stop", "gracefully", "shuts", "down", "any", "lingering", "goroutines", "launched", "during", "normal", "operation", "of", "the", "utxoNursery", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L310-L321
129,687
lightningnetwork/lnd
utxonursery.go
reloadPreschool
func (u *utxoNursery) reloadPreschool() error { psclOutputs, err := u.cfg.Store.FetchPreschools() if err != nil { return err } // For each of the preschool outputs stored in the nursery store, load // its close summary from disk so that we can get an accurate height // hint from which to start our range for sp...
go
func (u *utxoNursery) reloadPreschool() error { psclOutputs, err := u.cfg.Store.FetchPreschools() if err != nil { return err } // For each of the preschool outputs stored in the nursery store, load // its close summary from disk so that we can get an accurate height // hint from which to start our range for sp...
[ "func", "(", "u", "*", "utxoNursery", ")", "reloadPreschool", "(", ")", "error", "{", "psclOutputs", ",", "err", ":=", "u", ".", "cfg", ".", "Store", ".", "FetchPreschools", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", ...
// reloadPreschool re-initializes the chain notifier with all of the outputs // that had been saved to the "preschool" database bucket prior to shutdown.
[ "reloadPreschool", "re", "-", "initializes", "the", "chain", "notifier", "with", "all", "of", "the", "outputs", "that", "had", "been", "saved", "to", "the", "preschool", "database", "bucket", "prior", "to", "shutdown", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L617-L656
129,688
lightningnetwork/lnd
utxonursery.go
reloadClasses
func (u *utxoNursery) reloadClasses(bestHeight uint32) error { // Loading all active heights up to and including the current block. activeHeights, err := u.cfg.Store.HeightsBelowOrEqual( uint32(bestHeight)) if err != nil { return err } // Return early if nothing to sweep. if len(activeHeights) == 0 { retur...
go
func (u *utxoNursery) reloadClasses(bestHeight uint32) error { // Loading all active heights up to and including the current block. activeHeights, err := u.cfg.Store.HeightsBelowOrEqual( uint32(bestHeight)) if err != nil { return err } // Return early if nothing to sweep. if len(activeHeights) == 0 { retur...
[ "func", "(", "u", "*", "utxoNursery", ")", "reloadClasses", "(", "bestHeight", "uint32", ")", "error", "{", "// Loading all active heights up to and including the current block.", "activeHeights", ",", "err", ":=", "u", ".", "cfg", ".", "Store", ".", "HeightsBelowOrEq...
// reloadClasses reinitializes any height-dependent state transitions for which // the utxonursery has not received confirmation, and replays the graduation of // all kindergarten and crib outputs for all heights up to the current block. // This allows the nursery to reinitialize all state to continue sweeping // outpu...
[ "reloadClasses", "reinitializes", "any", "height", "-", "dependent", "state", "transitions", "for", "which", "the", "utxonursery", "has", "not", "received", "confirmation", "and", "replays", "the", "graduation", "of", "all", "kindergarten", "and", "crib", "outputs",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L664-L696
129,689
lightningnetwork/lnd
utxonursery.go
incubator
func (u *utxoNursery) incubator(newBlockChan *chainntnfs.BlockEpochEvent) { defer u.wg.Done() defer newBlockChan.Cancel() for { select { case epoch, ok := <-newBlockChan.Epochs: // If the epoch channel has been closed, then the // ChainNotifier is exiting which means the daemon is // as well. Therefore...
go
func (u *utxoNursery) incubator(newBlockChan *chainntnfs.BlockEpochEvent) { defer u.wg.Done() defer newBlockChan.Cancel() for { select { case epoch, ok := <-newBlockChan.Epochs: // If the epoch channel has been closed, then the // ChainNotifier is exiting which means the daemon is // as well. Therefore...
[ "func", "(", "u", "*", "utxoNursery", ")", "incubator", "(", "newBlockChan", "*", "chainntnfs", ".", "BlockEpochEvent", ")", "{", "defer", "u", ".", "wg", ".", "Done", "(", ")", "\n", "defer", "newBlockChan", ".", "Cancel", "(", ")", "\n\n", "for", "{"...
// incubator is tasked with driving all state transitions that are dependent on // the current height of the blockchain. As new blocks arrive, the incubator // will attempt spend outputs at the latest height. The asynchronous // confirmation of these spends will either 1) move a crib output into the // kindergarten buc...
[ "incubator", "is", "tasked", "with", "driving", "all", "state", "transitions", "that", "are", "dependent", "on", "the", "current", "height", "of", "the", "blockchain", ".", "As", "new", "blocks", "arrive", "the", "incubator", "will", "attempt", "spend", "outpu...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L704-L746
129,690
lightningnetwork/lnd
utxonursery.go
graduateClass
func (u *utxoNursery) graduateClass(classHeight uint32) error { // Record this height as the nursery's current best height. u.mu.Lock() defer u.mu.Unlock() // Fetch all information about the crib and kindergarten outputs at // this height. kgtnOutputs, cribOutputs, err := u.cfg.Store.FetchClass( classHeight) ...
go
func (u *utxoNursery) graduateClass(classHeight uint32) error { // Record this height as the nursery's current best height. u.mu.Lock() defer u.mu.Unlock() // Fetch all information about the crib and kindergarten outputs at // this height. kgtnOutputs, cribOutputs, err := u.cfg.Store.FetchClass( classHeight) ...
[ "func", "(", "u", "*", "utxoNursery", ")", "graduateClass", "(", "classHeight", "uint32", ")", "error", "{", "// Record this height as the nursery's current best height.", "u", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "mu", ".", "Unlock", "("...
// graduateClass handles the steps involved in spending outputs whose CSV or // CLTV delay expires at the nursery's current height. This method is called // each time a new block arrives, or during startup to catch up on heights we // may have missed while the nursery was offline.
[ "graduateClass", "handles", "the", "steps", "involved", "in", "spending", "outputs", "whose", "CSV", "or", "CLTV", "delay", "expires", "at", "the", "nursery", "s", "current", "height", ".", "This", "method", "is", "called", "each", "time", "a", "new", "block...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L752-L793
129,691
lightningnetwork/lnd
utxonursery.go
sweepCribOutput
func (u *utxoNursery) sweepCribOutput(classHeight uint32, baby *babyOutput) error { utxnLog.Infof("Publishing CLTV-delayed HTLC output using timeout tx "+ "(txid=%v): %v", baby.timeoutTx.TxHash(), newLogClosure(func() string { return spew.Sdump(baby.timeoutTx) }), ) // We'll now broadcast the HTLC transact...
go
func (u *utxoNursery) sweepCribOutput(classHeight uint32, baby *babyOutput) error { utxnLog.Infof("Publishing CLTV-delayed HTLC output using timeout tx "+ "(txid=%v): %v", baby.timeoutTx.TxHash(), newLogClosure(func() string { return spew.Sdump(baby.timeoutTx) }), ) // We'll now broadcast the HTLC transact...
[ "func", "(", "u", "*", "utxoNursery", ")", "sweepCribOutput", "(", "classHeight", "uint32", ",", "baby", "*", "babyOutput", ")", "error", "{", "utxnLog", ".", "Infof", "(", "\"", "\"", "+", "\"", "\"", ",", "baby", ".", "timeoutTx", ".", "TxHash", "(",...
// sweepCribOutput broadcasts the crib output's htlc timeout txn, and sets up a // notification that will advance it to the kindergarten bucket upon // confirmation.
[ "sweepCribOutput", "broadcasts", "the", "crib", "output", "s", "htlc", "timeout", "txn", "and", "sets", "up", "a", "notification", "that", "will", "advance", "it", "to", "the", "kindergarten", "bucket", "upon", "confirmation", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L886-L904
129,692
lightningnetwork/lnd
utxonursery.go
registerTimeoutConf
func (u *utxoNursery) registerTimeoutConf(baby *babyOutput, heightHint uint32) error { birthTxID := baby.timeoutTx.TxHash() // Register for the confirmation of presigned htlc txn. confChan, err := u.cfg.Notifier.RegisterConfirmationsNtfn( &birthTxID, baby.timeoutTx.TxOut[0].PkScript, u.cfg.ConfDepth, heightHin...
go
func (u *utxoNursery) registerTimeoutConf(baby *babyOutput, heightHint uint32) error { birthTxID := baby.timeoutTx.TxHash() // Register for the confirmation of presigned htlc txn. confChan, err := u.cfg.Notifier.RegisterConfirmationsNtfn( &birthTxID, baby.timeoutTx.TxOut[0].PkScript, u.cfg.ConfDepth, heightHin...
[ "func", "(", "u", "*", "utxoNursery", ")", "registerTimeoutConf", "(", "baby", "*", "babyOutput", ",", "heightHint", "uint32", ")", "error", "{", "birthTxID", ":=", "baby", ".", "timeoutTx", ".", "TxHash", "(", ")", "\n\n", "// Register for the confirmation of p...
// registerTimeoutConf is responsible for subscribing to confirmation // notification for an htlc timeout transaction. If successful, a goroutine // will be spawned that will transition the provided baby output into the // kindergarten state within the nursery store.
[ "registerTimeoutConf", "is", "responsible", "for", "subscribing", "to", "confirmation", "notification", "for", "an", "htlc", "timeout", "transaction", ".", "If", "successful", "a", "goroutine", "will", "be", "spawned", "that", "will", "transition", "the", "provided"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L910-L930
129,693
lightningnetwork/lnd
utxonursery.go
waitForTimeoutConf
func (u *utxoNursery) waitForTimeoutConf(baby *babyOutput, confChan *chainntnfs.ConfirmationEvent) { defer u.wg.Done() select { case txConfirmation, ok := <-confChan.Confirmed: if !ok { utxnLog.Errorf("Notification chan "+ "closed, can't advance baby output %v", baby.OutPoint()) return } baby...
go
func (u *utxoNursery) waitForTimeoutConf(baby *babyOutput, confChan *chainntnfs.ConfirmationEvent) { defer u.wg.Done() select { case txConfirmation, ok := <-confChan.Confirmed: if !ok { utxnLog.Errorf("Notification chan "+ "closed, can't advance baby output %v", baby.OutPoint()) return } baby...
[ "func", "(", "u", "*", "utxoNursery", ")", "waitForTimeoutConf", "(", "baby", "*", "babyOutput", ",", "confChan", "*", "chainntnfs", ".", "ConfirmationEvent", ")", "{", "defer", "u", ".", "wg", ".", "Done", "(", ")", "\n\n", "select", "{", "case", "txCon...
// waitForTimeoutConf watches for the confirmation of an htlc timeout // transaction, and attempts to move the htlc output from the crib bucket to the // kindergarten bucket upon success.
[ "waitForTimeoutConf", "watches", "for", "the", "confirmation", "of", "an", "htlc", "timeout", "transaction", "and", "attempts", "to", "move", "the", "htlc", "output", "from", "the", "crib", "bucket", "to", "the", "kindergarten", "bucket", "upon", "success", "." ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L935-L969
129,694
lightningnetwork/lnd
utxonursery.go
registerPreschoolConf
func (u *utxoNursery) registerPreschoolConf(kid *kidOutput, heightHint uint32) error { txID := kid.OutPoint().Hash // TODO(roasbeef): ensure we don't already have one waiting, need to // de-duplicate // * need to do above? pkScript := kid.signDesc.Output.PkScript confChan, err := u.cfg.Notifier.RegisterConfirm...
go
func (u *utxoNursery) registerPreschoolConf(kid *kidOutput, heightHint uint32) error { txID := kid.OutPoint().Hash // TODO(roasbeef): ensure we don't already have one waiting, need to // de-duplicate // * need to do above? pkScript := kid.signDesc.Output.PkScript confChan, err := u.cfg.Notifier.RegisterConfirm...
[ "func", "(", "u", "*", "utxoNursery", ")", "registerPreschoolConf", "(", "kid", "*", "kidOutput", ",", "heightHint", "uint32", ")", "error", "{", "txID", ":=", "kid", ".", "OutPoint", "(", ")", ".", "Hash", "\n\n", "// TODO(roasbeef): ensure we don't already hav...
// registerPreschoolConf is responsible for subscribing to the confirmation of // a commitment transaction, or an htlc success transaction for an incoming // HTLC on our commitment transaction.. If successful, the provided preschool // output will be moved persistently into the kindergarten state within the // nursery ...
[ "registerPreschoolConf", "is", "responsible", "for", "subscribing", "to", "the", "confirmation", "of", "a", "commitment", "transaction", "or", "an", "htlc", "success", "transaction", "for", "an", "incoming", "HTLC", "on", "our", "commitment", "transaction", "..", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L976-L1005
129,695
lightningnetwork/lnd
utxonursery.go
AddLimboCommitment
func (c *contractMaturityReport) AddLimboCommitment(kid *kidOutput) { c.limboBalance += kid.Amount() // If the confirmation height is set, then this means the contract has // been confirmed, and we know the final maturity height. if kid.ConfHeight() != 0 { c.maturityHeight = kid.BlocksToMaturity() + kid.ConfHeig...
go
func (c *contractMaturityReport) AddLimboCommitment(kid *kidOutput) { c.limboBalance += kid.Amount() // If the confirmation height is set, then this means the contract has // been confirmed, and we know the final maturity height. if kid.ConfHeight() != 0 { c.maturityHeight = kid.BlocksToMaturity() + kid.ConfHeig...
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddLimboCommitment", "(", "kid", "*", "kidOutput", ")", "{", "c", ".", "limboBalance", "+=", "kid", ".", "Amount", "(", ")", "\n\n", "// If the confirmation height is set, then this means the contract has", "// be...
// AddLimboCommitment adds an incubating commitment output to maturity // report's htlcs, and contributes its amount to the limbo balance.
[ "AddLimboCommitment", "adds", "an", "incubating", "commitment", "output", "to", "maturity", "report", "s", "htlcs", "and", "contributes", "its", "amount", "to", "the", "limbo", "balance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1097-L1105
129,696
lightningnetwork/lnd
utxonursery.go
AddRecoveredCommitment
func (c *contractMaturityReport) AddRecoveredCommitment(kid *kidOutput) { c.recoveredBalance += kid.Amount() c.maturityHeight = kid.BlocksToMaturity() + kid.ConfHeight() }
go
func (c *contractMaturityReport) AddRecoveredCommitment(kid *kidOutput) { c.recoveredBalance += kid.Amount() c.maturityHeight = kid.BlocksToMaturity() + kid.ConfHeight() }
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddRecoveredCommitment", "(", "kid", "*", "kidOutput", ")", "{", "c", ".", "recoveredBalance", "+=", "kid", ".", "Amount", "(", ")", "\n\n", "c", ".", "maturityHeight", "=", "kid", ".", "BlocksToMaturity...
// AddRecoveredCommitment adds a graduated commitment output to maturity // report's htlcs, and contributes its amount to the recovered balance.
[ "AddRecoveredCommitment", "adds", "a", "graduated", "commitment", "output", "to", "maturity", "report", "s", "htlcs", "and", "contributes", "its", "amount", "to", "the", "recovered", "balance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1109-L1113
129,697
lightningnetwork/lnd
utxonursery.go
AddLimboStage1TimeoutHtlc
func (c *contractMaturityReport) AddLimboStage1TimeoutHtlc(baby *babyOutput) { c.limboBalance += baby.Amount() // TODO(roasbeef): bool to indicate stage 1 vs stage 2? c.htlcs = append(c.htlcs, htlcMaturityReport{ outpoint: *baby.OutPoint(), amount: baby.Amount(), maturityHeight: baby.expiry, s...
go
func (c *contractMaturityReport) AddLimboStage1TimeoutHtlc(baby *babyOutput) { c.limboBalance += baby.Amount() // TODO(roasbeef): bool to indicate stage 1 vs stage 2? c.htlcs = append(c.htlcs, htlcMaturityReport{ outpoint: *baby.OutPoint(), amount: baby.Amount(), maturityHeight: baby.expiry, s...
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddLimboStage1TimeoutHtlc", "(", "baby", "*", "babyOutput", ")", "{", "c", ".", "limboBalance", "+=", "baby", ".", "Amount", "(", ")", "\n\n", "// TODO(roasbeef): bool to indicate stage 1 vs stage 2?", "c", ".",...
// AddLimboStage1TimeoutHtlc adds an htlc crib output to the maturity report's // htlcs, and contributes its amount to the limbo balance.
[ "AddLimboStage1TimeoutHtlc", "adds", "an", "htlc", "crib", "output", "to", "the", "maturity", "report", "s", "htlcs", "and", "contributes", "its", "amount", "to", "the", "limbo", "balance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1117-L1127
129,698
lightningnetwork/lnd
utxonursery.go
AddLimboDirectHtlc
func (c *contractMaturityReport) AddLimboDirectHtlc(kid *kidOutput) { c.limboBalance += kid.Amount() htlcReport := htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), maturityHeight: kid.absoluteMaturity, stage: 2, } c.htlcs = append(c.htlcs, htlcReport) }
go
func (c *contractMaturityReport) AddLimboDirectHtlc(kid *kidOutput) { c.limboBalance += kid.Amount() htlcReport := htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), maturityHeight: kid.absoluteMaturity, stage: 2, } c.htlcs = append(c.htlcs, htlcReport) }
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddLimboDirectHtlc", "(", "kid", "*", "kidOutput", ")", "{", "c", ".", "limboBalance", "+=", "kid", ".", "Amount", "(", ")", "\n\n", "htlcReport", ":=", "htlcMaturityReport", "{", "outpoint", ":", "*", ...
// AddLimboDirectHtlc adds a direct HTLC on the commitment transaction of the // remote party to the maturity report. This a CLTV time-locked output that // has or hasn't expired yet.
[ "AddLimboDirectHtlc", "adds", "a", "direct", "HTLC", "on", "the", "commitment", "transaction", "of", "the", "remote", "party", "to", "the", "maturity", "report", ".", "This", "a", "CLTV", "time", "-", "locked", "output", "that", "has", "or", "hasn", "t", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1132-L1143
129,699
lightningnetwork/lnd
utxonursery.go
AddLimboStage1SuccessHtlc
func (c *contractMaturityReport) AddLimboStage1SuccessHtlc(kid *kidOutput) { c.limboBalance += kid.Amount() c.htlcs = append(c.htlcs, htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), stage: 1, }) }
go
func (c *contractMaturityReport) AddLimboStage1SuccessHtlc(kid *kidOutput) { c.limboBalance += kid.Amount() c.htlcs = append(c.htlcs, htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), stage: 1, }) }
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddLimboStage1SuccessHtlc", "(", "kid", "*", "kidOutput", ")", "{", "c", ".", "limboBalance", "+=", "kid", ".", "Amount", "(", ")", "\n\n", "c", ".", "htlcs", "=", "append", "(", "c", ".", "htlcs", ...
// AddLimboStage1SuccessHtlcHtlc adds an htlc crib output to the maturity // report's set of HTLC's. We'll use this to report any incoming HTLC sweeps // where the second level transaction hasn't yet confirmed.
[ "AddLimboStage1SuccessHtlcHtlc", "adds", "an", "htlc", "crib", "output", "to", "the", "maturity", "report", "s", "set", "of", "HTLC", "s", ".", "We", "ll", "use", "this", "to", "report", "any", "incoming", "HTLC", "sweeps", "where", "the", "second", "level",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1148-L1156