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
128,500
lightningnetwork/lnd
htlcswitch/decayedlog.go
initBuckets
func (d *DecayedLog) initBuckets() error { return d.db.Update(func(tx *bbolt.Tx) error { _, err := tx.CreateBucketIfNotExists(sharedHashBucket) if err != nil { return ErrDecayedLogInit } _, err = tx.CreateBucketIfNotExists(batchReplayBucket) if err != nil { return ErrDecayedLogInit } return nil ...
go
func (d *DecayedLog) initBuckets() error { return d.db.Update(func(tx *bbolt.Tx) error { _, err := tx.CreateBucketIfNotExists(sharedHashBucket) if err != nil { return ErrDecayedLogInit } _, err = tx.CreateBucketIfNotExists(batchReplayBucket) if err != nil { return ErrDecayedLogInit } return nil ...
[ "func", "(", "d", "*", "DecayedLog", ")", "initBuckets", "(", ")", "error", "{", "return", "d", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "CreateBucketIfNotExists...
// initBuckets initializes the primary buckets used by the decayed log, namely // the shared hash bucket, and batch replay
[ "initBuckets", "initializes", "the", "primary", "buckets", "used", "by", "the", "decayed", "log", "namely", "the", "shared", "hash", "bucket", "and", "batch", "replay" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/decayedlog.go#L121-L135
128,501
lightningnetwork/lnd
htlcswitch/decayedlog.go
Stop
func (d *DecayedLog) Stop() error { if !atomic.CompareAndSwapInt32(&d.stopped, 0, 1) { return nil } // Stop garbage collector. close(d.quit) d.wg.Wait() // Close boltdb. d.db.Close() return nil }
go
func (d *DecayedLog) Stop() error { if !atomic.CompareAndSwapInt32(&d.stopped, 0, 1) { return nil } // Stop garbage collector. close(d.quit) d.wg.Wait() // Close boltdb. d.db.Close() return nil }
[ "func", "(", "d", "*", "DecayedLog", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapInt32", "(", "&", "d", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "// Stop garbage collector.", ...
// Stop halts the garbage collector and closes boltdb.
[ "Stop", "halts", "the", "garbage", "collector", "and", "closes", "boltdb", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/decayedlog.go#L138-L152
128,502
lightningnetwork/lnd
htlcswitch/decayedlog.go
garbageCollector
func (d *DecayedLog) garbageCollector(epochClient *chainntnfs.BlockEpochEvent) { defer d.wg.Done() defer epochClient.Cancel() for { select { case epoch, ok := <-epochClient.Epochs: if !ok { // Block epoch was canceled, shutting down. log.Infof("Block epoch canceled, " + "decaying hash log shutti...
go
func (d *DecayedLog) garbageCollector(epochClient *chainntnfs.BlockEpochEvent) { defer d.wg.Done() defer epochClient.Cancel() for { select { case epoch, ok := <-epochClient.Epochs: if !ok { // Block epoch was canceled, shutting down. log.Infof("Block epoch canceled, " + "decaying hash log shutti...
[ "func", "(", "d", "*", "DecayedLog", ")", "garbageCollector", "(", "epochClient", "*", "chainntnfs", ".", "BlockEpochEvent", ")", "{", "defer", "d", ".", "wg", ".", "Done", "(", ")", "\n", "defer", "epochClient", ".", "Cancel", "(", ")", "\n\n", "for", ...
// garbageCollector deletes entries from sharedHashBucket whose expiry height // has already past. This function MUST be run as a goroutine.
[ "garbageCollector", "deletes", "entries", "from", "sharedHashBucket", "whose", "expiry", "height", "has", "already", "past", ".", "This", "function", "MUST", "be", "run", "as", "a", "goroutine", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/decayedlog.go#L156-L192
128,503
lightningnetwork/lnd
htlcswitch/decayedlog.go
gcExpiredHashes
func (d *DecayedLog) gcExpiredHashes(height uint32) (uint32, error) { var numExpiredHashes uint32 err := d.db.Batch(func(tx *bbolt.Tx) error { numExpiredHashes = 0 // Grab the shared hash bucket sharedHashes := tx.Bucket(sharedHashBucket) if sharedHashes == nil { return fmt.Errorf("sharedHashBucket " + ...
go
func (d *DecayedLog) gcExpiredHashes(height uint32) (uint32, error) { var numExpiredHashes uint32 err := d.db.Batch(func(tx *bbolt.Tx) error { numExpiredHashes = 0 // Grab the shared hash bucket sharedHashes := tx.Bucket(sharedHashBucket) if sharedHashes == nil { return fmt.Errorf("sharedHashBucket " + ...
[ "func", "(", "d", "*", "DecayedLog", ")", "gcExpiredHashes", "(", "height", "uint32", ")", "(", "uint32", ",", "error", ")", "{", "var", "numExpiredHashes", "uint32", "\n\n", "err", ":=", "d", ".", "db", ".", "Batch", "(", "func", "(", "tx", "*", "bb...
// gcExpiredHashes purges the decaying log of all entries whose CLTV expires // below the provided height.
[ "gcExpiredHashes", "purges", "the", "decaying", "log", "of", "all", "entries", "whose", "CLTV", "expires", "below", "the", "provided", "height", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/decayedlog.go#L196-L244
128,504
lightningnetwork/lnd
htlcswitch/decayedlog.go
Get
func (d *DecayedLog) Get(hash *sphinx.HashPrefix) (uint32, error) { var value uint32 err := d.db.View(func(tx *bbolt.Tx) error { // Grab the shared hash bucket which stores the mapping from // truncated sha-256 hashes of shared secrets to CLTV's. sharedHashes := tx.Bucket(sharedHashBucket) if sharedHashes ==...
go
func (d *DecayedLog) Get(hash *sphinx.HashPrefix) (uint32, error) { var value uint32 err := d.db.View(func(tx *bbolt.Tx) error { // Grab the shared hash bucket which stores the mapping from // truncated sha-256 hashes of shared secrets to CLTV's. sharedHashes := tx.Bucket(sharedHashBucket) if sharedHashes ==...
[ "func", "(", "d", "*", "DecayedLog", ")", "Get", "(", "hash", "*", "sphinx", ".", "HashPrefix", ")", "(", "uint32", ",", "error", ")", "{", "var", "value", "uint32", "\n\n", "err", ":=", "d", ".", "db", ".", "View", "(", "func", "(", "tx", "*", ...
// Get retrieves the CLTV of a processed HTLC given the first 20 bytes of the // Sha-256 hash of the shared secret.
[ "Get", "retrieves", "the", "CLTV", "of", "a", "processed", "HTLC", "given", "the", "first", "20", "bytes", "of", "the", "Sha", "-", "256", "hash", "of", "the", "shared", "secret", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/decayedlog.go#L261-L289
128,505
lightningnetwork/lnd
htlcswitch/decayedlog.go
Put
func (d *DecayedLog) Put(hash *sphinx.HashPrefix, cltv uint32) error { // Optimisitically serialize the cltv value into the scratch buffer. var scratch [4]byte binary.BigEndian.PutUint32(scratch[:], cltv) return d.db.Batch(func(tx *bbolt.Tx) error { sharedHashes := tx.Bucket(sharedHashBucket) if sharedHashes =...
go
func (d *DecayedLog) Put(hash *sphinx.HashPrefix, cltv uint32) error { // Optimisitically serialize the cltv value into the scratch buffer. var scratch [4]byte binary.BigEndian.PutUint32(scratch[:], cltv) return d.db.Batch(func(tx *bbolt.Tx) error { sharedHashes := tx.Bucket(sharedHashBucket) if sharedHashes =...
[ "func", "(", "d", "*", "DecayedLog", ")", "Put", "(", "hash", "*", "sphinx", ".", "HashPrefix", ",", "cltv", "uint32", ")", "error", "{", "// Optimisitically serialize the cltv value into the scratch buffer.", "var", "scratch", "[", "4", "]", "byte", "\n", "bina...
// Put stores a shared secret hash as the key and the CLTV as the value.
[ "Put", "stores", "a", "shared", "secret", "hash", "as", "the", "key", "and", "the", "CLTV", "as", "the", "value", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/decayedlog.go#L292-L312
128,506
lightningnetwork/lnd
watchtower/wtmock/keyring.go
DerivePrivKey
func (m *SecretKeyRing) DerivePrivKey( desc keychain.KeyDescriptor) (*btcec.PrivateKey, error) { m.mu.Lock() defer m.mu.Unlock() if key, ok := m.keys[desc.KeyLocator]; ok { return key, nil } privKey, err := btcec.NewPrivateKey(btcec.S256()) if err != nil { return nil, err } m.keys[desc.KeyLocator] = pr...
go
func (m *SecretKeyRing) DerivePrivKey( desc keychain.KeyDescriptor) (*btcec.PrivateKey, error) { m.mu.Lock() defer m.mu.Unlock() if key, ok := m.keys[desc.KeyLocator]; ok { return key, nil } privKey, err := btcec.NewPrivateKey(btcec.S256()) if err != nil { return nil, err } m.keys[desc.KeyLocator] = pr...
[ "func", "(", "m", "*", "SecretKeyRing", ")", "DerivePrivKey", "(", "desc", "keychain", ".", "KeyDescriptor", ")", "(", "*", "btcec", ".", "PrivateKey", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", "....
// DerivePrivKey derives the private key for a given key descriptor. If // this method is called twice with the same argument, it will return the same // private key.
[ "DerivePrivKey", "derives", "the", "private", "key", "for", "a", "given", "key", "descriptor", ".", "If", "this", "method", "is", "called", "twice", "with", "the", "same", "argument", "it", "will", "return", "the", "same", "private", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/keyring.go#L26-L44
128,507
lightningnetwork/lnd
chainntnfs/neutrinonotify/neutrino_dev.go
UnsafeStart
func (n *NeutrinoNotifier) UnsafeStart(bestHeight int32, bestHash *chainhash.Hash, syncHeight int32, generateBlocks func() error) error { // We'll obtain the latest block height of the p2p node. We'll // start the auto-rescan from this point. Once a caller actually wishes // to register a chain view, the rescan s...
go
func (n *NeutrinoNotifier) UnsafeStart(bestHeight int32, bestHash *chainhash.Hash, syncHeight int32, generateBlocks func() error) error { // We'll obtain the latest block height of the p2p node. We'll // start the auto-rescan from this point. Once a caller actually wishes // to register a chain view, the rescan s...
[ "func", "(", "n", "*", "NeutrinoNotifier", ")", "UnsafeStart", "(", "bestHeight", "int32", ",", "bestHash", "*", "chainhash", ".", "Hash", ",", "syncHeight", "int32", ",", "generateBlocks", "func", "(", ")", "error", ")", "error", "{", "// We'll obtain the lat...
// UnsafeStart starts the notifier with a specified best height and optional // best hash. Its bestHeight, txNotifier and neutrino node are initialized with // bestHeight. The parameter generateBlocks is necessary for the bitcoind // notifier to ensure we drain all notifications up to syncHeight, since if they // are g...
[ "UnsafeStart", "starts", "the", "notifier", "with", "a", "specified", "best", "height", "and", "optional", "best", "hash", ".", "Its", "bestHeight", "txNotifier", "and", "neutrino", "node", "are", "initialized", "with", "bestHeight", ".", "The", "parameter", "ge...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/neutrinonotify/neutrino_dev.go#L21-L104
128,508
lightningnetwork/lnd
chanbackup/recover.go
Recover
func Recover(backups []Single, restorer ChannelRestorer, peerConnector PeerConnector) error { for _, backup := range backups { log.Infof("Restoring ChannelPoint(%v) to disk: ", backup.FundingOutpoint) err := restorer.RestoreChansFromSingles(backup) if err != nil { return err } log.Infof("Attempting...
go
func Recover(backups []Single, restorer ChannelRestorer, peerConnector PeerConnector) error { for _, backup := range backups { log.Infof("Restoring ChannelPoint(%v) to disk: ", backup.FundingOutpoint) err := restorer.RestoreChansFromSingles(backup) if err != nil { return err } log.Infof("Attempting...
[ "func", "Recover", "(", "backups", "[", "]", "Single", ",", "restorer", "ChannelRestorer", ",", "peerConnector", "PeerConnector", ")", "error", "{", "for", "_", ",", "backup", ":=", "range", "backups", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "bac...
// Recover attempts to recover the static channel state from a set of static // channel backups. If successfully, the database will be populated with a // series of "shell" channels. These "shell" channels cannot be used to operate // the channel as normal, but instead are meant to be used to enter the data // loss rec...
[ "Recover", "attempts", "to", "recover", "the", "static", "channel", "state", "from", "a", "set", "of", "static", "channel", "backups", ".", "If", "successfully", "the", "database", "will", "be", "populated", "with", "a", "series", "of", "shell", "channels", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/recover.go#L42-L76
128,509
lightningnetwork/lnd
chanbackup/recover.go
UnpackAndRecoverMulti
func UnpackAndRecoverMulti(packedMulti PackedMulti, keyChain keychain.KeyRing, restorer ChannelRestorer, peerConnector PeerConnector) error { chanBackups, err := packedMulti.Unpack(keyChain) if err != nil { return err } return Recover(chanBackups.StaticBackups, restorer, peerConnector) }
go
func UnpackAndRecoverMulti(packedMulti PackedMulti, keyChain keychain.KeyRing, restorer ChannelRestorer, peerConnector PeerConnector) error { chanBackups, err := packedMulti.Unpack(keyChain) if err != nil { return err } return Recover(chanBackups.StaticBackups, restorer, peerConnector) }
[ "func", "UnpackAndRecoverMulti", "(", "packedMulti", "PackedMulti", ",", "keyChain", "keychain", ".", "KeyRing", ",", "restorer", "ChannelRestorer", ",", "peerConnector", "PeerConnector", ")", "error", "{", "chanBackups", ",", "err", ":=", "packedMulti", ".", "Unpac...
// UnpackAndRecoverMulti is a one-shot method, that given a set of packed // multi-channel backups, will restore the channel states to channel shells, // and also reach out to connect to any of the known node addresses for that // channel. It is assumes that after this method exists, if a connection we // able to be es...
[ "UnpackAndRecoverMulti", "is", "a", "one", "-", "shot", "method", "that", "given", "a", "set", "of", "packed", "multi", "-", "channel", "backups", "will", "restore", "the", "channel", "states", "to", "channel", "shells", "and", "also", "reach", "out", "to", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/recover.go#L104-L114
128,510
lightningnetwork/lnd
htlcswitch/packet.go
inKey
func (p *htlcPacket) inKey() CircuitKey { return CircuitKey{ ChanID: p.incomingChanID, HtlcID: p.incomingHTLCID, } }
go
func (p *htlcPacket) inKey() CircuitKey { return CircuitKey{ ChanID: p.incomingChanID, HtlcID: p.incomingHTLCID, } }
[ "func", "(", "p", "*", "htlcPacket", ")", "inKey", "(", ")", "CircuitKey", "{", "return", "CircuitKey", "{", "ChanID", ":", "p", ".", "incomingChanID", ",", "HtlcID", ":", "p", ".", "incomingHTLCID", ",", "}", "\n", "}" ]
// inKey returns the circuit key used to identify the incoming htlc.
[ "inKey", "returns", "the", "circuit", "key", "used", "to", "identify", "the", "incoming", "htlc", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/packet.go#L91-L96
128,511
lightningnetwork/lnd
htlcswitch/packet.go
outKey
func (p *htlcPacket) outKey() CircuitKey { return CircuitKey{ ChanID: p.outgoingChanID, HtlcID: p.outgoingHTLCID, } }
go
func (p *htlcPacket) outKey() CircuitKey { return CircuitKey{ ChanID: p.outgoingChanID, HtlcID: p.outgoingHTLCID, } }
[ "func", "(", "p", "*", "htlcPacket", ")", "outKey", "(", ")", "CircuitKey", "{", "return", "CircuitKey", "{", "ChanID", ":", "p", ".", "outgoingChanID", ",", "HtlcID", ":", "p", ".", "outgoingHTLCID", ",", "}", "\n", "}" ]
// outKey returns the circuit key used to identify the outgoing, forwarded htlc.
[ "outKey", "returns", "the", "circuit", "key", "used", "to", "identify", "the", "outgoing", "forwarded", "htlc", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/packet.go#L99-L104
128,512
lightningnetwork/lnd
htlcswitch/packet.go
keystone
func (p *htlcPacket) keystone() Keystone { return Keystone{ InKey: p.inKey(), OutKey: p.outKey(), } }
go
func (p *htlcPacket) keystone() Keystone { return Keystone{ InKey: p.inKey(), OutKey: p.outKey(), } }
[ "func", "(", "p", "*", "htlcPacket", ")", "keystone", "(", ")", "Keystone", "{", "return", "Keystone", "{", "InKey", ":", "p", ".", "inKey", "(", ")", ",", "OutKey", ":", "p", ".", "outKey", "(", ")", ",", "}", "\n", "}" ]
// keystone returns a tuple containing the incoming and outgoing circuit keys.
[ "keystone", "returns", "a", "tuple", "containing", "the", "incoming", "and", "outgoing", "circuit", "keys", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/packet.go#L107-L112
128,513
lightningnetwork/lnd
lnwire/open_channel.go
Encode
func (o *OpenChannel) Encode(w io.Writer, pver uint32) error { return WriteElements(w, o.ChainHash[:], o.PendingChannelID[:], o.FundingAmount, o.PushAmount, o.DustLimit, o.MaxValueInFlight, o.ChannelReserve, o.HtlcMinimum, o.FeePerKiloWeight, o.CsvDelay, o.MaxAcceptedHTLCs, o.FundingKey, o.Re...
go
func (o *OpenChannel) Encode(w io.Writer, pver uint32) error { return WriteElements(w, o.ChainHash[:], o.PendingChannelID[:], o.FundingAmount, o.PushAmount, o.DustLimit, o.MaxValueInFlight, o.ChannelReserve, o.HtlcMinimum, o.FeePerKiloWeight, o.CsvDelay, o.MaxAcceptedHTLCs, o.FundingKey, o.Re...
[ "func", "(", "o", "*", "OpenChannel", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "o", ".", "ChainHash", "[", ":", "]", ",", "o", ".", "PendingChannelID", "[", ":...
// Encode serializes the target OpenChannel into the passed io.Writer // implementation. Serialization will observe the rules defined by the passed // protocol version. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "OpenChannel", "into", "the", "passed", "io", ".", "Writer", "implementation", ".", "Serialization", "will", "observe", "the", "rules", "defined", "by", "the", "passed", "protocol", "version", ".", "This", "is", "part", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/open_channel.go#L136-L157
128,514
lightningnetwork/lnd
lnwire/open_channel.go
Decode
func (o *OpenChannel) Decode(r io.Reader, pver uint32) error { return ReadElements(r, o.ChainHash[:], o.PendingChannelID[:], &o.FundingAmount, &o.PushAmount, &o.DustLimit, &o.MaxValueInFlight, &o.ChannelReserve, &o.HtlcMinimum, &o.FeePerKiloWeight, &o.CsvDelay, &o.MaxAcceptedHTLCs, &o.FundingKe...
go
func (o *OpenChannel) Decode(r io.Reader, pver uint32) error { return ReadElements(r, o.ChainHash[:], o.PendingChannelID[:], &o.FundingAmount, &o.PushAmount, &o.DustLimit, &o.MaxValueInFlight, &o.ChannelReserve, &o.HtlcMinimum, &o.FeePerKiloWeight, &o.CsvDelay, &o.MaxAcceptedHTLCs, &o.FundingKe...
[ "func", "(", "o", "*", "OpenChannel", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "o", ".", "ChainHash", "[", ":", "]", ",", "o", ".", "PendingChannelID", "[", ":"...
// Decode deserializes the serialized OpenChannel stored in the passed // io.Reader into the target OpenChannel using the deserialization rules // defined by the passed protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "the", "serialized", "OpenChannel", "stored", "in", "the", "passed", "io", ".", "Reader", "into", "the", "target", "OpenChannel", "using", "the", "deserialization", "rules", "defined", "by", "the", "passed", "protocol", "version", ".", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/open_channel.go#L164-L185
128,515
lightningnetwork/lnd
netann/channel_state.go
markEnabled
func (s *channelStates) markEnabled(outpoint wire.OutPoint) { (*s)[outpoint] = ChannelState{ Status: ChanStatusEnabled, } }
go
func (s *channelStates) markEnabled(outpoint wire.OutPoint) { (*s)[outpoint] = ChannelState{ Status: ChanStatusEnabled, } }
[ "func", "(", "s", "*", "channelStates", ")", "markEnabled", "(", "outpoint", "wire", ".", "OutPoint", ")", "{", "(", "*", "s", ")", "[", "outpoint", "]", "=", "ChannelState", "{", "Status", ":", "ChanStatusEnabled", ",", "}", "\n", "}" ]
// markEnabled creates a channelState using ChanStatusEnabled.
[ "markEnabled", "creates", "a", "channelState", "using", "ChanStatusEnabled", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/channel_state.go#L53-L57
128,516
lightningnetwork/lnd
netann/channel_state.go
markDisabled
func (s *channelStates) markDisabled(outpoint wire.OutPoint) { (*s)[outpoint] = ChannelState{ Status: ChanStatusDisabled, } }
go
func (s *channelStates) markDisabled(outpoint wire.OutPoint) { (*s)[outpoint] = ChannelState{ Status: ChanStatusDisabled, } }
[ "func", "(", "s", "*", "channelStates", ")", "markDisabled", "(", "outpoint", "wire", ".", "OutPoint", ")", "{", "(", "*", "s", ")", "[", "outpoint", "]", "=", "ChannelState", "{", "Status", ":", "ChanStatusDisabled", ",", "}", "\n", "}" ]
// markDisabled creates a channelState using ChanStatusDisabled.
[ "markDisabled", "creates", "a", "channelState", "using", "ChanStatusDisabled", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/channel_state.go#L60-L64
128,517
lightningnetwork/lnd
netann/channel_state.go
markPendingDisabled
func (s *channelStates) markPendingDisabled(outpoint wire.OutPoint, sendDisableTime time.Time) { (*s)[outpoint] = ChannelState{ Status: ChanStatusPendingDisabled, SendDisableTime: sendDisableTime, } }
go
func (s *channelStates) markPendingDisabled(outpoint wire.OutPoint, sendDisableTime time.Time) { (*s)[outpoint] = ChannelState{ Status: ChanStatusPendingDisabled, SendDisableTime: sendDisableTime, } }
[ "func", "(", "s", "*", "channelStates", ")", "markPendingDisabled", "(", "outpoint", "wire", ".", "OutPoint", ",", "sendDisableTime", "time", ".", "Time", ")", "{", "(", "*", "s", ")", "[", "outpoint", "]", "=", "ChannelState", "{", "Status", ":", "ChanS...
// markPendingDisabled creates a channelState using ChanStatusPendingDisabled // and sets the ChannelState's SendDisableTime to sendDisableTime.
[ "markPendingDisabled", "creates", "a", "channelState", "using", "ChanStatusPendingDisabled", "and", "sets", "the", "ChannelState", "s", "SendDisableTime", "to", "sendDisableTime", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/channel_state.go#L68-L75
128,518
lightningnetwork/lnd
htlcswitch/link.go
EligibleToForward
func (l *channelLink) EligibleToForward() bool { return l.channel.RemoteNextRevocation() != nil && l.ShortChanID() != sourceHop }
go
func (l *channelLink) EligibleToForward() bool { return l.channel.RemoteNextRevocation() != nil && l.ShortChanID() != sourceHop }
[ "func", "(", "l", "*", "channelLink", ")", "EligibleToForward", "(", ")", "bool", "{", "return", "l", ".", "channel", ".", "RemoteNextRevocation", "(", ")", "!=", "nil", "&&", "l", ".", "ShortChanID", "(", ")", "!=", "sourceHop", "\n", "}" ]
// EligibleToForward returns a bool indicating if the channel is able to // actively accept requests to forward HTLC's. We're able to forward HTLC's if // we know the remote party's next revocation point. Otherwise, we can't // initiate new channel state. We also require that the short channel ID not be // the all-zero...
[ "EligibleToForward", "returns", "a", "bool", "indicating", "if", "the", "channel", "is", "able", "to", "actively", "accept", "requests", "to", "forward", "HTLC", "s", ".", "We", "re", "able", "to", "forward", "HTLC", "s", "if", "we", "know", "the", "remote...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L513-L516
128,519
lightningnetwork/lnd
htlcswitch/link.go
sampleNetworkFee
func (l *channelLink) sampleNetworkFee() (lnwallet.SatPerKWeight, error) { // We'll first query for the sat/kw recommended to be confirmed within 3 // blocks. feePerKw, err := l.cfg.FeeEstimator.EstimateFeePerKW(3) if err != nil { return 0, err } log.Debugf("ChannelLink(%v): sampled fee rate for 3 block conf: ...
go
func (l *channelLink) sampleNetworkFee() (lnwallet.SatPerKWeight, error) { // We'll first query for the sat/kw recommended to be confirmed within 3 // blocks. feePerKw, err := l.cfg.FeeEstimator.EstimateFeePerKW(3) if err != nil { return 0, err } log.Debugf("ChannelLink(%v): sampled fee rate for 3 block conf: ...
[ "func", "(", "l", "*", "channelLink", ")", "sampleNetworkFee", "(", ")", "(", "lnwallet", ".", "SatPerKWeight", ",", "error", ")", "{", "// We'll first query for the sat/kw recommended to be confirmed within 3", "// blocks.", "feePerKw", ",", "err", ":=", "l", ".", ...
// sampleNetworkFee samples the current fee rate on the network to get into the // chain in a timely manner. The returned value is expressed in fee-per-kw, as // this is the native rate used when computing the fee for commitment // transactions, and the second-level HTLC transactions.
[ "sampleNetworkFee", "samples", "the", "current", "fee", "rate", "on", "the", "network", "to", "get", "into", "the", "chain", "in", "a", "timely", "manner", ".", "The", "returned", "value", "is", "expressed", "in", "fee", "-", "per", "-", "kw", "as", "thi...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L522-L534
128,520
lightningnetwork/lnd
htlcswitch/link.go
resolveFwdPkgs
func (l *channelLink) resolveFwdPkgs() error { fwdPkgs, err := l.channel.LoadFwdPkgs() if err != nil { return err } l.debugf("loaded %d fwd pks", len(fwdPkgs)) var needUpdate bool for _, fwdPkg := range fwdPkgs { hasUpdate, err := l.resolveFwdPkg(fwdPkg) if err != nil { return err } needUpdate = n...
go
func (l *channelLink) resolveFwdPkgs() error { fwdPkgs, err := l.channel.LoadFwdPkgs() if err != nil { return err } l.debugf("loaded %d fwd pks", len(fwdPkgs)) var needUpdate bool for _, fwdPkg := range fwdPkgs { hasUpdate, err := l.resolveFwdPkg(fwdPkg) if err != nil { return err } needUpdate = n...
[ "func", "(", "l", "*", "channelLink", ")", "resolveFwdPkgs", "(", ")", "error", "{", "fwdPkgs", ",", "err", ":=", "l", ".", "channel", ".", "LoadFwdPkgs", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "l", ".", ...
// resolveFwdPkgs loads any forwarding packages for this link from disk, and // reprocesses them in order. The primary goal is to make sure that any HTLCs // we previously received are reinstated in memory, and forwarded to the switch // if necessary. After a restart, this will also delete any previously // completed p...
[ "resolveFwdPkgs", "loads", "any", "forwarding", "packages", "for", "this", "link", "from", "disk", "and", "reprocesses", "them", "in", "order", ".", "The", "primary", "goal", "is", "to", "make", "sure", "that", "any", "HTLCs", "we", "previously", "received", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L701-L726
128,521
lightningnetwork/lnd
htlcswitch/link.go
resolveFwdPkg
func (l *channelLink) resolveFwdPkg(fwdPkg *channeldb.FwdPkg) (bool, error) { // Remove any completed packages to clear up space. if fwdPkg.State == channeldb.FwdStateCompleted { l.debugf("removing completed fwd pkg for height=%d", fwdPkg.Height) err := l.channel.RemoveFwdPkg(fwdPkg.Height) if err != nil { ...
go
func (l *channelLink) resolveFwdPkg(fwdPkg *channeldb.FwdPkg) (bool, error) { // Remove any completed packages to clear up space. if fwdPkg.State == channeldb.FwdStateCompleted { l.debugf("removing completed fwd pkg for height=%d", fwdPkg.Height) err := l.channel.RemoveFwdPkg(fwdPkg.Height) if err != nil { ...
[ "func", "(", "l", "*", "channelLink", ")", "resolveFwdPkg", "(", "fwdPkg", "*", "channeldb", ".", "FwdPkg", ")", "(", "bool", ",", "error", ")", "{", "// Remove any completed packages to clear up space.", "if", "fwdPkg", ".", "State", "==", "channeldb", ".", "...
// resolveFwdPkg interprets the FwdState of the provided package, either // reprocesses any outstanding htlcs in the package, or performs garbage // collection on the package.
[ "resolveFwdPkg", "interprets", "the", "FwdState", "of", "the", "provided", "package", "either", "reprocesses", "any", "outstanding", "htlcs", "in", "the", "package", "or", "performs", "garbage", "collection", "on", "the", "package", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L731-L791
128,522
lightningnetwork/lnd
htlcswitch/link.go
processHodlQueue
func (l *channelLink) processHodlQueue(firstHodlEvent invoices.HodlEvent) error { // Try to read all waiting resolution messages, so that they can all be // processed in a single commitment tx update. hodlEvent := firstHodlEvent loop: for { if err := l.processHodlMapEvent(hodlEvent); err != nil { return err ...
go
func (l *channelLink) processHodlQueue(firstHodlEvent invoices.HodlEvent) error { // Try to read all waiting resolution messages, so that they can all be // processed in a single commitment tx update. hodlEvent := firstHodlEvent loop: for { if err := l.processHodlMapEvent(hodlEvent); err != nil { return err ...
[ "func", "(", "l", "*", "channelLink", ")", "processHodlQueue", "(", "firstHodlEvent", "invoices", ".", "HodlEvent", ")", "error", "{", "// Try to read all waiting resolution messages, so that they can all be", "// processed in a single commitment tx update.", "hodlEvent", ":=", ...
// processHodlQueue processes a received hodl event and continues reading from // the hodl queue until no more events remain. When this function returns // without an error, the commit tx should be updated.
[ "processHodlQueue", "processes", "a", "received", "hodl", "event", "and", "continues", "reading", "from", "the", "hodl", "queue", "until", "no", "more", "events", "remain", ".", "When", "this", "function", "returns", "without", "an", "error", "the", "commit", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1123-L1147
128,523
lightningnetwork/lnd
htlcswitch/link.go
processHodlMapEvent
func (l *channelLink) processHodlMapEvent(hodlEvent invoices.HodlEvent) error { // Lookup all hodl htlcs that can be failed or settled with this event. // The hodl htlc must be present in the map. hash := hodlEvent.Hash hodlHtlcs, ok := l.hodlMap[hash] if !ok { return fmt.Errorf("hodl htlc not found: %v", hash) ...
go
func (l *channelLink) processHodlMapEvent(hodlEvent invoices.HodlEvent) error { // Lookup all hodl htlcs that can be failed or settled with this event. // The hodl htlc must be present in the map. hash := hodlEvent.Hash hodlHtlcs, ok := l.hodlMap[hash] if !ok { return fmt.Errorf("hodl htlc not found: %v", hash) ...
[ "func", "(", "l", "*", "channelLink", ")", "processHodlMapEvent", "(", "hodlEvent", "invoices", ".", "HodlEvent", ")", "error", "{", "// Lookup all hodl htlcs that can be failed or settled with this event.", "// The hodl htlc must be present in the map.", "hash", ":=", "hodlEve...
// processHodlMapEvent resolves stored hodl htlcs based using the information in // hodlEvent.
[ "processHodlMapEvent", "resolves", "stored", "hodl", "htlcs", "based", "using", "the", "information", "in", "hodlEvent", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1151-L1168
128,524
lightningnetwork/lnd
htlcswitch/link.go
processHodlEvent
func (l *channelLink) processHodlEvent(hodlEvent invoices.HodlEvent, htlcs ...hodlHtlc) error { hash := hodlEvent.Hash if hodlEvent.Preimage == nil { l.debugf("Received hodl cancel event for %v", hash) } else { l.debugf("Received hodl settle event for %v", hash) } // Determine required action for the resolu...
go
func (l *channelLink) processHodlEvent(hodlEvent invoices.HodlEvent, htlcs ...hodlHtlc) error { hash := hodlEvent.Hash if hodlEvent.Preimage == nil { l.debugf("Received hodl cancel event for %v", hash) } else { l.debugf("Received hodl settle event for %v", hash) } // Determine required action for the resolu...
[ "func", "(", "l", "*", "channelLink", ")", "processHodlEvent", "(", "hodlEvent", "invoices", ".", "HodlEvent", ",", "htlcs", "...", "hodlHtlc", ")", "error", "{", "hash", ":=", "hodlEvent", ".", "Hash", "\n", "if", "hodlEvent", ".", "Preimage", "==", "nil"...
// processHodlEvent applies a received hodl event to the provided htlc. When // this function returns without an error, the commit tx should be updated.
[ "processHodlEvent", "applies", "a", "received", "hodl", "event", "to", "the", "provided", "htlc", ".", "When", "this", "function", "returns", "without", "an", "error", "the", "commit", "tx", "should", "be", "updated", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1172-L1214
128,525
lightningnetwork/lnd
htlcswitch/link.go
randomFeeUpdateTimeout
func (l *channelLink) randomFeeUpdateTimeout() time.Duration { lower := int64(l.cfg.MinFeeUpdateTimeout) upper := int64(l.cfg.MaxFeeUpdateTimeout) return time.Duration(prand.Int63n(upper-lower) + lower) }
go
func (l *channelLink) randomFeeUpdateTimeout() time.Duration { lower := int64(l.cfg.MinFeeUpdateTimeout) upper := int64(l.cfg.MaxFeeUpdateTimeout) return time.Duration(prand.Int63n(upper-lower) + lower) }
[ "func", "(", "l", "*", "channelLink", ")", "randomFeeUpdateTimeout", "(", ")", "time", ".", "Duration", "{", "lower", ":=", "int64", "(", "l", ".", "cfg", ".", "MinFeeUpdateTimeout", ")", "\n", "upper", ":=", "int64", "(", "l", ".", "cfg", ".", "MaxFee...
// randomFeeUpdateTimeout returns a random timeout between the bounds defined // within the link's configuration that will be used to determine when the link // should propose an update to its commitment fee rate.
[ "randomFeeUpdateTimeout", "returns", "a", "random", "timeout", "between", "the", "bounds", "defined", "within", "the", "link", "s", "configuration", "that", "will", "be", "used", "to", "determine", "when", "the", "link", "should", "propose", "an", "update", "to"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1219-L1223
128,526
lightningnetwork/lnd
htlcswitch/link.go
cleanupSpuriousResponse
func (l *channelLink) cleanupSpuriousResponse(pkt *htlcPacket) { inKey := pkt.inKey() l.debugf("Cleaning up spurious response for incoming circuit-key=%v", inKey) // If the htlc packet doesn't have a source reference, it is unsafe to // proceed, as skipping this ack may cause the htlc to be reforwarded. if pkt...
go
func (l *channelLink) cleanupSpuriousResponse(pkt *htlcPacket) { inKey := pkt.inKey() l.debugf("Cleaning up spurious response for incoming circuit-key=%v", inKey) // If the htlc packet doesn't have a source reference, it is unsafe to // proceed, as skipping this ack may cause the htlc to be reforwarded. if pkt...
[ "func", "(", "l", "*", "channelLink", ")", "cleanupSpuriousResponse", "(", "pkt", "*", "htlcPacket", ")", "{", "inKey", ":=", "pkt", ".", "inKey", "(", ")", "\n\n", "l", ".", "debugf", "(", "\"", "\"", ",", "inKey", ")", "\n\n", "// If the htlc packet do...
// cleanupSpuriousResponse attempts to ack any AddRef or SettleFailRef // associated with this packet. If successful in doing so, it will also purge // the open circuit from the circuit map and remove the packet from the link's // mailbox.
[ "cleanupSpuriousResponse", "attempts", "to", "ack", "any", "AddRef", "or", "SettleFailRef", "associated", "with", "this", "packet", ".", "If", "successful", "in", "doing", "so", "it", "will", "also", "purge", "the", "open", "circuit", "from", "the", "circuit", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1489-L1547
128,527
lightningnetwork/lnd
htlcswitch/link.go
ackDownStreamPackets
func (l *channelLink) ackDownStreamPackets() error { // First, remove the downstream Add packets that were included in the // previous commitment signature. This will prevent the Adds from being // replayed if this link disconnects. for _, inKey := range l.openedCircuits { // In order to test the sphinx replay lo...
go
func (l *channelLink) ackDownStreamPackets() error { // First, remove the downstream Add packets that were included in the // previous commitment signature. This will prevent the Adds from being // replayed if this link disconnects. for _, inKey := range l.openedCircuits { // In order to test the sphinx replay lo...
[ "func", "(", "l", "*", "channelLink", ")", "ackDownStreamPackets", "(", ")", "error", "{", "// First, remove the downstream Add packets that were included in the", "// previous commitment signature. This will prevent the Adds from being", "// replayed if this link disconnects.", "for", ...
// ackDownStreamPackets is responsible for removing htlcs from a link's mailbox // for packets delivered from server, and cleaning up any circuits closed by // signing a previous commitment txn. This method ensures that the circuits are // removed from the circuit map before removing them from the link's mailbox, // ot...
[ "ackDownStreamPackets", "is", "responsible", "for", "removing", "htlcs", "from", "a", "link", "s", "mailbox", "for", "packets", "delivered", "from", "server", "and", "cleaning", "up", "any", "circuits", "closed", "by", "signing", "a", "previous", "commitment", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1813-L1861
128,528
lightningnetwork/lnd
htlcswitch/link.go
updateCommitTx
func (l *channelLink) updateCommitTx() error { // Preemptively write all pending keystones to disk, just in case the // HTLCs we have in memory are included in the subsequent attempt to // sign a commitment state. err := l.cfg.Circuits.OpenCircuits(l.keystoneBatch...) if err != nil { return err } // Reset the...
go
func (l *channelLink) updateCommitTx() error { // Preemptively write all pending keystones to disk, just in case the // HTLCs we have in memory are included in the subsequent attempt to // sign a commitment state. err := l.cfg.Circuits.OpenCircuits(l.keystoneBatch...) if err != nil { return err } // Reset the...
[ "func", "(", "l", "*", "channelLink", ")", "updateCommitTx", "(", ")", "error", "{", "// Preemptively write all pending keystones to disk, just in case the", "// HTLCs we have in memory are included in the subsequent attempt to", "// sign a commitment state.", "err", ":=", "l", "."...
// updateCommitTx signs, then sends an update to the remote peer adding a new // commitment to their commitment chain which includes all the latest updates // we've received+processed up to this point.
[ "updateCommitTx", "signs", "then", "sends", "an", "update", "to", "the", "remote", "peer", "adding", "a", "new", "commitment", "to", "their", "commitment", "chain", "which", "includes", "all", "the", "latest", "updates", "we", "ve", "received", "+", "processed...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L1866-L1930
128,529
lightningnetwork/lnd
htlcswitch/link.go
AttachMailBox
func (l *channelLink) AttachMailBox(mailbox MailBox) { l.Lock() l.mailBox = mailbox l.upstream = mailbox.MessageOutBox() l.downstream = mailbox.PacketOutBox() l.Unlock() }
go
func (l *channelLink) AttachMailBox(mailbox MailBox) { l.Lock() l.mailBox = mailbox l.upstream = mailbox.MessageOutBox() l.downstream = mailbox.PacketOutBox() l.Unlock() }
[ "func", "(", "l", "*", "channelLink", ")", "AttachMailBox", "(", "mailbox", "MailBox", ")", "{", "l", ".", "Lock", "(", ")", "\n", "l", ".", "mailBox", "=", "mailbox", "\n", "l", ".", "upstream", "=", "mailbox", ".", "MessageOutBox", "(", ")", "\n", ...
// AttachMailBox updates the current mailbox used by this link, and hooks up // the mailbox's message and packet outboxes to the link's upstream and // downstream chans, respectively.
[ "AttachMailBox", "updates", "the", "current", "mailbox", "used", "by", "this", "link", "and", "hooks", "up", "the", "mailbox", "s", "message", "and", "packet", "outboxes", "to", "the", "link", "s", "upstream", "and", "downstream", "chans", "respectively", "." ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2044-L2050
128,530
lightningnetwork/lnd
htlcswitch/link.go
updateChannelFee
func (l *channelLink) updateChannelFee(feePerKw lnwallet.SatPerKWeight) error { log.Infof("ChannelPoint(%v): updating commit fee to %v sat/kw", l, feePerKw) // We skip sending the UpdateFee message if the channel is not // currently eligible to forward messages. if !l.EligibleToForward() { log.Debugf("Channel...
go
func (l *channelLink) updateChannelFee(feePerKw lnwallet.SatPerKWeight) error { log.Infof("ChannelPoint(%v): updating commit fee to %v sat/kw", l, feePerKw) // We skip sending the UpdateFee message if the channel is not // currently eligible to forward messages. if !l.EligibleToForward() { log.Debugf("Channel...
[ "func", "(", "l", "*", "channelLink", ")", "updateChannelFee", "(", "feePerKw", "lnwallet", ".", "SatPerKWeight", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "l", ",", "feePerKw", ")", "\n\n", "// We skip sending the UpdateFee message if the ch...
// updateChannelFee updates the commitment fee-per-kw on this channel by // committing to an update_fee message.
[ "updateChannelFee", "updates", "the", "commitment", "fee", "-", "per", "-", "kw", "on", "this", "channel", "by", "committing", "to", "an", "update_fee", "message", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2269-L2294
128,531
lightningnetwork/lnd
htlcswitch/link.go
settleHTLC
func (l *channelLink) settleHTLC(preimage lntypes.Preimage, htlcIndex uint64, sourceRef *channeldb.AddRef) error { hash := preimage.Hash() l.infof("settling htlc %v as exit hop", hash) err := l.channel.SettleHTLC( preimage, htlcIndex, sourceRef, nil, nil, ) if err != nil { return fmt.Errorf("unable to sett...
go
func (l *channelLink) settleHTLC(preimage lntypes.Preimage, htlcIndex uint64, sourceRef *channeldb.AddRef) error { hash := preimage.Hash() l.infof("settling htlc %v as exit hop", hash) err := l.channel.SettleHTLC( preimage, htlcIndex, sourceRef, nil, nil, ) if err != nil { return fmt.Errorf("unable to sett...
[ "func", "(", "l", "*", "channelLink", ")", "settleHTLC", "(", "preimage", "lntypes", ".", "Preimage", ",", "htlcIndex", "uint64", ",", "sourceRef", "*", "channeldb", ".", "AddRef", ")", "error", "{", "hash", ":=", "preimage", ".", "Hash", "(", ")", "\n\n...
// settleHTLC settles the HTLC on the channel.
[ "settleHTLC", "settles", "the", "HTLC", "on", "the", "channel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2852-L2883
128,532
lightningnetwork/lnd
htlcswitch/link.go
forwardBatch
func (l *channelLink) forwardBatch(packets ...*htlcPacket) { // Don't forward packets for which we already have a response in our // mailbox. This could happen if a packet fails and is buffered in the // mailbox, and the incoming link flaps. var filteredPkts = make([]*htlcPacket, 0, len(packets)) for _, pkt := ran...
go
func (l *channelLink) forwardBatch(packets ...*htlcPacket) { // Don't forward packets for which we already have a response in our // mailbox. This could happen if a packet fails and is buffered in the // mailbox, and the incoming link flaps. var filteredPkts = make([]*htlcPacket, 0, len(packets)) for _, pkt := ran...
[ "func", "(", "l", "*", "channelLink", ")", "forwardBatch", "(", "packets", "...", "*", "htlcPacket", ")", "{", "// Don't forward packets for which we already have a response in our", "// mailbox. This could happen if a packet fails and is buffered in the", "// mailbox, and the incomi...
// forwardBatch forwards the given htlcPackets to the switch, and waits on the // err chan for the individual responses. This method is intended to be spawned // as a goroutine so the responses can be handled in the background.
[ "forwardBatch", "forwards", "the", "given", "htlcPackets", "to", "the", "switch", "and", "waits", "on", "the", "err", "chan", "for", "the", "individual", "responses", ".", "This", "method", "is", "intended", "to", "be", "spawned", "as", "a", "goroutine", "so...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2888-L2903
128,533
lightningnetwork/lnd
htlcswitch/link.go
sendHTLCError
func (l *channelLink) sendHTLCError(htlcIndex uint64, failure lnwire.FailureMessage, e ErrorEncrypter, sourceRef *channeldb.AddRef) { reason, err := e.EncryptFirstHop(failure) if err != nil { log.Errorf("unable to obfuscate error: %v", err) return } err = l.channel.FailHTLC(htlcIndex, reason, sourceRef, nil,...
go
func (l *channelLink) sendHTLCError(htlcIndex uint64, failure lnwire.FailureMessage, e ErrorEncrypter, sourceRef *channeldb.AddRef) { reason, err := e.EncryptFirstHop(failure) if err != nil { log.Errorf("unable to obfuscate error: %v", err) return } err = l.channel.FailHTLC(htlcIndex, reason, sourceRef, nil,...
[ "func", "(", "l", "*", "channelLink", ")", "sendHTLCError", "(", "htlcIndex", "uint64", ",", "failure", "lnwire", ".", "FailureMessage", ",", "e", "ErrorEncrypter", ",", "sourceRef", "*", "channeldb", ".", "AddRef", ")", "{", "reason", ",", "err", ":=", "e...
// sendHTLCError functions cancels HTLC and send cancel message back to the // peer from which HTLC was received.
[ "sendHTLCError", "functions", "cancels", "HTLC", "and", "send", "cancel", "message", "back", "to", "the", "peer", "from", "which", "HTLC", "was", "received", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2927-L2947
128,534
lightningnetwork/lnd
htlcswitch/link.go
sendMalformedHTLCError
func (l *channelLink) sendMalformedHTLCError(htlcIndex uint64, code lnwire.FailCode, onionBlob []byte, sourceRef *channeldb.AddRef) { shaOnionBlob := sha256.Sum256(onionBlob) err := l.channel.MalformedFailHTLC(htlcIndex, code, shaOnionBlob, sourceRef) if err != nil { log.Errorf("unable cancel htlc: %v", err) r...
go
func (l *channelLink) sendMalformedHTLCError(htlcIndex uint64, code lnwire.FailCode, onionBlob []byte, sourceRef *channeldb.AddRef) { shaOnionBlob := sha256.Sum256(onionBlob) err := l.channel.MalformedFailHTLC(htlcIndex, code, shaOnionBlob, sourceRef) if err != nil { log.Errorf("unable cancel htlc: %v", err) r...
[ "func", "(", "l", "*", "channelLink", ")", "sendMalformedHTLCError", "(", "htlcIndex", "uint64", ",", "code", "lnwire", ".", "FailCode", ",", "onionBlob", "[", "]", "byte", ",", "sourceRef", "*", "channeldb", ".", "AddRef", ")", "{", "shaOnionBlob", ":=", ...
// sendMalformedHTLCError helper function which sends the malformed HTLC update // to the payment sender.
[ "sendMalformedHTLCError", "helper", "function", "which", "sends", "the", "malformed", "HTLC", "update", "to", "the", "payment", "sender", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2951-L2967
128,535
lightningnetwork/lnd
htlcswitch/link.go
fail
func (l *channelLink) fail(linkErr LinkFailureError, format string, a ...interface{}) { reason := errors.Errorf(format, a...) // Return if we have already notified about a failure. if l.failed { l.warnf("Ignoring link failure (%v), as link already failed", reason) return } l.errorf("Failing link: %s", re...
go
func (l *channelLink) fail(linkErr LinkFailureError, format string, a ...interface{}) { reason := errors.Errorf(format, a...) // Return if we have already notified about a failure. if l.failed { l.warnf("Ignoring link failure (%v), as link already failed", reason) return } l.errorf("Failing link: %s", re...
[ "func", "(", "l", "*", "channelLink", ")", "fail", "(", "linkErr", "LinkFailureError", ",", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "reason", ":=", "errors", ".", "Errorf", "(", "format", ",", "a", "...", ")", "\n\n", "/...
// fail is a function which is used to encapsulate the action necessary for // properly failing the link. It takes a LinkFailureError, which will be passed // to the OnChannelFailure closure, in order for it to determine if we should // force close the channel, and if we should send an error message to the // remote pe...
[ "fail", "is", "a", "function", "which", "is", "used", "to", "encapsulate", "the", "action", "necessary", "for", "properly", "failing", "the", "link", ".", "It", "takes", "a", "LinkFailureError", "which", "will", "be", "passed", "to", "the", "OnChannelFailure",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2974-L2991
128,536
lightningnetwork/lnd
htlcswitch/link.go
infof
func (l *channelLink) infof(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Infof("ChannelLink(%s) %s", l.ShortChanID(), msg) }
go
func (l *channelLink) infof(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Infof("ChannelLink(%s) %s", l.ShortChanID(), msg) }
[ "func", "(", "l", "*", "channelLink", ")", "infof", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "a", "...", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ...
// infof prefixes the channel's identifier before printing to info log.
[ "infof", "prefixes", "the", "channel", "s", "identifier", "before", "printing", "to", "info", "log", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L2994-L2997
128,537
lightningnetwork/lnd
htlcswitch/link.go
debugf
func (l *channelLink) debugf(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Debugf("ChannelLink(%s) %s", l.ShortChanID(), msg) }
go
func (l *channelLink) debugf(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Debugf("ChannelLink(%s) %s", l.ShortChanID(), msg) }
[ "func", "(", "l", "*", "channelLink", ")", "debugf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "a", "...", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ...
// debugf prefixes the channel's identifier before printing to debug log.
[ "debugf", "prefixes", "the", "channel", "s", "identifier", "before", "printing", "to", "debug", "log", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L3000-L3003
128,538
lightningnetwork/lnd
htlcswitch/link.go
warnf
func (l *channelLink) warnf(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Warnf("ChannelLink(%s) %s", l.ShortChanID(), msg) }
go
func (l *channelLink) warnf(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Warnf("ChannelLink(%s) %s", l.ShortChanID(), msg) }
[ "func", "(", "l", "*", "channelLink", ")", "warnf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "a", "...", ")", "\n", "log", ".", "Warnf", "(", "\"", "\"", ...
// warnf prefixes the channel's identifier before printing to warn log.
[ "warnf", "prefixes", "the", "channel", "s", "identifier", "before", "printing", "to", "warn", "log", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L3006-L3009
128,539
lightningnetwork/lnd
htlcswitch/link.go
errorf
func (l *channelLink) errorf(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Errorf("ChannelLink(%s) %s", l.ShortChanID(), msg) }
go
func (l *channelLink) errorf(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Errorf("ChannelLink(%s) %s", l.ShortChanID(), msg) }
[ "func", "(", "l", "*", "channelLink", ")", "errorf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "a", "...", ")", "\n", "log", ".", "Errorf", "(", "\"", "\"", ...
// errorf prefixes the channel's identifier before printing to error log.
[ "errorf", "prefixes", "the", "channel", "s", "identifier", "before", "printing", "to", "error", "log", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L3012-L3015
128,540
lightningnetwork/lnd
htlcswitch/link.go
tracef
func (l *channelLink) tracef(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Tracef("ChannelLink(%s) %s", l.ShortChanID(), msg) }
go
func (l *channelLink) tracef(format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) log.Tracef("ChannelLink(%s) %s", l.ShortChanID(), msg) }
[ "func", "(", "l", "*", "channelLink", ")", "tracef", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "a", "...", ")", "\n", "log", ".", "Tracef", "(", "\"", "\"", ...
// tracef prefixes the channel's identifier before printing to trace log.
[ "tracef", "prefixes", "the", "channel", "s", "identifier", "before", "printing", "to", "trace", "log", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L3018-L3021
128,541
lightningnetwork/lnd
htlcswitch/link.go
isASCII
func isASCII(data []byte) bool { isASCII := true for _, c := range data { if c < 32 || c > 126 { isASCII = false break } } return isASCII }
go
func isASCII(data []byte) bool { isASCII := true for _, c := range data { if c < 32 || c > 126 { isASCII = false break } } return isASCII }
[ "func", "isASCII", "(", "data", "[", "]", "byte", ")", "bool", "{", "isASCII", ":=", "true", "\n", "for", "_", ",", "c", ":=", "range", "data", "{", "if", "c", "<", "32", "||", "c", ">", "126", "{", "isASCII", "=", "false", "\n", "break", "\n",...
// isASCII is a helper method that checks whether all bytes in `data` would be // printable ASCII characters if interpreted as a string.
[ "isASCII", "is", "a", "helper", "method", "that", "checks", "whether", "all", "bytes", "in", "data", "would", "be", "printable", "ASCII", "characters", "if", "interpreted", "as", "a", "string", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/link.go#L3025-L3034
128,542
lightningnetwork/lnd
autopilot/choice.go
weightedChoice
func weightedChoice(w []float64) (int, error) { // Calculate the sum of weights. var sum float64 for _, v := range w { sum += v } if sum <= 0 { return 0, ErrNoPositive } // Pick a random number in the range [0.0, 1.0) and multiply it with // the sum of weights. Then we'll iterate the weights until the num...
go
func weightedChoice(w []float64) (int, error) { // Calculate the sum of weights. var sum float64 for _, v := range w { sum += v } if sum <= 0 { return 0, ErrNoPositive } // Pick a random number in the range [0.0, 1.0) and multiply it with // the sum of weights. Then we'll iterate the weights until the num...
[ "func", "weightedChoice", "(", "w", "[", "]", "float64", ")", "(", "int", ",", "error", ")", "{", "// Calculate the sum of weights.", "var", "sum", "float64", "\n", "for", "_", ",", "v", ":=", "range", "w", "{", "sum", "+=", "v", "\n", "}", "\n\n", "...
// weightedChoice draws a random index from the slice of weights, with a // probability propotional to the weight at the given index.
[ "weightedChoice", "draws", "a", "random", "index", "from", "the", "slice", "of", "weights", "with", "a", "probability", "propotional", "to", "the", "weight", "at", "the", "given", "index", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/choice.go#L15-L47
128,543
lightningnetwork/lnd
autopilot/agent_constraints.go
NewConstraints
func NewConstraints(minChanSize, maxChanSize btcutil.Amount, chanLimit, maxPendingOpens uint16, allocation float64) AgentConstraints { return &agentConstraints{ minChanSize: minChanSize, maxChanSize: maxChanSize, chanLimit: chanLimit, allocation: allocation, maxPendingOpens: maxPendingOp...
go
func NewConstraints(minChanSize, maxChanSize btcutil.Amount, chanLimit, maxPendingOpens uint16, allocation float64) AgentConstraints { return &agentConstraints{ minChanSize: minChanSize, maxChanSize: maxChanSize, chanLimit: chanLimit, allocation: allocation, maxPendingOpens: maxPendingOp...
[ "func", "NewConstraints", "(", "minChanSize", ",", "maxChanSize", "btcutil", ".", "Amount", ",", "chanLimit", ",", "maxPendingOpens", "uint16", ",", "allocation", "float64", ")", "AgentConstraints", "{", "return", "&", "agentConstraints", "{", "minChanSize", ":", ...
// NewConstraints returns a new AgentConstraints with the given limits.
[ "NewConstraints", "returns", "a", "new", "AgentConstraints", "with", "the", "given", "limits", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/agent_constraints.go#L65-L75
128,544
lightningnetwork/lnd
watchtower/lookout/justice_descriptor.go
commitToLocalInput
func (p *JusticeDescriptor) commitToLocalInput() (*breachedInput, error) { // Retrieve the to-local witness script from the justice kit. toLocalScript, err := p.JusticeKit.CommitToLocalWitnessScript() if err != nil { return nil, err } // Compute the witness script hash, which will be used to locate the // inpu...
go
func (p *JusticeDescriptor) commitToLocalInput() (*breachedInput, error) { // Retrieve the to-local witness script from the justice kit. toLocalScript, err := p.JusticeKit.CommitToLocalWitnessScript() if err != nil { return nil, err } // Compute the witness script hash, which will be used to locate the // inpu...
[ "func", "(", "p", "*", "JusticeDescriptor", ")", "commitToLocalInput", "(", ")", "(", "*", "breachedInput", ",", "error", ")", "{", "// Retrieve the to-local witness script from the justice kit.", "toLocalScript", ",", "err", ":=", "p", ".", "JusticeKit", ".", "Comm...
// commitToLocalInput extracts the information required to spend the commit // to-local output.
[ "commitToLocalInput", "extracts", "the", "information", "required", "to", "spend", "the", "commit", "to", "-", "local", "output", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/lookout/justice_descriptor.go#L55-L96
128,545
lightningnetwork/lnd
watchtower/lookout/justice_descriptor.go
commitToRemoteInput
func (p *JusticeDescriptor) commitToRemoteInput() (*breachedInput, error) { // Retrieve the to-remote witness script from the justice kit. toRemoteScript, err := p.JusticeKit.CommitToRemoteWitnessScript() if err != nil { return nil, err } // Since the to-remote witness script should just be a regular p2wkh // ...
go
func (p *JusticeDescriptor) commitToRemoteInput() (*breachedInput, error) { // Retrieve the to-remote witness script from the justice kit. toRemoteScript, err := p.JusticeKit.CommitToRemoteWitnessScript() if err != nil { return nil, err } // Since the to-remote witness script should just be a regular p2wkh // ...
[ "func", "(", "p", "*", "JusticeDescriptor", ")", "commitToRemoteInput", "(", ")", "(", "*", "breachedInput", ",", "error", ")", "{", "// Retrieve the to-remote witness script from the justice kit.", "toRemoteScript", ",", "err", ":=", "p", ".", "JusticeKit", ".", "C...
// commitToRemoteInput extracts the information required to spend the commit // to-remote output.
[ "commitToRemoteInput", "extracts", "the", "information", "required", "to", "spend", "the", "commit", "to", "-", "remote", "output", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/lookout/justice_descriptor.go#L100-L150
128,546
lightningnetwork/lnd
watchtower/lookout/justice_descriptor.go
assembleJusticeTxn
func (p *JusticeDescriptor) assembleJusticeTxn(txWeight int64, inputs ...*breachedInput) (*wire.MsgTx, error) { justiceTxn := wire.NewMsgTx(2) // First, construct add the breached inputs to our justice transaction // and compute the total amount that will be swept. var totalAmt btcutil.Amount for _, input := ra...
go
func (p *JusticeDescriptor) assembleJusticeTxn(txWeight int64, inputs ...*breachedInput) (*wire.MsgTx, error) { justiceTxn := wire.NewMsgTx(2) // First, construct add the breached inputs to our justice transaction // and compute the total amount that will be swept. var totalAmt btcutil.Amount for _, input := ra...
[ "func", "(", "p", "*", "JusticeDescriptor", ")", "assembleJusticeTxn", "(", "txWeight", "int64", ",", "inputs", "...", "*", "breachedInput", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "justiceTxn", ":=", "wire", ".", "NewMsgTx", "(", "2...
// assembleJusticeTxn accepts the breached inputs recovered from state update // and attempts to construct the justice transaction that sweeps the victims // funds to their wallet and claims the watchtower's reward.
[ "assembleJusticeTxn", "accepts", "the", "breached", "inputs", "recovered", "from", "state", "update", "and", "attempts", "to", "construct", "the", "justice", "transaction", "that", "sweeps", "the", "victims", "funds", "to", "their", "wallet", "and", "claims", "the...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/lookout/justice_descriptor.go#L155-L223
128,547
lightningnetwork/lnd
watchtower/lookout/justice_descriptor.go
CreateJusticeTxn
func (p *JusticeDescriptor) CreateJusticeTxn() (*wire.MsgTx, error) { var ( sweepInputs = make([]*breachedInput, 0, 2) weightEstimate input.TxWeightEstimator ) // Add the sweep address's contribution, depending on whether it is a // p2wkh or p2wsh output. switch len(p.JusticeKit.SweepAddress) { case input...
go
func (p *JusticeDescriptor) CreateJusticeTxn() (*wire.MsgTx, error) { var ( sweepInputs = make([]*breachedInput, 0, 2) weightEstimate input.TxWeightEstimator ) // Add the sweep address's contribution, depending on whether it is a // p2wkh or p2wsh output. switch len(p.JusticeKit.SweepAddress) { case input...
[ "func", "(", "p", "*", "JusticeDescriptor", ")", "CreateJusticeTxn", "(", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "var", "(", "sweepInputs", "=", "make", "(", "[", "]", "*", "breachedInput", ",", "0", ",", "2", ")", "\n", "weig...
// CreateJusticeTxn computes the justice transaction that sweeps a breaching // commitment transaction. The justice transaction is constructed by assembling // the witnesses using data provided by the client in a prior state update.
[ "CreateJusticeTxn", "computes", "the", "justice", "transaction", "that", "sweeps", "a", "breaching", "commitment", "transaction", ".", "The", "justice", "transaction", "is", "constructed", "by", "assembling", "the", "witnesses", "using", "data", "provided", "by", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/lookout/justice_descriptor.go#L228-L279
128,548
lightningnetwork/lnd
watchtower/lookout/justice_descriptor.go
buildWitness
func buildWitness(witnessStack [][]byte, witnessScript []byte) [][]byte { witness := make([][]byte, len(witnessStack)+1) lastIdx := copy(witness, witnessStack) witness[lastIdx] = witnessScript return witness }
go
func buildWitness(witnessStack [][]byte, witnessScript []byte) [][]byte { witness := make([][]byte, len(witnessStack)+1) lastIdx := copy(witness, witnessStack) witness[lastIdx] = witnessScript return witness }
[ "func", "buildWitness", "(", "witnessStack", "[", "]", "[", "]", "byte", ",", "witnessScript", "[", "]", "byte", ")", "[", "]", "[", "]", "byte", "{", "witness", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "witnessStack", ")", ...
// buildWitness appends the witness script to a given witness stack.
[ "buildWitness", "appends", "the", "witness", "script", "to", "a", "given", "witness", "stack", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/lookout/justice_descriptor.go#L298-L304
128,549
lightningnetwork/lnd
shachain/element.go
newElementFromStr
func newElementFromStr(s string, index index) (*element, error) { hash, err := hashFromString(s) if err != nil { return nil, err } return &element{ index: index, hash: *hash, }, nil }
go
func newElementFromStr(s string, index index) (*element, error) { hash, err := hashFromString(s) if err != nil { return nil, err } return &element{ index: index, hash: *hash, }, nil }
[ "func", "newElementFromStr", "(", "s", "string", ",", "index", "index", ")", "(", "*", "element", ",", "error", ")", "{", "hash", ",", "err", ":=", "hashFromString", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "...
// newElementFromStr creates new element from the given hash string.
[ "newElementFromStr", "creates", "new", "element", "from", "the", "given", "hash", "string", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/element.go#L20-L30
128,550
lightningnetwork/lnd
shachain/element.go
derive
func (e *element) derive(toIndex index) (*element, error) { fromIndex := e.index positions, err := fromIndex.deriveBitTransformations(toIndex) if err != nil { return nil, err } buf := e.hash.CloneBytes() for _, position := range positions { // Flip the bit and then hash the current state. byteNumber := po...
go
func (e *element) derive(toIndex index) (*element, error) { fromIndex := e.index positions, err := fromIndex.deriveBitTransformations(toIndex) if err != nil { return nil, err } buf := e.hash.CloneBytes() for _, position := range positions { // Flip the bit and then hash the current state. byteNumber := po...
[ "func", "(", "e", "*", "element", ")", "derive", "(", "toIndex", "index", ")", "(", "*", "element", ",", "error", ")", "{", "fromIndex", ":=", "e", ".", "index", "\n\n", "positions", ",", "err", ":=", "fromIndex", ".", "deriveBitTransformations", "(", ...
// derive computes one shachain element from another by applying a series of // bit flips and hashing operations based on the starting and ending index.
[ "derive", "computes", "one", "shachain", "element", "from", "another", "by", "applying", "a", "series", "of", "bit", "flips", "and", "hashing", "operations", "based", "on", "the", "starting", "and", "ending", "index", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/element.go#L34-L63
128,551
lightningnetwork/lnd
shachain/element.go
isEqual
func (e *element) isEqual(e2 *element) bool { return (e.index == e2.index) && (&e.hash).IsEqual(&e2.hash) }
go
func (e *element) isEqual(e2 *element) bool { return (e.index == e2.index) && (&e.hash).IsEqual(&e2.hash) }
[ "func", "(", "e", "*", "element", ")", "isEqual", "(", "e2", "*", "element", ")", "bool", "{", "return", "(", "e", ".", "index", "==", "e2", ".", "index", ")", "&&", "(", "&", "e", ".", "hash", ")", ".", "IsEqual", "(", "&", "e2", ".", "hash"...
// isEqual returns true if two elements are identical and false otherwise.
[ "isEqual", "returns", "true", "if", "two", "elements", "are", "identical", "and", "false", "otherwise", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/element.go#L66-L69
128,552
lightningnetwork/lnd
watchtower/wtclient/session_negotiator.go
newSessionNegotiator
func newSessionNegotiator(cfg *NegotiatorConfig) *sessionNegotiator { localInit := wtwire.NewInitMessage( lnwire.NewRawFeatureVector(wtwire.WtSessionsRequired), cfg.ChainHash, ) return &sessionNegotiator{ cfg: cfg, localInit: localInit, dispatcher: make(chan str...
go
func newSessionNegotiator(cfg *NegotiatorConfig) *sessionNegotiator { localInit := wtwire.NewInitMessage( lnwire.NewRawFeatureVector(wtwire.WtSessionsRequired), cfg.ChainHash, ) return &sessionNegotiator{ cfg: cfg, localInit: localInit, dispatcher: make(chan str...
[ "func", "newSessionNegotiator", "(", "cfg", "*", "NegotiatorConfig", ")", "*", "sessionNegotiator", "{", "localInit", ":=", "wtwire", ".", "NewInitMessage", "(", "lnwire", ".", "NewRawFeatureVector", "(", "wtwire", ".", "WtSessionsRequired", ")", ",", "cfg", ".", ...
// newSessionNegotiator initializes a fresh sessionNegotiator instance.
[ "newSessionNegotiator", "initializes", "a", "fresh", "sessionNegotiator", "instance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/session_negotiator.go#L113-L127
128,553
lightningnetwork/lnd
watchtower/wtclient/session_negotiator.go
Start
func (n *sessionNegotiator) Start() error { n.started.Do(func() { log.Debugf("Starting session negotiator") n.wg.Add(1) go n.negotiationDispatcher() }) return nil }
go
func (n *sessionNegotiator) Start() error { n.started.Do(func() { log.Debugf("Starting session negotiator") n.wg.Add(1) go n.negotiationDispatcher() }) return nil }
[ "func", "(", "n", "*", "sessionNegotiator", ")", "Start", "(", ")", "error", "{", "n", ".", "started", ".", "Do", "(", "func", "(", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "n", ".", "wg", ".", "Add", "(", "1", ")", "\n",...
// Start safely starts up the sessionNegotiator.
[ "Start", "safely", "starts", "up", "the", "sessionNegotiator", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/session_negotiator.go#L130-L139
128,554
lightningnetwork/lnd
watchtower/wtclient/session_negotiator.go
Stop
func (n *sessionNegotiator) Stop() error { n.stopped.Do(func() { log.Debugf("Stopping session negotiator") close(n.quit) n.wg.Wait() }) return nil }
go
func (n *sessionNegotiator) Stop() error { n.stopped.Do(func() { log.Debugf("Stopping session negotiator") close(n.quit) n.wg.Wait() }) return nil }
[ "func", "(", "n", "*", "sessionNegotiator", ")", "Stop", "(", ")", "error", "{", "n", ".", "stopped", ".", "Do", "(", "func", "(", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "close", "(", "n", ".", "quit", ")", "\n", "n", "...
// Stop safely shutsdown the sessionNegotiator.
[ "Stop", "safely", "shutsdown", "the", "sessionNegotiator", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/session_negotiator.go#L142-L151
128,555
lightningnetwork/lnd
watchtower/wtclient/session_negotiator.go
negotiationDispatcher
func (n *sessionNegotiator) negotiationDispatcher() { defer n.wg.Done() var pendingNegotiations int for { select { case <-n.dispatcher: pendingNegotiations++ if pendingNegotiations > 1 { log.Debugf("Already negotiating session, " + "waiting for existing negotiation to " + "complete") co...
go
func (n *sessionNegotiator) negotiationDispatcher() { defer n.wg.Done() var pendingNegotiations int for { select { case <-n.dispatcher: pendingNegotiations++ if pendingNegotiations > 1 { log.Debugf("Already negotiating session, " + "waiting for existing negotiation to " + "complete") co...
[ "func", "(", "n", "*", "sessionNegotiator", ")", "negotiationDispatcher", "(", ")", "{", "defer", "n", ".", "wg", ".", "Done", "(", ")", "\n\n", "var", "pendingNegotiations", "int", "\n", "for", "{", "select", "{", "case", "<-", "n", ".", "dispatcher", ...
// negotiationDispatcher acts as the primary event loop for the // sessionNegotiator, coordinating requests for more sessions and dispatching // attempts to negotiate them from a list of candidates.
[ "negotiationDispatcher", "acts", "as", "the", "primary", "event", "loop", "for", "the", "sessionNegotiator", "coordinating", "requests", "for", "more", "sessions", "and", "dispatching", "attempts", "to", "negotiate", "them", "from", "a", "list", "of", "candidates", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/session_negotiator.go#L172-L215
128,556
lightningnetwork/lnd
watchtower/wtclient/session_negotiator.go
createSession
func (n *sessionNegotiator) createSession(tower *wtdb.Tower, keyIndex uint32) error { // If the tower has no addresses, there's nothing we can do. if len(tower.Addresses) == 0 { return ErrNoTowerAddrs } sessionPriv, err := DeriveSessionKey(n.cfg.SecretKeyRing, keyIndex) if err != nil { return err } for _...
go
func (n *sessionNegotiator) createSession(tower *wtdb.Tower, keyIndex uint32) error { // If the tower has no addresses, there's nothing we can do. if len(tower.Addresses) == 0 { return ErrNoTowerAddrs } sessionPriv, err := DeriveSessionKey(n.cfg.SecretKeyRing, keyIndex) if err != nil { return err } for _...
[ "func", "(", "n", "*", "sessionNegotiator", ")", "createSession", "(", "tower", "*", "wtdb", ".", "Tower", ",", "keyIndex", "uint32", ")", "error", "{", "// If the tower has no addresses, there's nothing we can do.", "if", "len", "(", "tower", ".", "Addresses", ")...
// createSession takes a tower an attempts to negotiate a session using any of // its stored addresses. This method returns after the first successful // negotiation, or after all addresses have failed with ErrFailedNegotiation. If // the tower has no addresses, ErrNoTowerAddrs is returned.
[ "createSession", "takes", "a", "tower", "an", "attempts", "to", "negotiate", "a", "session", "using", "any", "of", "its", "stored", "addresses", ".", "This", "method", "returns", "after", "the", "first", "successful", "negotiation", "or", "after", "all", "addr...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/session_negotiator.go#L306-L339
128,557
lightningnetwork/lnd
shachain/utils.go
getBit
func getBit(index index, position uint8) uint8 { return uint8((uint64(index) >> position) & 1) }
go
func getBit(index index, position uint8) uint8 { return uint8((uint64(index) >> position) & 1) }
[ "func", "getBit", "(", "index", "index", ",", "position", "uint8", ")", "uint8", "{", "return", "uint8", "(", "(", "uint64", "(", "index", ")", ">>", "position", ")", "&", "1", ")", "\n", "}" ]
// getBit return bit on index at position.
[ "getBit", "return", "bit", "on", "index", "at", "position", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/utils.go#L29-L31
128,558
lightningnetwork/lnd
shachain/utils.go
countTrailingZeros
func countTrailingZeros(index index) uint8 { var zeros uint8 for ; zeros < maxHeight; zeros++ { if getBit(index, zeros) != 0 { break } } return zeros }
go
func countTrailingZeros(index index) uint8 { var zeros uint8 for ; zeros < maxHeight; zeros++ { if getBit(index, zeros) != 0 { break } } return zeros }
[ "func", "countTrailingZeros", "(", "index", "index", ")", "uint8", "{", "var", "zeros", "uint8", "\n", "for", ";", "zeros", "<", "maxHeight", ";", "zeros", "++", "{", "if", "getBit", "(", "index", ",", "zeros", ")", "!=", "0", "{", "break", "\n", "}"...
// countTrailingZeros counts number of trailing zero bits, this function is // used to determine the number of element bucket.
[ "countTrailingZeros", "counts", "number", "of", "trailing", "zero", "bits", "this", "function", "is", "used", "to", "determine", "the", "number", "of", "element", "bucket", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/utils.go#L55-L65
128,559
lightningnetwork/lnd
shachain/utils.go
hashFromString
func hashFromString(s string) (*chainhash.Hash, error) { // Return an error if hash string is too long. if len(s) > chainhash.MaxHashStringSize { return nil, chainhash.ErrHashStrSize } // Hex decoder expects the hash to be a multiple of two. if len(s)%2 != 0 { s = "0" + s } // Convert string hash to bytes....
go
func hashFromString(s string) (*chainhash.Hash, error) { // Return an error if hash string is too long. if len(s) > chainhash.MaxHashStringSize { return nil, chainhash.ErrHashStrSize } // Hex decoder expects the hash to be a multiple of two. if len(s)%2 != 0 { s = "0" + s } // Convert string hash to bytes....
[ "func", "hashFromString", "(", "s", "string", ")", "(", "*", "chainhash", ".", "Hash", ",", "error", ")", "{", "// Return an error if hash string is too long.", "if", "len", "(", "s", ")", ">", "chainhash", ".", "MaxHashStringSize", "{", "return", "nil", ",", ...
// hashFromString takes a hex-encoded string as input and creates an instance of // chainhash.Hash. The chainhash.NewHashFromStr function not suitable because // it reverse the given hash.
[ "hashFromString", "takes", "a", "hex", "-", "encoded", "string", "as", "input", "and", "creates", "an", "instance", "of", "chainhash", ".", "Hash", ".", "The", "chainhash", ".", "NewHashFromStr", "function", "not", "suitable", "because", "it", "reverse", "the"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/utils.go#L70-L93
128,560
lightningnetwork/lnd
lnwire/update_add_htlc.go
Decode
func (c *UpdateAddHTLC) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, &c.ID, &c.Amount, c.PaymentHash[:], &c.Expiry, c.OnionBlob[:], ) }
go
func (c *UpdateAddHTLC) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, &c.ID, &c.Amount, c.PaymentHash[:], &c.Expiry, c.OnionBlob[:], ) }
[ "func", "(", "c", "*", "UpdateAddHTLC", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "c", ".", "ChanID", ",", "&", "c", ".", "ID", ",", "&", "c", ".", "Amo...
// Decode deserializes a serialized UpdateAddHTLC message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "UpdateAddHTLC", "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/update_add_htlc.go#L68-L77
128,561
lightningnetwork/lnd
lnwire/update_add_htlc.go
Encode
func (c *UpdateAddHTLC) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.ID, c.Amount, c.PaymentHash[:], c.Expiry, c.OnionBlob[:], ) }
go
func (c *UpdateAddHTLC) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.ID, c.Amount, c.PaymentHash[:], c.Expiry, c.OnionBlob[:], ) }
[ "func", "(", "c", "*", "UpdateAddHTLC", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "c", ".", "ChanID", ",", "c", ".", "ID", ",", "c", ".", "Amount", ",", "c", ...
// Encode serializes the target UpdateAddHTLC into the passed io.Writer observing // the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "UpdateAddHTLC", "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/update_add_htlc.go#L83-L92
128,562
lightningnetwork/lnd
lnwire/channel_update.go
Decode
func (a *ChannelUpdate) Decode(r io.Reader, pver uint32) error { err := ReadElements(r, &a.Signature, a.ChainHash[:], &a.ShortChannelID, &a.Timestamp, &a.MessageFlags, &a.ChannelFlags, &a.TimeLockDelta, &a.HtlcMinimumMsat, &a.BaseFee, &a.FeeRate, ) if err != nil { return err } // Now check w...
go
func (a *ChannelUpdate) Decode(r io.Reader, pver uint32) error { err := ReadElements(r, &a.Signature, a.ChainHash[:], &a.ShortChannelID, &a.Timestamp, &a.MessageFlags, &a.ChannelFlags, &a.TimeLockDelta, &a.HtlcMinimumMsat, &a.BaseFee, &a.FeeRate, ) if err != nil { return err } // Now check w...
[ "func", "(", "a", "*", "ChannelUpdate", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "err", ":=", "ReadElements", "(", "r", ",", "&", "a", ".", "Signature", ",", "a", ".", "ChainHash", "[", ":", "]", ","...
// Decode deserializes a serialized ChannelUpdate stored in the passed // io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "ChannelUpdate", "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/channel_update.go#L130-L167
128,563
lightningnetwork/lnd
lnwire/channel_update.go
Encode
func (a *ChannelUpdate) Encode(w io.Writer, pver uint32) error { err := WriteElements(w, a.Signature, a.ChainHash[:], a.ShortChannelID, a.Timestamp, a.MessageFlags, a.ChannelFlags, a.TimeLockDelta, a.HtlcMinimumMsat, a.BaseFee, a.FeeRate, ) if err != nil { return err } // Now append optional...
go
func (a *ChannelUpdate) Encode(w io.Writer, pver uint32) error { err := WriteElements(w, a.Signature, a.ChainHash[:], a.ShortChannelID, a.Timestamp, a.MessageFlags, a.ChannelFlags, a.TimeLockDelta, a.HtlcMinimumMsat, a.BaseFee, a.FeeRate, ) if err != nil { return err } // Now append optional...
[ "func", "(", "a", "*", "ChannelUpdate", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "err", ":=", "WriteElements", "(", "w", ",", "a", ".", "Signature", ",", "a", ".", "ChainHash", "[", ":", "]", ",", "a...
// Encode serializes the target ChannelUpdate into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "ChannelUpdate", "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/channel_update.go#L173-L200
128,564
lightningnetwork/lnd
chainntnfs/neutrinonotify/driver.go
createNewNotifier
func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) { if len(args) != 3 { return nil, fmt.Errorf("incorrect number of arguments to "+ ".New(...), expected 3, instead passed %v", len(args)) } config, ok := args[0].(*neutrino.ChainService) if !ok { return nil, errors.New("first argum...
go
func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) { if len(args) != 3 { return nil, fmt.Errorf("incorrect number of arguments to "+ ".New(...), expected 3, instead passed %v", len(args)) } config, ok := args[0].(*neutrino.ChainService) if !ok { return nil, errors.New("first argum...
[ "func", "createNewNotifier", "(", "args", "...", "interface", "{", "}", ")", "(", "chainntnfs", ".", "ChainNotifier", ",", "error", ")", "{", "if", "len", "(", "args", ")", "!=", "3", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// createNewNotifier creates a new instance of the ChainNotifier interface // implemented by NeutrinoNotifier.
[ "createNewNotifier", "creates", "a", "new", "instance", "of", "the", "ChainNotifier", "interface", "implemented", "by", "NeutrinoNotifier", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/neutrinonotify/driver.go#L13-L38
128,565
lightningnetwork/lnd
chainntnfs/neutrinonotify/driver.go
init
func init() { // Register the driver. notifier := &chainntnfs.NotifierDriver{ NotifierType: notifierType, New: createNewNotifier, } if err := chainntnfs.RegisterNotifier(notifier); err != nil { panic(fmt.Sprintf("failed to register notifier driver '%s': %v", notifierType, err)) } }
go
func init() { // Register the driver. notifier := &chainntnfs.NotifierDriver{ NotifierType: notifierType, New: createNewNotifier, } if err := chainntnfs.RegisterNotifier(notifier); err != nil { panic(fmt.Sprintf("failed to register notifier driver '%s': %v", notifierType, err)) } }
[ "func", "init", "(", ")", "{", "// Register the driver.", "notifier", ":=", "&", "chainntnfs", ".", "NotifierDriver", "{", "NotifierType", ":", "notifierType", ",", "New", ":", "createNewNotifier", ",", "}", "\n\n", "if", "err", ":=", "chainntnfs", ".", "Regis...
// init registers a driver for the NeutrinoNotify concrete implementation of // the chainntnfs.ChainNotifier interface.
[ "init", "registers", "a", "driver", "for", "the", "NeutrinoNotify", "concrete", "implementation", "of", "the", "chainntnfs", ".", "ChainNotifier", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/neutrinonotify/driver.go#L42-L53
128,566
lightningnetwork/lnd
lnrpc/routerrpc/router_backend.go
calculateFeeLimit
func calculateFeeLimit(feeLimit *lnrpc.FeeLimit, amount lnwire.MilliSatoshi) lnwire.MilliSatoshi { switch feeLimit.GetLimit().(type) { case *lnrpc.FeeLimit_Fixed: return lnwire.NewMSatFromSatoshis( btcutil.Amount(feeLimit.GetFixed()), ) case *lnrpc.FeeLimit_Percent: return amount * lnwire.MilliSatoshi(fee...
go
func calculateFeeLimit(feeLimit *lnrpc.FeeLimit, amount lnwire.MilliSatoshi) lnwire.MilliSatoshi { switch feeLimit.GetLimit().(type) { case *lnrpc.FeeLimit_Fixed: return lnwire.NewMSatFromSatoshis( btcutil.Amount(feeLimit.GetFixed()), ) case *lnrpc.FeeLimit_Percent: return amount * lnwire.MilliSatoshi(fee...
[ "func", "calculateFeeLimit", "(", "feeLimit", "*", "lnrpc", ".", "FeeLimit", ",", "amount", "lnwire", ".", "MilliSatoshi", ")", "lnwire", ".", "MilliSatoshi", "{", "switch", "feeLimit", ".", "GetLimit", "(", ")", ".", "(", "type", ")", "{", "case", "*", ...
// calculateFeeLimit returns the fee limit in millisatoshis. If a percentage // based fee limit has been requested, we'll factor in the ratio provided with // the amount of the payment.
[ "calculateFeeLimit", "returns", "the", "fee", "limit", "in", "millisatoshis", ".", "If", "a", "percentage", "based", "fee", "limit", "has", "been", "requested", "we", "ll", "factor", "in", "the", "ratio", "provided", "with", "the", "amount", "of", "the", "pa...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/routerrpc/router_backend.go#L180-L196
128,567
lightningnetwork/lnd
lnrpc/routerrpc/router_backend.go
MarshallRoute
func (r *RouterBackend) MarshallRoute(route *route.Route) *lnrpc.Route { resp := &lnrpc.Route{ TotalTimeLock: route.TotalTimeLock, TotalFees: int64(route.TotalFees.ToSatoshis()), TotalFeesMsat: int64(route.TotalFees), TotalAmt: int64(route.TotalAmount.ToSatoshis()), TotalAmtMsat: int64(route.TotalA...
go
func (r *RouterBackend) MarshallRoute(route *route.Route) *lnrpc.Route { resp := &lnrpc.Route{ TotalTimeLock: route.TotalTimeLock, TotalFees: int64(route.TotalFees.ToSatoshis()), TotalFeesMsat: int64(route.TotalFees), TotalAmt: int64(route.TotalAmount.ToSatoshis()), TotalAmtMsat: int64(route.TotalA...
[ "func", "(", "r", "*", "RouterBackend", ")", "MarshallRoute", "(", "route", "*", "route", ".", "Route", ")", "*", "lnrpc", ".", "Route", "{", "resp", ":=", "&", "lnrpc", ".", "Route", "{", "TotalTimeLock", ":", "route", ".", "TotalTimeLock", ",", "Tota...
// MarshallRoute marshalls an internal route to an rpc route struct.
[ "MarshallRoute", "marshalls", "an", "internal", "route", "to", "an", "rpc", "route", "struct", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/routerrpc/router_backend.go#L199-L239
128,568
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
newHtlcSet
func newHtlcSet(htlcs []channeldb.HTLC) htlcSet { outHTLCs := make(map[uint64]channeldb.HTLC) inHTLCs := make(map[uint64]channeldb.HTLC) for _, htlc := range htlcs { if htlc.Incoming { inHTLCs[htlc.HtlcIndex] = htlc continue } outHTLCs[htlc.HtlcIndex] = htlc } return htlcSet{ incomingHTLCs: inHTLCs...
go
func newHtlcSet(htlcs []channeldb.HTLC) htlcSet { outHTLCs := make(map[uint64]channeldb.HTLC) inHTLCs := make(map[uint64]channeldb.HTLC) for _, htlc := range htlcs { if htlc.Incoming { inHTLCs[htlc.HtlcIndex] = htlc continue } outHTLCs[htlc.HtlcIndex] = htlc } return htlcSet{ incomingHTLCs: inHTLCs...
[ "func", "newHtlcSet", "(", "htlcs", "[", "]", "channeldb", ".", "HTLC", ")", "htlcSet", "{", "outHTLCs", ":=", "make", "(", "map", "[", "uint64", "]", "channeldb", ".", "HTLC", ")", "\n", "inHTLCs", ":=", "make", "(", "map", "[", "uint64", "]", "chan...
// newHtlcSet constructs a new HTLC set from a slice of HTLC's.
[ "newHtlcSet", "constructs", "a", "new", "HTLC", "set", "from", "a", "slice", "of", "HTLC", "s", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L176-L192
128,569
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
NewChannelArbitrator
func NewChannelArbitrator(cfg ChannelArbitratorConfig, startingHTLCs []channeldb.HTLC, log ArbitratorLog) *ChannelArbitrator { return &ChannelArbitrator{ log: log, signalUpdates: make(chan *signalUpdateMsg), htlcUpdates: make(<-chan []channeldb.HTLC), resolutionSignal: make(chan struct{}...
go
func NewChannelArbitrator(cfg ChannelArbitratorConfig, startingHTLCs []channeldb.HTLC, log ArbitratorLog) *ChannelArbitrator { return &ChannelArbitrator{ log: log, signalUpdates: make(chan *signalUpdateMsg), htlcUpdates: make(<-chan []channeldb.HTLC), resolutionSignal: make(chan struct{}...
[ "func", "NewChannelArbitrator", "(", "cfg", "ChannelArbitratorConfig", ",", "startingHTLCs", "[", "]", "channeldb", ".", "HTLC", ",", "log", "ArbitratorLog", ")", "*", "ChannelArbitrator", "{", "return", "&", "ChannelArbitrator", "{", "log", ":", "log", ",", "si...
// NewChannelArbitrator returns a new instance of a ChannelArbitrator backed by // the passed config struct.
[ "NewChannelArbitrator", "returns", "a", "new", "instance", "of", "a", "ChannelArbitrator", "backed", "by", "the", "passed", "config", "struct", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L254-L267
128,570
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
Start
func (c *ChannelArbitrator) Start() error { if !atomic.CompareAndSwapInt32(&c.started, 0, 1) { return nil } var ( err error ) log.Debugf("Starting ChannelArbitrator(%v), htlc_set=%v", c.cfg.ChanPoint, newLogClosure(func() string { return spew.Sdump(c.activeHTLCs) }), ) // First, we'll read our last...
go
func (c *ChannelArbitrator) Start() error { if !atomic.CompareAndSwapInt32(&c.started, 0, 1) { return nil } var ( err error ) log.Debugf("Starting ChannelArbitrator(%v), htlc_set=%v", c.cfg.ChanPoint, newLogClosure(func() string { return spew.Sdump(c.activeHTLCs) }), ) // First, we'll read our last...
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapInt32", "(", "&", "c", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "var", "(", "err", ...
// Start starts all the goroutines that the ChannelArbitrator needs to operate.
[ "Start", "starts", "all", "the", "goroutines", "that", "the", "ChannelArbitrator", "needs", "to", "operate", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L270-L375
128,571
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
relaunchResolvers
func (c *ChannelArbitrator) relaunchResolvers() error { // We'll now query our log to see if there are any active // unresolved contracts. If this is the case, then we'll // relaunch all contract resolvers. unresolvedContracts, err := c.log.FetchUnresolvedContracts() if err != nil { return err } // Retrieve t...
go
func (c *ChannelArbitrator) relaunchResolvers() error { // We'll now query our log to see if there are any active // unresolved contracts. If this is the case, then we'll // relaunch all contract resolvers. unresolvedContracts, err := c.log.FetchUnresolvedContracts() if err != nil { return err } // Retrieve t...
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "relaunchResolvers", "(", ")", "error", "{", "// We'll now query our log to see if there are any active", "// unresolved contracts. If this is the case, then we'll", "// relaunch all contract resolvers.", "unresolvedContracts", ",", "e...
// relauchResolvers relaunches the set of resolvers for unresolved contracts in // order to provide them with information that's not immediately available upon // starting the ChannelArbitrator. This information should ideally be stored in // the database, so this only serves as a intermediate work-around to prevent a ...
[ "relauchResolvers", "relaunches", "the", "set", "of", "resolvers", "for", "unresolved", "contracts", "in", "order", "to", "provide", "them", "with", "information", "that", "s", "not", "immediately", "available", "upon", "starting", "the", "ChannelArbitrator", ".", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L382-L431
128,572
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
supplementResolver
func supplementResolver(resolver ContractResolver, htlcMap map[wire.OutPoint]*channeldb.HTLC) error { switch r := resolver.(type) { case *htlcSuccessResolver: return supplementSuccessResolver(r, htlcMap) case *htlcIncomingContestResolver: return supplementSuccessResolver( &r.htlcSuccessResolver, htlcMap, ...
go
func supplementResolver(resolver ContractResolver, htlcMap map[wire.OutPoint]*channeldb.HTLC) error { switch r := resolver.(type) { case *htlcSuccessResolver: return supplementSuccessResolver(r, htlcMap) case *htlcIncomingContestResolver: return supplementSuccessResolver( &r.htlcSuccessResolver, htlcMap, ...
[ "func", "supplementResolver", "(", "resolver", "ContractResolver", ",", "htlcMap", "map", "[", "wire", ".", "OutPoint", "]", "*", "channeldb", ".", "HTLC", ")", "error", "{", "switch", "r", ":=", "resolver", ".", "(", "type", ")", "{", "case", "*", "htlc...
// supplementResolver takes a resolver as it is restored from the log and fills // in missing data from the htlcMap.
[ "supplementResolver", "takes", "a", "resolver", "as", "it", "is", "restored", "from", "the", "log", "and", "fills", "in", "missing", "data", "from", "the", "htlcMap", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L435-L458
128,573
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
supplementTimeoutResolver
func supplementTimeoutResolver(r *htlcTimeoutResolver, htlcMap map[wire.OutPoint]*channeldb.HTLC) error { res := r.htlcResolution htlcPoint := res.HtlcPoint() htlc, ok := htlcMap[htlcPoint] if !ok { return errors.New( "htlc for timeout resolver unavailable", ) } r.htlcAmt = htlc.Amt return nil }
go
func supplementTimeoutResolver(r *htlcTimeoutResolver, htlcMap map[wire.OutPoint]*channeldb.HTLC) error { res := r.htlcResolution htlcPoint := res.HtlcPoint() htlc, ok := htlcMap[htlcPoint] if !ok { return errors.New( "htlc for timeout resolver unavailable", ) } r.htlcAmt = htlc.Amt return nil }
[ "func", "supplementTimeoutResolver", "(", "r", "*", "htlcTimeoutResolver", ",", "htlcMap", "map", "[", "wire", ".", "OutPoint", "]", "*", "channeldb", ".", "HTLC", ")", "error", "{", "res", ":=", "r", ".", "htlcResolution", "\n", "htlcPoint", ":=", "res", ...
// supplementTimeoutResolver takes a htlcSuccessResolver as it is restored from // the log and fills in missing data from the htlcMap.
[ "supplementTimeoutResolver", "takes", "a", "htlcSuccessResolver", "as", "it", "is", "restored", "from", "the", "log", "and", "fills", "in", "missing", "data", "from", "the", "htlcMap", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L479-L492
128,574
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
Report
func (c *ChannelArbitrator) Report() []*ContractReport { c.activeResolversLock.RLock() defer c.activeResolversLock.RUnlock() var reports []*ContractReport for _, resolver := range c.activeResolvers { r, ok := resolver.(reportingContractResolver) if !ok { continue } if r.IsResolved() { continue } ...
go
func (c *ChannelArbitrator) Report() []*ContractReport { c.activeResolversLock.RLock() defer c.activeResolversLock.RUnlock() var reports []*ContractReport for _, resolver := range c.activeResolvers { r, ok := resolver.(reportingContractResolver) if !ok { continue } if r.IsResolved() { continue } ...
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "Report", "(", ")", "[", "]", "*", "ContractReport", "{", "c", ".", "activeResolversLock", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "activeResolversLock", ".", "RUnlock", "(", ")", "\n\n", "var", ...
// Report returns htlc reports for the active resolvers.
[ "Report", "returns", "htlc", "reports", "for", "the", "active", "resolvers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L495-L519
128,575
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
Stop
func (c *ChannelArbitrator) Stop() error { if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) { return nil } log.Debugf("Stopping ChannelArbitrator(%v)", c.cfg.ChanPoint) if c.cfg.ChainEvents.Cancel != nil { go c.cfg.ChainEvents.Cancel() } c.activeResolversLock.RLock() for _, activeResolver := range c.activ...
go
func (c *ChannelArbitrator) Stop() error { if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) { return nil } log.Debugf("Stopping ChannelArbitrator(%v)", c.cfg.ChanPoint) if c.cfg.ChainEvents.Cancel != nil { go c.cfg.ChainEvents.Cancel() } c.activeResolversLock.RLock() for _, activeResolver := range c.activ...
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapInt32", "(", "&", "c", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Debugf",...
// Stop signals the ChannelArbitrator for a graceful shutdown.
[ "Stop", "signals", "the", "ChannelArbitrator", "for", "a", "graceful", "shutdown", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L522-L543
128,576
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
String
func (t transitionTrigger) String() string { switch t { case chainTrigger: return "chainTrigger" case remoteCloseTrigger: return "remoteCloseTrigger" case userTrigger: return "userTrigger" case localCloseTrigger: return "localCloseTrigger" case coopCloseTrigger: return "coopCloseTrigger" default: ...
go
func (t transitionTrigger) String() string { switch t { case chainTrigger: return "chainTrigger" case remoteCloseTrigger: return "remoteCloseTrigger" case userTrigger: return "userTrigger" case localCloseTrigger: return "localCloseTrigger" case coopCloseTrigger: return "coopCloseTrigger" default: ...
[ "func", "(", "t", "transitionTrigger", ")", "String", "(", ")", "string", "{", "switch", "t", "{", "case", "chainTrigger", ":", "return", "\"", "\"", "\n\n", "case", "remoteCloseTrigger", ":", "return", "\"", "\"", "\n\n", "case", "userTrigger", ":", "retu...
// String returns a human readable string describing the passed // transitionTrigger.
[ "String", "returns", "a", "human", "readable", "string", "describing", "the", "passed", "transitionTrigger", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L577-L597
128,577
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
launchResolvers
func (c *ChannelArbitrator) launchResolvers(resolvers []ContractResolver) { c.activeResolversLock.Lock() defer c.activeResolversLock.Unlock() c.activeResolvers = resolvers for _, contract := range resolvers { c.wg.Add(1) go c.resolveContract(contract) } }
go
func (c *ChannelArbitrator) launchResolvers(resolvers []ContractResolver) { c.activeResolversLock.Lock() defer c.activeResolversLock.Unlock() c.activeResolvers = resolvers for _, contract := range resolvers { c.wg.Add(1) go c.resolveContract(contract) } }
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "launchResolvers", "(", "resolvers", "[", "]", "ContractResolver", ")", "{", "c", ".", "activeResolversLock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "activeResolversLock", ".", "Unlock", "(", ")", "...
// launchResolvers updates the activeResolvers list and starts the resolvers.
[ "launchResolvers", "updates", "the", "activeResolvers", "list", "and", "starts", "the", "resolvers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L915-L924
128,578
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
advanceState
func (c *ChannelArbitrator) advanceState(triggerHeight uint32, trigger transitionTrigger) (ArbitratorState, *wire.MsgTx, error) { var ( priorState ArbitratorState forceCloseTx *wire.MsgTx ) // We'll continue to advance our state forward until the state we // transition to is that same state that we started...
go
func (c *ChannelArbitrator) advanceState(triggerHeight uint32, trigger transitionTrigger) (ArbitratorState, *wire.MsgTx, error) { var ( priorState ArbitratorState forceCloseTx *wire.MsgTx ) // We'll continue to advance our state forward until the state we // transition to is that same state that we started...
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "advanceState", "(", "triggerHeight", "uint32", ",", "trigger", "transitionTrigger", ")", "(", "ArbitratorState", ",", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "var", "(", "priorState", "ArbitratorStat...
// advanceState is the main driver of our state machine. This method is an // iterative function which repeatedly attempts to advance the internal state // of the channel arbitrator. The state will be advanced until we reach a // redundant transition, meaning that the state transition is a noop. The final // param is a...
[ "advanceState", "is", "the", "main", "driver", "of", "our", "state", "machine", ".", "This", "method", "is", "an", "iterative", "function", "which", "repeatedly", "attempts", "to", "advance", "the", "internal", "state", "of", "the", "channel", "arbitrator", "....
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L932-L981
128,579
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
String
func (c ChainAction) String() string { switch c { case NoAction: return "NoAction" case HtlcTimeoutAction: return "HtlcTimeoutAction" case HtlcClaimAction: return "HtlcClaimAction" case HtlcFailNowAction: return "HtlcFailNowAction" case HtlcOutgoingWatchAction: return "HtlcOutgoingWatchAction" cas...
go
func (c ChainAction) String() string { switch c { case NoAction: return "NoAction" case HtlcTimeoutAction: return "HtlcTimeoutAction" case HtlcClaimAction: return "HtlcClaimAction" case HtlcFailNowAction: return "HtlcFailNowAction" case HtlcOutgoingWatchAction: return "HtlcOutgoingWatchAction" cas...
[ "func", "(", "c", "ChainAction", ")", "String", "(", ")", "string", "{", "switch", "c", "{", "case", "NoAction", ":", "return", "\"", "\"", "\n\n", "case", "HtlcTimeoutAction", ":", "return", "\"", "\"", "\n\n", "case", "HtlcClaimAction", ":", "return", ...
// String returns a human readable string describing a chain action.
[ "String", "returns", "a", "human", "readable", "string", "describing", "a", "chain", "action", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L1021-L1044
128,580
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
replaceResolver
func (c *ChannelArbitrator) replaceResolver(oldResolver, newResolver ContractResolver) error { c.activeResolversLock.Lock() defer c.activeResolversLock.Unlock() oldKey := oldResolver.ResolverKey() for i, r := range c.activeResolvers { if bytes.Equal(r.ResolverKey(), oldKey) { c.activeResolvers[i] = newResol...
go
func (c *ChannelArbitrator) replaceResolver(oldResolver, newResolver ContractResolver) error { c.activeResolversLock.Lock() defer c.activeResolversLock.Unlock() oldKey := oldResolver.ResolverKey() for i, r := range c.activeResolvers { if bytes.Equal(r.ResolverKey(), oldKey) { c.activeResolvers[i] = newResol...
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "replaceResolver", "(", "oldResolver", ",", "newResolver", "ContractResolver", ")", "error", "{", "c", ".", "activeResolversLock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "activeResolversLock", ".", "Unl...
// replaceResolver replaces a in the list of active resolvers. If the resolver // to be replaced is not found, it returns an error.
[ "replaceResolver", "replaces", "a", "in", "the", "list", "of", "active", "resolvers", ".", "If", "the", "resolver", "to", "be", "replaced", "is", "not", "found", "it", "returns", "an", "error", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L1455-L1470
128,581
lightningnetwork/lnd
contractcourt/channel_arbitrator.go
UpdateContractSignals
func (c *ChannelArbitrator) UpdateContractSignals(newSignals *ContractSignals) { done := make(chan struct{}) select { case c.signalUpdates <- &signalUpdateMsg{ newSignals: newSignals, doneChan: done, }: case <-c.quit: } select { case <-done: case <-c.quit: } }
go
func (c *ChannelArbitrator) UpdateContractSignals(newSignals *ContractSignals) { done := make(chan struct{}) select { case c.signalUpdates <- &signalUpdateMsg{ newSignals: newSignals, doneChan: done, }: case <-c.quit: } select { case <-done: case <-c.quit: } }
[ "func", "(", "c", "*", "ChannelArbitrator", ")", "UpdateContractSignals", "(", "newSignals", "*", "ContractSignals", ")", "{", "done", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "select", "{", "case", "c", ".", "signalUpdates", "<-", "&", ...
// UpdateContractSignals updates the set of signals the ChannelArbitrator needs // to receive from a channel in real-time in order to keep in sync with the // latest state of the contract.
[ "UpdateContractSignals", "updates", "the", "set", "of", "signals", "the", "ChannelArbitrator", "needs", "to", "receive", "from", "a", "channel", "in", "real", "-", "time", "in", "order", "to", "keep", "in", "sync", "with", "the", "latest", "state", "of", "th...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/channel_arbitrator.go#L1588-L1603
128,582
lightningnetwork/lnd
input/signdescriptor.go
ReadSignDescriptor
func ReadSignDescriptor(r io.Reader, sd *SignDescriptor) error { err := binary.Read(r, binary.BigEndian, &sd.KeyDesc.Family) if err != nil { return err } err = binary.Read(r, binary.BigEndian, &sd.KeyDesc.Index) if err != nil { return err } var hasKey bool err = binary.Read(r, binary.BigEndian, &hasKey) i...
go
func ReadSignDescriptor(r io.Reader, sd *SignDescriptor) error { err := binary.Read(r, binary.BigEndian, &sd.KeyDesc.Family) if err != nil { return err } err = binary.Read(r, binary.BigEndian, &sd.KeyDesc.Index) if err != nil { return err } var hasKey bool err = binary.Read(r, binary.BigEndian, &hasKey) i...
[ "func", "ReadSignDescriptor", "(", "r", "io", ".", "Reader", ",", "sd", "*", "SignDescriptor", ")", "error", "{", "err", ":=", "binary", ".", "Read", "(", "r", ",", "binary", ".", "BigEndian", ",", "&", "sd", ".", "KeyDesc", ".", "Family", ")", "\n",...
// ReadSignDescriptor deserializes a SignDescriptor struct from the passed // io.Reader stream.
[ "ReadSignDescriptor", "deserializes", "a", "SignDescriptor", "struct", "from", "the", "passed", "io", ".", "Reader", "stream", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/signdescriptor.go#L140-L225
128,583
lightningnetwork/lnd
watchtower/wtwire/delete_session.go
Decode
func (m *DeleteSession) Decode(r io.Reader, pver uint32) error { return nil }
go
func (m *DeleteSession) Decode(r io.Reader, pver uint32) error { return nil }
[ "func", "(", "m", "*", "DeleteSession", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "nil", "\n", "}" ]
// Decode deserializes a serialized DeleteSession message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "DeleteSession", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/delete_session.go#L19-L21
128,584
lightningnetwork/lnd
watchtower/wtwire/delete_session.go
Encode
func (m *DeleteSession) Encode(w io.Writer, pver uint32) error { return nil }
go
func (m *DeleteSession) Encode(w io.Writer, pver uint32) error { return nil }
[ "func", "(", "m", "*", "DeleteSession", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "nil", "\n", "}" ]
// Encode serializes the target DeleteSession message into the passed io.Writer // observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Encode", "serializes", "the", "target", "DeleteSession", "message", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/delete_session.go#L27-L29
128,585
lightningnetwork/lnd
channeldb/codec.go
writeOutpoint
func writeOutpoint(w io.Writer, o *wire.OutPoint) error { if _, err := w.Write(o.Hash[:]); err != nil { return err } if err := binary.Write(w, byteOrder, o.Index); err != nil { return err } return nil }
go
func writeOutpoint(w io.Writer, o *wire.OutPoint) error { if _, err := w.Write(o.Hash[:]); err != nil { return err } if err := binary.Write(w, byteOrder, o.Index); err != nil { return err } return nil }
[ "func", "writeOutpoint", "(", "w", "io", ".", "Writer", ",", "o", "*", "wire", ".", "OutPoint", ")", "error", "{", "if", "_", ",", "err", ":=", "w", ".", "Write", "(", "o", ".", "Hash", "[", ":", "]", ")", ";", "err", "!=", "nil", "{", "retur...
// writeOutpoint writes an outpoint to the passed writer using the minimal // amount of bytes possible.
[ "writeOutpoint", "writes", "an", "outpoint", "to", "the", "passed", "writer", "using", "the", "minimal", "amount", "of", "bytes", "possible", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/codec.go#L23-L32
128,586
lightningnetwork/lnd
channeldb/codec.go
readOutpoint
func readOutpoint(r io.Reader, o *wire.OutPoint) error { if _, err := io.ReadFull(r, o.Hash[:]); err != nil { return err } if err := binary.Read(r, byteOrder, &o.Index); err != nil { return err } return nil }
go
func readOutpoint(r io.Reader, o *wire.OutPoint) error { if _, err := io.ReadFull(r, o.Hash[:]); err != nil { return err } if err := binary.Read(r, byteOrder, &o.Index); err != nil { return err } return nil }
[ "func", "readOutpoint", "(", "r", "io", ".", "Reader", ",", "o", "*", "wire", ".", "OutPoint", ")", "error", "{", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "o", ".", "Hash", "[", ":", "]", ")", ";", "err", "!=", "nil"...
// readOutpoint reads an outpoint from the passed reader that was previously // written using the writeOutpoint struct.
[ "readOutpoint", "reads", "an", "outpoint", "from", "the", "passed", "reader", "that", "was", "previously", "written", "using", "the", "writeOutpoint", "struct", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/codec.go#L36-L45
128,587
lightningnetwork/lnd
channeldb/codec.go
NewUnknownElementType
func NewUnknownElementType(method string, el interface{}) UnknownElementType { return UnknownElementType{method: method, element: el} }
go
func NewUnknownElementType(method string, el interface{}) UnknownElementType { return UnknownElementType{method: method, element: el} }
[ "func", "NewUnknownElementType", "(", "method", "string", ",", "el", "interface", "{", "}", ")", "UnknownElementType", "{", "return", "UnknownElementType", "{", "method", ":", "method", ",", "element", ":", "el", "}", "\n", "}" ]
// NewUnknownElementType creates a new UnknownElementType error from the passed // method name and element.
[ "NewUnknownElementType", "creates", "a", "new", "UnknownElementType", "error", "from", "the", "passed", "method", "name", "and", "element", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/codec.go#L56-L58
128,588
lightningnetwork/lnd
channeldb/codec.go
Error
func (e UnknownElementType) Error() string { return fmt.Sprintf("Unknown type in %s: %T", e.method, e.element) }
go
func (e UnknownElementType) Error() string { return fmt.Sprintf("Unknown type in %s: %T", e.method, e.element) }
[ "func", "(", "e", "UnknownElementType", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "method", ",", "e", ".", "element", ")", "\n", "}" ]
// Error returns the name of the method that encountered the error, as well as // the type that was unsupported.
[ "Error", "returns", "the", "name", "of", "the", "method", "that", "encountered", "the", "error", "as", "well", "as", "the", "type", "that", "was", "unsupported", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/codec.go#L62-L64
128,589
lightningnetwork/lnd
channeldb/codec.go
WriteElements
func WriteElements(w io.Writer, elements ...interface{}) error { for _, element := range elements { err := WriteElement(w, element) if err != nil { return err } } return nil }
go
func WriteElements(w io.Writer, elements ...interface{}) error { for _, element := range elements { err := WriteElement(w, element) if err != nil { return err } } return nil }
[ "func", "WriteElements", "(", "w", "io", ".", "Writer", ",", "elements", "...", "interface", "{", "}", ")", "error", "{", "for", "_", ",", "element", ":=", "range", "elements", "{", "err", ":=", "WriteElement", "(", "w", ",", "element", ")", "\n", "i...
// WriteElements is writes each element in the elements slice to the passed // io.Writer using WriteElement.
[ "WriteElements", "is", "writes", "each", "element", "in", "the", "elements", "slice", "to", "the", "passed", "io", ".", "Writer", "using", "WriteElement", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/codec.go#L211-L219
128,590
lightningnetwork/lnd
channeldb/codec.go
ReadElements
func ReadElements(r io.Reader, elements ...interface{}) error { for _, element := range elements { err := ReadElement(r, element) if err != nil { return err } } return nil }
go
func ReadElements(r io.Reader, elements ...interface{}) error { for _, element := range elements { err := ReadElement(r, element) if err != nil { return err } } return nil }
[ "func", "ReadElements", "(", "r", "io", ".", "Reader", ",", "elements", "...", "interface", "{", "}", ")", "error", "{", "for", "_", ",", "element", ":=", "range", "elements", "{", "err", ":=", "ReadElement", "(", "r", ",", "element", ")", "\n", "if"...
// ReadElements deserializes a variable number of elements into the passed // io.Reader, with each element being deserialized according to the ReadElement // function.
[ "ReadElements", "deserializes", "a", "variable", "number", "of", "elements", "into", "the", "passed", "io", ".", "Reader", "with", "each", "element", "being", "deserialized", "according", "to", "the", "ReadElement", "function", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/codec.go#L413-L421
128,591
lightningnetwork/lnd
aezeed/cipherseed.go
New
func New(internalVersion uint8, entropy *[EntropySize]byte, now time.Time) (*CipherSeed, error) { // TODO(roasbeef): pass randomness source? to make fully determinsitc? // If a set of entropy wasn't provided, then we'll read a set of bytes // from the CSPRNG of our operating platform. var seed [EntropySize]byte ...
go
func New(internalVersion uint8, entropy *[EntropySize]byte, now time.Time) (*CipherSeed, error) { // TODO(roasbeef): pass randomness source? to make fully determinsitc? // If a set of entropy wasn't provided, then we'll read a set of bytes // from the CSPRNG of our operating platform. var seed [EntropySize]byte ...
[ "func", "New", "(", "internalVersion", "uint8", ",", "entropy", "*", "[", "EntropySize", "]", "byte", ",", "now", "time", ".", "Time", ")", "(", "*", "CipherSeed", ",", "error", ")", "{", "// TODO(roasbeef): pass randomness source? to make fully determinsitc?", "/...
// New generates a new CipherSeed instance from an optional source of entropy. // If the entropy isn't provided, then a set of random bytes will be used in // place. The final argument should be the time at which the seed was created.
[ "New", "generates", "a", "new", "CipherSeed", "instance", "from", "an", "optional", "source", "of", "entropy", ".", "If", "the", "entropy", "isn", "t", "provided", "then", "a", "set", "of", "random", "bytes", "will", "be", "used", "in", "place", ".", "Th...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L184-L219
128,592
lightningnetwork/lnd
aezeed/cipherseed.go
encode
func (c *CipherSeed) encode(w io.Writer) error { err := binary.Write(w, binary.BigEndian, c.InternalVersion) if err != nil { return err } if err := binary.Write(w, binary.BigEndian, c.Birthday); err != nil { return err } if _, err := w.Write(c.Entropy[:]); err != nil { return err } return nil }
go
func (c *CipherSeed) encode(w io.Writer) error { err := binary.Write(w, binary.BigEndian, c.InternalVersion) if err != nil { return err } if err := binary.Write(w, binary.BigEndian, c.Birthday); err != nil { return err } if _, err := w.Write(c.Entropy[:]); err != nil { return err } return nil }
[ "func", "(", "c", "*", "CipherSeed", ")", "encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "err", ":=", "binary", ".", "Write", "(", "w", ",", "binary", ".", "BigEndian", ",", "c", ".", "InternalVersion", ")", "\n", "if", "err", "!=", ...
// encode attempts to encode the target cipherSeed into the passed io.Writer // instance.
[ "encode", "attempts", "to", "encode", "the", "target", "cipherSeed", "into", "the", "passed", "io", ".", "Writer", "instance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L223-L238
128,593
lightningnetwork/lnd
aezeed/cipherseed.go
decode
func (c *CipherSeed) decode(r io.Reader) error { err := binary.Read(r, binary.BigEndian, &c.InternalVersion) if err != nil { return err } if err := binary.Read(r, binary.BigEndian, &c.Birthday); err != nil { return err } if _, err := io.ReadFull(r, c.Entropy[:]); err != nil { return err } return nil }
go
func (c *CipherSeed) decode(r io.Reader) error { err := binary.Read(r, binary.BigEndian, &c.InternalVersion) if err != nil { return err } if err := binary.Read(r, binary.BigEndian, &c.Birthday); err != nil { return err } if _, err := io.ReadFull(r, c.Entropy[:]); err != nil { return err } return nil }
[ "func", "(", "c", "*", "CipherSeed", ")", "decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "err", ":=", "binary", ".", "Read", "(", "r", ",", "binary", ".", "BigEndian", ",", "&", "c", ".", "InternalVersion", ")", "\n", "if", "err", "!...
// decode attempts to decode an encoded cipher seed instance into the target // CipherSeed struct.
[ "decode", "attempts", "to", "decode", "an", "encoded", "cipher", "seed", "instance", "into", "the", "target", "CipherSeed", "struct", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L242-L257
128,594
lightningnetwork/lnd
aezeed/cipherseed.go
extractAD
func extractAD(encipheredSeed [EncipheredCipherSeedSize]byte) [adSize]byte { var ad [adSize]byte ad[0] = encipheredSeed[0] copy(ad[1:], encipheredSeed[saltOffset:checkSumOffset]) return ad }
go
func extractAD(encipheredSeed [EncipheredCipherSeedSize]byte) [adSize]byte { var ad [adSize]byte ad[0] = encipheredSeed[0] copy(ad[1:], encipheredSeed[saltOffset:checkSumOffset]) return ad }
[ "func", "extractAD", "(", "encipheredSeed", "[", "EncipheredCipherSeedSize", "]", "byte", ")", "[", "adSize", "]", "byte", "{", "var", "ad", "[", "adSize", "]", "byte", "\n", "ad", "[", "0", "]", "=", "encipheredSeed", "[", "0", "]", "\n\n", "copy", "(...
// extractAD extracts an associated data from a fully encoded and enciphered // cipher seed. This is to be used when attempting to decrypt an enciphered // cipher seed.
[ "extractAD", "extracts", "an", "associated", "data", "from", "a", "fully", "encoded", "and", "enciphered", "cipher", "seed", ".", "This", "is", "to", "be", "used", "when", "attempting", "to", "decrypt", "an", "enciphered", "cipher", "seed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L272-L279
128,595
lightningnetwork/lnd
aezeed/cipherseed.go
encipher
func (c *CipherSeed) encipher(pass []byte) ([EncipheredCipherSeedSize]byte, error) { var cipherSeedBytes [EncipheredCipherSeedSize]byte // If the passphrase wasn't provided, then we'll use the string // "aezeed" in place. passphrase := pass if len(passphrase) == 0 { passphrase = defaultPassphrase } // With o...
go
func (c *CipherSeed) encipher(pass []byte) ([EncipheredCipherSeedSize]byte, error) { var cipherSeedBytes [EncipheredCipherSeedSize]byte // If the passphrase wasn't provided, then we'll use the string // "aezeed" in place. passphrase := pass if len(passphrase) == 0 { passphrase = defaultPassphrase } // With o...
[ "func", "(", "c", "*", "CipherSeed", ")", "encipher", "(", "pass", "[", "]", "byte", ")", "(", "[", "EncipheredCipherSeedSize", "]", "byte", ",", "error", ")", "{", "var", "cipherSeedBytes", "[", "EncipheredCipherSeedSize", "]", "byte", "\n\n", "// If the pa...
// encipher takes a fully populated cipherseed instance, and enciphers the // encoded seed, then appends a randomly generated seed used to stretch the // passphrase out into an appropriate key, then computes a checksum over the // preceding.
[ "encipher", "takes", "a", "fully", "populated", "cipherseed", "instance", "and", "enciphers", "the", "encoded", "seed", "then", "appends", "a", "randomly", "generated", "seed", "used", "to", "stretch", "the", "passphrase", "out", "into", "an", "appropriate", "ke...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L285-L340
128,596
lightningnetwork/lnd
aezeed/cipherseed.go
cipherTextToMnemonic
func cipherTextToMnemonic(cipherText [EncipheredCipherSeedSize]byte) (Mnemonic, error) { var words [NummnemonicWords]string // First, we'll convert the ciphertext itself into a bitstream for easy // manipulation. cipherBits := bstream.NewBStreamReader(cipherText[:]) // With our bitstream obtained, we'll read 11 ...
go
func cipherTextToMnemonic(cipherText [EncipheredCipherSeedSize]byte) (Mnemonic, error) { var words [NummnemonicWords]string // First, we'll convert the ciphertext itself into a bitstream for easy // manipulation. cipherBits := bstream.NewBStreamReader(cipherText[:]) // With our bitstream obtained, we'll read 11 ...
[ "func", "cipherTextToMnemonic", "(", "cipherText", "[", "EncipheredCipherSeedSize", "]", "byte", ")", "(", "Mnemonic", ",", "error", ")", "{", "var", "words", "[", "NummnemonicWords", "]", "string", "\n\n", "// First, we'll convert the ciphertext itself into a bitstream f...
// cipherTextToMnemonic converts the aez ciphertext appended with the salt to a // 24-word mnemonic pass phrase.
[ "cipherTextToMnemonic", "converts", "the", "aez", "ciphertext", "appended", "with", "the", "salt", "to", "a", "24", "-", "word", "mnemonic", "pass", "phrase", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L344-L363
128,597
lightningnetwork/lnd
aezeed/cipherseed.go
ToMnemonic
func (c *CipherSeed) ToMnemonic(pass []byte) (Mnemonic, error) { // First, we'll convert the valid seed triple into an aez cipher text // with our KDF salt appended to it. cipherText, err := c.encipher(pass) if err != nil { return Mnemonic{}, nil } // Now that we have our cipher text, we'll convert it into a m...
go
func (c *CipherSeed) ToMnemonic(pass []byte) (Mnemonic, error) { // First, we'll convert the valid seed triple into an aez cipher text // with our KDF salt appended to it. cipherText, err := c.encipher(pass) if err != nil { return Mnemonic{}, nil } // Now that we have our cipher text, we'll convert it into a m...
[ "func", "(", "c", "*", "CipherSeed", ")", "ToMnemonic", "(", "pass", "[", "]", "byte", ")", "(", "Mnemonic", ",", "error", ")", "{", "// First, we'll convert the valid seed triple into an aez cipher text", "// with our KDF salt appended to it.", "cipherText", ",", "err"...
// ToMnemonic maps the final enciphered cipher seed to a human readable 24-word // mnemonic phrase. The password is optional, as if it isn't specified aezeed // will be used in its place.
[ "ToMnemonic", "maps", "the", "final", "enciphered", "cipher", "seed", "to", "a", "human", "readable", "24", "-", "word", "mnemonic", "phrase", ".", "The", "password", "is", "optional", "as", "if", "it", "isn", "t", "specified", "aezeed", "will", "be", "use...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L368-L379
128,598
lightningnetwork/lnd
aezeed/cipherseed.go
Encipher
func (c *CipherSeed) Encipher(pass []byte) ([EncipheredCipherSeedSize]byte, error) { return c.encipher(pass) }
go
func (c *CipherSeed) Encipher(pass []byte) ([EncipheredCipherSeedSize]byte, error) { return c.encipher(pass) }
[ "func", "(", "c", "*", "CipherSeed", ")", "Encipher", "(", "pass", "[", "]", "byte", ")", "(", "[", "EncipheredCipherSeedSize", "]", "byte", ",", "error", ")", "{", "return", "c", ".", "encipher", "(", "pass", ")", "\n", "}" ]
// Encipher maps the cipher seed to an aez ciphertext using an optional // passphrase.
[ "Encipher", "maps", "the", "cipher", "seed", "to", "an", "aez", "ciphertext", "using", "an", "optional", "passphrase", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L383-L385
128,599
lightningnetwork/lnd
aezeed/cipherseed.go
BirthdayTime
func (c *CipherSeed) BirthdayTime() time.Time { offset := time.Duration(c.Birthday) * 24 * time.Hour return BitcoinGenesisDate.Add(offset) }
go
func (c *CipherSeed) BirthdayTime() time.Time { offset := time.Duration(c.Birthday) * 24 * time.Hour return BitcoinGenesisDate.Add(offset) }
[ "func", "(", "c", "*", "CipherSeed", ")", "BirthdayTime", "(", ")", "time", ".", "Time", "{", "offset", ":=", "time", ".", "Duration", "(", "c", ".", "Birthday", ")", "*", "24", "*", "time", ".", "Hour", "\n", "return", "BitcoinGenesisDate", ".", "Ad...
// BirthdayTime returns the cipher seed's internal birthday format as a native // golang Time struct.
[ "BirthdayTime", "returns", "the", "cipher", "seed", "s", "internal", "birthday", "format", "as", "a", "native", "golang", "Time", "struct", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L389-L392