id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
129,300
lightningnetwork/lnd
invoices/invoiceregistry.go
notifyHodlSubscribers
func (i *InvoiceRegistry) notifyHodlSubscribers(hodlEvent HodlEvent) { subscribers, ok := i.hodlSubscriptions[hodlEvent.Hash] if !ok { return } // Notify all interested subscribers and remove subscription from both // maps. The subscription can be removed as there only ever will be a // single resolution for e...
go
func (i *InvoiceRegistry) notifyHodlSubscribers(hodlEvent HodlEvent) { subscribers, ok := i.hodlSubscriptions[hodlEvent.Hash] if !ok { return } // Notify all interested subscribers and remove subscription from both // maps. The subscription can be removed as there only ever will be a // single resolution for e...
[ "func", "(", "i", "*", "InvoiceRegistry", ")", "notifyHodlSubscribers", "(", "hodlEvent", "HodlEvent", ")", "{", "subscribers", ",", "ok", ":=", "i", ".", "hodlSubscriptions", "[", "hodlEvent", ".", "Hash", "]", "\n", "if", "!", "ok", "{", "return", "\n", ...
// notifyHodlSubscribers sends out the hodl event to all current subscribers.
[ "notifyHodlSubscribers", "sends", "out", "the", "hodl", "event", "to", "all", "current", "subscribers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L842-L862
129,301
lightningnetwork/lnd
invoices/invoiceregistry.go
hodlSubscribe
func (i *InvoiceRegistry) hodlSubscribe(subscriber chan<- interface{}, hash lntypes.Hash) { log.Debugf("Hodl subscribe for %v", hash) subscriptions, ok := i.hodlSubscriptions[hash] if !ok { subscriptions = make(map[chan<- interface{}]struct{}) i.hodlSubscriptions[hash] = subscriptions } subscriptions[subscr...
go
func (i *InvoiceRegistry) hodlSubscribe(subscriber chan<- interface{}, hash lntypes.Hash) { log.Debugf("Hodl subscribe for %v", hash) subscriptions, ok := i.hodlSubscriptions[hash] if !ok { subscriptions = make(map[chan<- interface{}]struct{}) i.hodlSubscriptions[hash] = subscriptions } subscriptions[subscr...
[ "func", "(", "i", "*", "InvoiceRegistry", ")", "hodlSubscribe", "(", "subscriber", "chan", "<-", "interface", "{", "}", ",", "hash", "lntypes", ".", "Hash", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "hash", ")", "\n\n", "subscriptions", ","...
// hodlSubscribe adds a new invoice subscription.
[ "hodlSubscribe", "adds", "a", "new", "invoice", "subscription", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L865-L883
129,302
lightningnetwork/lnd
invoices/invoiceregistry.go
HodlUnsubscribeAll
func (i *InvoiceRegistry) HodlUnsubscribeAll(subscriber chan<- interface{}) { i.Lock() defer i.Unlock() hashes := i.hodlReverseSubscriptions[subscriber] for hash := range hashes { delete(i.hodlSubscriptions[hash], subscriber) } delete(i.hodlReverseSubscriptions, subscriber) }
go
func (i *InvoiceRegistry) HodlUnsubscribeAll(subscriber chan<- interface{}) { i.Lock() defer i.Unlock() hashes := i.hodlReverseSubscriptions[subscriber] for hash := range hashes { delete(i.hodlSubscriptions[hash], subscriber) } delete(i.hodlReverseSubscriptions, subscriber) }
[ "func", "(", "i", "*", "InvoiceRegistry", ")", "HodlUnsubscribeAll", "(", "subscriber", "chan", "<-", "interface", "{", "}", ")", "{", "i", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "Unlock", "(", ")", "\n\n", "hashes", ":=", "i", ".", "hodlRev...
// HodlUnsubscribeAll cancels the subscription.
[ "HodlUnsubscribeAll", "cancels", "the", "subscription", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L886-L896
129,303
lightningnetwork/lnd
lnwire/signature.go
NewSigFromRawSignature
func NewSigFromRawSignature(sig []byte) (Sig, error) { var b Sig if len(sig) == 0 { return b, fmt.Errorf("cannot decode empty signature") } // Extract lengths of R and S. The DER representation is laid out as // 0x30 <length> 0x02 <length r> r 0x02 <length s> s // which means the length of R is the 4th byte a...
go
func NewSigFromRawSignature(sig []byte) (Sig, error) { var b Sig if len(sig) == 0 { return b, fmt.Errorf("cannot decode empty signature") } // Extract lengths of R and S. The DER representation is laid out as // 0x30 <length> 0x02 <length r> r 0x02 <length s> s // which means the length of R is the 4th byte a...
[ "func", "NewSigFromRawSignature", "(", "sig", "[", "]", "byte", ")", "(", "Sig", ",", "error", ")", "{", "var", "b", "Sig", "\n\n", "if", "len", "(", "sig", ")", "==", "0", "{", "return", "b", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\...
// NewSigFromRawSignature returns a Sig from a Bitcoin raw signature encoded in // the canonical DER encoding.
[ "NewSigFromRawSignature", "returns", "a", "Sig", "from", "a", "Bitcoin", "raw", "signature", "encoded", "in", "the", "canonical", "DER", "encoding", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/signature.go#L17-L63
129,304
lightningnetwork/lnd
lnwire/signature.go
NewSigFromSignature
func NewSigFromSignature(e *btcec.Signature) (Sig, error) { if e == nil { return Sig{}, fmt.Errorf("cannot decode empty signature") } // Serialize the signature with all the checks that entails. return NewSigFromRawSignature(e.Serialize()) }
go
func NewSigFromSignature(e *btcec.Signature) (Sig, error) { if e == nil { return Sig{}, fmt.Errorf("cannot decode empty signature") } // Serialize the signature with all the checks that entails. return NewSigFromRawSignature(e.Serialize()) }
[ "func", "NewSigFromSignature", "(", "e", "*", "btcec", ".", "Signature", ")", "(", "Sig", ",", "error", ")", "{", "if", "e", "==", "nil", "{", "return", "Sig", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Seri...
// NewSigFromSignature creates a new signature as used on the wire, from an // existing btcec.Signature.
[ "NewSigFromSignature", "creates", "a", "new", "signature", "as", "used", "on", "the", "wire", "from", "an", "existing", "btcec", ".", "Signature", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/signature.go#L67-L74
129,305
lightningnetwork/lnd
lnwire/signature.go
ToSignature
func (b *Sig) ToSignature() (*btcec.Signature, error) { // Parse the signature with strict checks. sigBytes := b.ToSignatureBytes() sig, err := btcec.ParseDERSignature(sigBytes, btcec.S256()) if err != nil { return nil, err } return sig, nil }
go
func (b *Sig) ToSignature() (*btcec.Signature, error) { // Parse the signature with strict checks. sigBytes := b.ToSignatureBytes() sig, err := btcec.ParseDERSignature(sigBytes, btcec.S256()) if err != nil { return nil, err } return sig, nil }
[ "func", "(", "b", "*", "Sig", ")", "ToSignature", "(", ")", "(", "*", "btcec", ".", "Signature", ",", "error", ")", "{", "// Parse the signature with strict checks.", "sigBytes", ":=", "b", ".", "ToSignatureBytes", "(", ")", "\n", "sig", ",", "err", ":=", ...
// ToSignature converts the fixed-sized signature to a btcec.Signature objects // which can be used for signature validation checks.
[ "ToSignature", "converts", "the", "fixed", "-", "sized", "signature", "to", "a", "btcec", ".", "Signature", "objects", "which", "can", "be", "used", "for", "signature", "validation", "checks", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/signature.go#L78-L87
129,306
lightningnetwork/lnd
lnwire/signature.go
ToSignatureBytes
func (b *Sig) ToSignatureBytes() []byte { // Extract canonically-padded bigint representations from buffer r := extractCanonicalPadding(b[0:32]) s := extractCanonicalPadding(b[32:64]) rLen := uint8(len(r)) sLen := uint8(len(s)) // Create a canonical serialized signature. DER format is: // 0x30 <length> 0x02 <le...
go
func (b *Sig) ToSignatureBytes() []byte { // Extract canonically-padded bigint representations from buffer r := extractCanonicalPadding(b[0:32]) s := extractCanonicalPadding(b[32:64]) rLen := uint8(len(r)) sLen := uint8(len(s)) // Create a canonical serialized signature. DER format is: // 0x30 <length> 0x02 <le...
[ "func", "(", "b", "*", "Sig", ")", "ToSignatureBytes", "(", ")", "[", "]", "byte", "{", "// Extract canonically-padded bigint representations from buffer", "r", ":=", "extractCanonicalPadding", "(", "b", "[", "0", ":", "32", "]", ")", "\n", "s", ":=", "extract...
// ToSignatureBytes serializes the target fixed-sized signature into the raw // bytes of a DER encoding.
[ "ToSignatureBytes", "serializes", "the", "target", "fixed", "-", "sized", "signature", "into", "the", "raw", "bytes", "of", "a", "DER", "encoding", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/signature.go#L91-L111
129,307
lightningnetwork/lnd
watchtower/wtwire/error_code.go
String
func (c ErrorCode) String() string { switch c { case CodeOK: return "CodeOK" case CodeTemporaryFailure: return "CodeTemporaryFailure" case CodePermanentFailure: return "CodePermanentFailure" case CreateSessionCodeAlreadyExists: return "CreateSessionCodeAlreadyExists" case CreateSessionCodeRejectMaxUpdates...
go
func (c ErrorCode) String() string { switch c { case CodeOK: return "CodeOK" case CodeTemporaryFailure: return "CodeTemporaryFailure" case CodePermanentFailure: return "CodePermanentFailure" case CreateSessionCodeAlreadyExists: return "CreateSessionCodeAlreadyExists" case CreateSessionCodeRejectMaxUpdates...
[ "func", "(", "c", "ErrorCode", ")", "String", "(", ")", "string", "{", "switch", "c", "{", "case", "CodeOK", ":", "return", "\"", "\"", "\n", "case", "CodeTemporaryFailure", ":", "return", "\"", "\"", "\n", "case", "CodePermanentFailure", ":", "return", ...
// String returns a human-readable description of an ErrorCode.
[ "String", "returns", "a", "human", "-", "readable", "description", "of", "an", "ErrorCode", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/error_code.go#L25-L54
129,308
lightningnetwork/lnd
lnwire/channel_announcement.go
Decode
func (a *ChannelAnnouncement) Decode(r io.Reader, pver uint32) error { err := ReadElements(r, &a.NodeSig1, &a.NodeSig2, &a.BitcoinSig1, &a.BitcoinSig2, &a.Features, a.ChainHash[:], &a.ShortChannelID, &a.NodeID1, &a.NodeID2, &a.BitcoinKey1, &a.BitcoinKey2, ) if err != nil { return err } // ...
go
func (a *ChannelAnnouncement) Decode(r io.Reader, pver uint32) error { err := ReadElements(r, &a.NodeSig1, &a.NodeSig2, &a.BitcoinSig1, &a.BitcoinSig2, &a.Features, a.ChainHash[:], &a.ShortChannelID, &a.NodeID1, &a.NodeID2, &a.BitcoinKey1, &a.BitcoinKey2, ) if err != nil { return err } // ...
[ "func", "(", "a", "*", "ChannelAnnouncement", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "err", ":=", "ReadElements", "(", "r", ",", "&", "a", ".", "NodeSig1", ",", "&", "a", ".", "NodeSig2", ",", "&", ...
// Decode deserializes a serialized ChannelAnnouncement stored in the passed // io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "ChannelAnnouncement", "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_announcement.go#L70-L101
129,309
lightningnetwork/lnd
lnwire/channel_announcement.go
Encode
func (a *ChannelAnnouncement) Encode(w io.Writer, pver uint32) error { return WriteElements(w, a.NodeSig1, a.NodeSig2, a.BitcoinSig1, a.BitcoinSig2, a.Features, a.ChainHash[:], a.ShortChannelID, a.NodeID1, a.NodeID2, a.BitcoinKey1, a.BitcoinKey2, a.ExtraOpaqueData, ) }
go
func (a *ChannelAnnouncement) Encode(w io.Writer, pver uint32) error { return WriteElements(w, a.NodeSig1, a.NodeSig2, a.BitcoinSig1, a.BitcoinSig2, a.Features, a.ChainHash[:], a.ShortChannelID, a.NodeID1, a.NodeID2, a.BitcoinKey1, a.BitcoinKey2, a.ExtraOpaqueData, ) }
[ "func", "(", "a", "*", "ChannelAnnouncement", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "a", ".", "NodeSig1", ",", "a", ".", "NodeSig2", ",", "a", ".", "BitcoinSi...
// Encode serializes the target ChannelAnnouncement into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "ChannelAnnouncement", "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_announcement.go#L107-L122
129,310
lightningnetwork/lnd
channeldb/payments.go
FromBytes
func (ps *PaymentStatus) FromBytes(status []byte) error { if len(status) != 1 { return errors.New("payment status is empty") } switch PaymentStatus(status[0]) { case StatusGrounded, StatusInFlight, StatusCompleted: *ps = PaymentStatus(status[0]) default: return errors.New("unknown payment status") } retu...
go
func (ps *PaymentStatus) FromBytes(status []byte) error { if len(status) != 1 { return errors.New("payment status is empty") } switch PaymentStatus(status[0]) { case StatusGrounded, StatusInFlight, StatusCompleted: *ps = PaymentStatus(status[0]) default: return errors.New("unknown payment status") } retu...
[ "func", "(", "ps", "*", "PaymentStatus", ")", "FromBytes", "(", "status", "[", "]", "byte", ")", "error", "{", "if", "len", "(", "status", ")", "!=", "1", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "switch", "Pa...
// FromBytes sets status from slice of bytes.
[ "FromBytes", "sets", "status", "from", "slice", "of", "bytes", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/payments.go#L51-L64
129,311
lightningnetwork/lnd
channeldb/payments.go
AddPayment
func (db *DB) AddPayment(payment *OutgoingPayment) error { // Validate the field of the inner voice within the outgoing payment, // these must also adhere to the same constraints as regular invoices. if err := validateInvoice(&payment.Invoice); err != nil { return err } // We first serialize the payment before ...
go
func (db *DB) AddPayment(payment *OutgoingPayment) error { // Validate the field of the inner voice within the outgoing payment, // these must also adhere to the same constraints as regular invoices. if err := validateInvoice(&payment.Invoice); err != nil { return err } // We first serialize the payment before ...
[ "func", "(", "db", "*", "DB", ")", "AddPayment", "(", "payment", "*", "OutgoingPayment", ")", "error", "{", "// Validate the field of the inner voice within the outgoing payment,", "// these must also adhere to the same constraints as regular invoices.", "if", "err", ":=", "val...
// AddPayment saves a successful payment to the database. It is assumed that // all payment are sent using unique payment hashes.
[ "AddPayment", "saves", "a", "successful", "payment", "to", "the", "database", ".", "It", "is", "assumed", "that", "all", "payment", "are", "sent", "using", "unique", "payment", "hashes", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/payments.go#L105-L141
129,312
lightningnetwork/lnd
channeldb/payments.go
FetchAllPayments
func (db *DB) FetchAllPayments() ([]*OutgoingPayment, error) { var payments []*OutgoingPayment err := db.View(func(tx *bbolt.Tx) error { bucket := tx.Bucket(paymentBucket) if bucket == nil { return ErrNoPaymentsCreated } return bucket.ForEach(func(k, v []byte) error { // If the value is nil, then we i...
go
func (db *DB) FetchAllPayments() ([]*OutgoingPayment, error) { var payments []*OutgoingPayment err := db.View(func(tx *bbolt.Tx) error { bucket := tx.Bucket(paymentBucket) if bucket == nil { return ErrNoPaymentsCreated } return bucket.ForEach(func(k, v []byte) error { // If the value is nil, then we i...
[ "func", "(", "db", "*", "DB", ")", "FetchAllPayments", "(", ")", "(", "[", "]", "*", "OutgoingPayment", ",", "error", ")", "{", "var", "payments", "[", "]", "*", "OutgoingPayment", "\n\n", "err", ":=", "db", ".", "View", "(", "func", "(", "tx", "*"...
// FetchAllPayments returns all outgoing payments in DB.
[ "FetchAllPayments", "returns", "all", "outgoing", "payments", "in", "DB", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/payments.go#L144-L175
129,313
lightningnetwork/lnd
channeldb/payments.go
DeleteAllPayments
func (db *DB) DeleteAllPayments() error { return db.Update(func(tx *bbolt.Tx) error { err := tx.DeleteBucket(paymentBucket) if err != nil && err != bbolt.ErrBucketNotFound { return err } _, err = tx.CreateBucket(paymentBucket) return err }) }
go
func (db *DB) DeleteAllPayments() error { return db.Update(func(tx *bbolt.Tx) error { err := tx.DeleteBucket(paymentBucket) if err != nil && err != bbolt.ErrBucketNotFound { return err } _, err = tx.CreateBucket(paymentBucket) return err }) }
[ "func", "(", "db", "*", "DB", ")", "DeleteAllPayments", "(", ")", "error", "{", "return", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "err", ":=", "tx", ".", "DeleteBucket", "(", "paymentBucket", ")", "\...
// DeleteAllPayments deletes all payments from DB.
[ "DeleteAllPayments", "deletes", "all", "payments", "from", "DB", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/payments.go#L178-L188
129,314
lightningnetwork/lnd
channeldb/payments.go
FetchPaymentStatus
func (db *DB) FetchPaymentStatus(paymentHash [32]byte) (PaymentStatus, error) { var paymentStatus = StatusGrounded err := db.View(func(tx *bbolt.Tx) error { var err error paymentStatus, err = FetchPaymentStatusTx(tx, paymentHash) return err }) if err != nil { return StatusGrounded, err } return paymentSt...
go
func (db *DB) FetchPaymentStatus(paymentHash [32]byte) (PaymentStatus, error) { var paymentStatus = StatusGrounded err := db.View(func(tx *bbolt.Tx) error { var err error paymentStatus, err = FetchPaymentStatusTx(tx, paymentHash) return err }) if err != nil { return StatusGrounded, err } return paymentSt...
[ "func", "(", "db", "*", "DB", ")", "FetchPaymentStatus", "(", "paymentHash", "[", "32", "]", "byte", ")", "(", "PaymentStatus", ",", "error", ")", "{", "var", "paymentStatus", "=", "StatusGrounded", "\n", "err", ":=", "db", ".", "View", "(", "func", "(...
// FetchPaymentStatus returns the payment status for outgoing payment. // If status of the payment isn't found, it will default to "StatusGrounded".
[ "FetchPaymentStatus", "returns", "the", "payment", "status", "for", "outgoing", "payment", ".", "If", "status", "of", "the", "payment", "isn", "t", "found", "it", "will", "default", "to", "StatusGrounded", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/payments.go#L215-L227
129,315
lightningnetwork/lnd
channeldb/payments.go
FetchPaymentStatusTx
func FetchPaymentStatusTx(tx *bbolt.Tx, paymentHash [32]byte) (PaymentStatus, error) { // The default status for all payments that aren't recorded in database. var paymentStatus = StatusGrounded bucket := tx.Bucket(paymentStatusBucket) if bucket == nil { return paymentStatus, nil } paymentStatusBytes := bucke...
go
func FetchPaymentStatusTx(tx *bbolt.Tx, paymentHash [32]byte) (PaymentStatus, error) { // The default status for all payments that aren't recorded in database. var paymentStatus = StatusGrounded bucket := tx.Bucket(paymentStatusBucket) if bucket == nil { return paymentStatus, nil } paymentStatusBytes := bucke...
[ "func", "FetchPaymentStatusTx", "(", "tx", "*", "bbolt", ".", "Tx", ",", "paymentHash", "[", "32", "]", "byte", ")", "(", "PaymentStatus", ",", "error", ")", "{", "// The default status for all payments that aren't recorded in database.", "var", "paymentStatus", "=", ...
// FetchPaymentStatusTx is a helper method that returns the payment status for // outgoing payment. If status of the payment isn't found, it will default to // "StatusGrounded". It accepts the boltdb transactions such that this method // can be composed into other atomic operations.
[ "FetchPaymentStatusTx", "is", "a", "helper", "method", "that", "returns", "the", "payment", "status", "for", "outgoing", "payment", ".", "If", "status", "of", "the", "payment", "isn", "t", "found", "it", "will", "default", "to", "StatusGrounded", ".", "It", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/payments.go#L233-L250
129,316
lightningnetwork/lnd
lnd.go
getTLSConfig
func getTLSConfig(cfg *config) (*tls.Config, *credentials.TransportCredentials, string, error) { // Ensure we create TLS key and certificate if they don't exist if !fileExists(cfg.TLSCertPath) && !fileExists(cfg.TLSKeyPath) { err := genCertPair(cfg.TLSCertPath, cfg.TLSKeyPath) if err != nil { return nil, nil...
go
func getTLSConfig(cfg *config) (*tls.Config, *credentials.TransportCredentials, string, error) { // Ensure we create TLS key and certificate if they don't exist if !fileExists(cfg.TLSCertPath) && !fileExists(cfg.TLSKeyPath) { err := genCertPair(cfg.TLSCertPath, cfg.TLSKeyPath) if err != nil { return nil, nil...
[ "func", "getTLSConfig", "(", "cfg", "*", "config", ")", "(", "*", "tls", ".", "Config", ",", "*", "credentials", ".", "TransportCredentials", ",", "string", ",", "error", ")", "{", "// Ensure we create TLS key and certificate if they don't exist", "if", "!", "file...
// getTLSConfig returns a TLS configuration for the gRPC server and credentials // and a proxy destination for the REST reverse proxy.
[ "getTLSConfig", "returns", "a", "TLS", "configuration", "for", "the", "gRPC", "server", "and", "credentials", "and", "a", "proxy", "destination", "for", "the", "REST", "reverse", "proxy", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnd.go#L429-L470
129,317
lightningnetwork/lnd
lnd.go
genMacaroons
func genMacaroons(ctx context.Context, svc *macaroons.Service, admFile, roFile, invoiceFile string) error { // First, we'll generate a macaroon that only allows the caller to // access invoice related calls. This is useful for merchants and other // services to allow an isolated instance that can only query and /...
go
func genMacaroons(ctx context.Context, svc *macaroons.Service, admFile, roFile, invoiceFile string) error { // First, we'll generate a macaroon that only allows the caller to // access invoice related calls. This is useful for merchants and other // services to allow an isolated instance that can only query and /...
[ "func", "genMacaroons", "(", "ctx", "context", ".", "Context", ",", "svc", "*", "macaroons", ".", "Service", ",", "admFile", ",", "roFile", ",", "invoiceFile", "string", ")", "error", "{", "// First, we'll generate a macaroon that only allows the caller to", "// acces...
// genMacaroons generates three macaroon files; one admin-level, one for // invoice access and one read-only. These can also be used to generate more // granular macaroons.
[ "genMacaroons", "generates", "three", "macaroon", "files", ";", "one", "admin", "-", "level", "one", "for", "invoice", "access", "and", "one", "read", "-", "only", ".", "These", "can", "also", "be", "used", "to", "generate", "more", "granular", "macaroons", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnd.go#L622-L678
129,318
lightningnetwork/lnd
watchtower/wtmock/signer.go
SignOutputRaw
func (s *MockSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) ([]byte, error) { s.mu.Lock() defer s.mu.Unlock() witnessScript := signDesc.WitnessScript amt := signDesc.Output.Value privKey, ok := s.keys[signDesc.KeyDesc.KeyLocator] if !ok { panic("cannot sign w/ unknown key") } sig, e...
go
func (s *MockSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) ([]byte, error) { s.mu.Lock() defer s.mu.Unlock() witnessScript := signDesc.WitnessScript amt := signDesc.Output.Value privKey, ok := s.keys[signDesc.KeyDesc.KeyLocator] if !ok { panic("cannot sign w/ unknown key") } sig, e...
[ "func", "(", "s", "*", "MockSigner", ")", "SignOutputRaw", "(", "tx", "*", "wire", ".", "MsgTx", ",", "signDesc", "*", "input", ".", "SignDescriptor", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n"...
// SignOutputRaw signs an input on the passed transaction using the input index // in the sign descriptor. The returned signature is the raw DER-encoded // signature without the signhash flag.
[ "SignOutputRaw", "signs", "an", "input", "on", "the", "passed", "transaction", "using", "the", "input", "index", "in", "the", "sign", "descriptor", ".", "The", "returned", "signature", "is", "the", "raw", "DER", "-", "encoded", "signature", "without", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/signer.go#L32-L54
129,319
lightningnetwork/lnd
watchtower/wtmock/signer.go
ComputeInputScript
func (s *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error) { panic("not implemented") }
go
func (s *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error) { panic("not implemented") }
[ "func", "(", "s", "*", "MockSigner", ")", "ComputeInputScript", "(", "tx", "*", "wire", ".", "MsgTx", ",", "signDesc", "*", "input", ".", "SignDescriptor", ")", "(", "*", "input", ".", "Script", ",", "error", ")", "{", "panic", "(", "\"", "\"", ")", ...
// ComputeInputScript is not implemented.
[ "ComputeInputScript", "is", "not", "implemented", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/signer.go#L57-L60
129,320
lightningnetwork/lnd
watchtower/wtmock/signer.go
AddPrivKey
func (s *MockSigner) AddPrivKey(privKey *btcec.PrivateKey) keychain.KeyLocator { s.mu.Lock() defer s.mu.Unlock() keyLoc := keychain.KeyLocator{ Index: s.index, } s.index++ s.keys[keyLoc] = privKey return keyLoc }
go
func (s *MockSigner) AddPrivKey(privKey *btcec.PrivateKey) keychain.KeyLocator { s.mu.Lock() defer s.mu.Unlock() keyLoc := keychain.KeyLocator{ Index: s.index, } s.index++ s.keys[keyLoc] = privKey return keyLoc }
[ "func", "(", "s", "*", "MockSigner", ")", "AddPrivKey", "(", "privKey", "*", "btcec", ".", "PrivateKey", ")", "keychain", ".", "KeyLocator", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n",...
// AddPrivKey records the passed privKey in the MockSigner's registry of keys it // can sign with in the future. A unique key locator is returned, allowing the // caller to sign with this key when presented via an input.SignDescriptor.
[ "AddPrivKey", "records", "the", "passed", "privKey", "in", "the", "MockSigner", "s", "registry", "of", "keys", "it", "can", "sign", "with", "in", "the", "future", ".", "A", "unique", "key", "locator", "is", "returned", "allowing", "the", "caller", "to", "s...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/signer.go#L65-L77
129,321
lightningnetwork/lnd
lnwallet/channel.go
String
func (u updateType) String() string { switch u { case Add: return "Add" case Fail: return "Fail" case MalformedFail: return "MalformedFail" case Settle: return "Settle" case FeeUpdate: return "FeeUpdate" default: return "<unknown type>" } }
go
func (u updateType) String() string { switch u { case Add: return "Add" case Fail: return "Fail" case MalformedFail: return "MalformedFail" case Settle: return "Settle" case FeeUpdate: return "FeeUpdate" default: return "<unknown type>" } }
[ "func", "(", "u", "updateType", ")", "String", "(", ")", "string", "{", "switch", "u", "{", "case", "Add", ":", "return", "\"", "\"", "\n", "case", "Fail", ":", "return", "\"", "\"", "\n", "case", "MalformedFail", ":", "return", "\"", "\"", "\n", "...
// String returns a human readable string that uniquely identifies the target // update type.
[ "String", "returns", "a", "human", "readable", "string", "that", "uniquely", "identifies", "the", "target", "update", "type", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L177-L192
129,322
lightningnetwork/lnd
lnwallet/channel.go
locateOutputIndex
func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx, ourCommit bool, dups map[PaymentHash][]int32) (int32, error) { // Checks to see if element (e) exists in slice (s). contains := func(s []int32, e int32) bool { for _, a := range s { if a == e { return true } } return false } // If this ...
go
func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx, ourCommit bool, dups map[PaymentHash][]int32) (int32, error) { // Checks to see if element (e) exists in slice (s). contains := func(s []int32, e int32) bool { for _, a := range s { if a == e { return true } } return false } // If this ...
[ "func", "locateOutputIndex", "(", "p", "*", "PaymentDescriptor", ",", "tx", "*", "wire", ".", "MsgTx", ",", "ourCommit", "bool", ",", "dups", "map", "[", "PaymentHash", "]", "[", "]", "int32", ")", "(", "int32", ",", "error", ")", "{", "// Checks to see ...
// locateOutputIndex is a small helper function to locate the output index of a // particular HTLC within the current commitment transaction. The duplicate map // massed in is to be retained for each output within the commitment // transition. This ensures that we don't assign multiple HTLC's to the same // index with...
[ "locateOutputIndex", "is", "a", "small", "helper", "function", "to", "locate", "the", "output", "index", "of", "a", "particular", "HTLC", "within", "the", "current", "commitment", "transaction", ".", "The", "duplicate", "map", "massed", "in", "is", "to", "be",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L532-L573
129,323
lightningnetwork/lnd
lnwallet/channel.go
populateHtlcIndexes
func (c *commitment) populateHtlcIndexes() error { // First, we'll set up some state to allow us to locate the output // index of the all the HTLC's within the commitment transaction. We // must keep this index so we can validate the HTLC signatures sent to // us. dups := make(map[PaymentHash][]int32) c.outgoingH...
go
func (c *commitment) populateHtlcIndexes() error { // First, we'll set up some state to allow us to locate the output // index of the all the HTLC's within the commitment transaction. We // must keep this index so we can validate the HTLC signatures sent to // us. dups := make(map[PaymentHash][]int32) c.outgoingH...
[ "func", "(", "c", "*", "commitment", ")", "populateHtlcIndexes", "(", ")", "error", "{", "// First, we'll set up some state to allow us to locate the output", "// index of the all the HTLC's within the commitment transaction. We", "// must keep this index so we can validate the HTLC signat...
// populateHtlcIndexes modifies the set of HTLC's locked-into the target view // to have full indexing information populated. This information is required as // we need to keep track of the indexes of each HTLC in order to properly write // the current state to disk, and also to locate the PaymentDescriptor // correspo...
[ "populateHtlcIndexes", "modifies", "the", "set", "of", "HTLC", "s", "locked", "-", "into", "the", "target", "view", "to", "have", "full", "indexing", "information", "populated", ".", "This", "information", "is", "required", "as", "we", "need", "to", "keep", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L580-L666
129,324
lightningnetwork/lnd
lnwallet/channel.go
toDiskCommit
func (c *commitment) toDiskCommit(ourCommit bool) *channeldb.ChannelCommitment { numHtlcs := len(c.outgoingHTLCs) + len(c.incomingHTLCs) commit := &channeldb.ChannelCommitment{ CommitHeight: c.height, LocalLogIndex: c.ourMessageIndex, LocalHtlcIndex: c.ourHtlcIndex, RemoteLogIndex: c.theirMessageIndex...
go
func (c *commitment) toDiskCommit(ourCommit bool) *channeldb.ChannelCommitment { numHtlcs := len(c.outgoingHTLCs) + len(c.incomingHTLCs) commit := &channeldb.ChannelCommitment{ CommitHeight: c.height, LocalLogIndex: c.ourMessageIndex, LocalHtlcIndex: c.ourHtlcIndex, RemoteLogIndex: c.theirMessageIndex...
[ "func", "(", "c", "*", "commitment", ")", "toDiskCommit", "(", "ourCommit", "bool", ")", "*", "channeldb", ".", "ChannelCommitment", "{", "numHtlcs", ":=", "len", "(", "c", ".", "outgoingHTLCs", ")", "+", "len", "(", "c", ".", "incomingHTLCs", ")", "\n\n...
// toDiskCommit converts the target commitment into a format suitable to be // written to disk after an accepted state transition.
[ "toDiskCommit", "converts", "the", "target", "commitment", "into", "a", "format", "suitable", "to", "be", "written", "to", "disk", "after", "an", "accepted", "state", "transition", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L670-L739
129,325
lightningnetwork/lnd
lnwallet/channel.go
diskHtlcToPayDesc
func (lc *LightningChannel) diskHtlcToPayDesc(feeRate SatPerKWeight, commitHeight uint64, htlc *channeldb.HTLC, localCommitKeys, remoteCommitKeys *CommitmentKeyRing) (PaymentDescriptor, error) { // The proper pkScripts for this PaymentDescriptor must be // generated so we can easily locate them within the commitme...
go
func (lc *LightningChannel) diskHtlcToPayDesc(feeRate SatPerKWeight, commitHeight uint64, htlc *channeldb.HTLC, localCommitKeys, remoteCommitKeys *CommitmentKeyRing) (PaymentDescriptor, error) { // The proper pkScripts for this PaymentDescriptor must be // generated so we can easily locate them within the commitme...
[ "func", "(", "lc", "*", "LightningChannel", ")", "diskHtlcToPayDesc", "(", "feeRate", "SatPerKWeight", ",", "commitHeight", "uint64", ",", "htlc", "*", "channeldb", ".", "HTLC", ",", "localCommitKeys", ",", "remoteCommitKeys", "*", "CommitmentKeyRing", ")", "(", ...
// diskHtlcToPayDesc converts an HTLC previously written to disk within a // commitment state to the form required to manipulate in memory within the // commitment struct and updateLog. This function is used when we need to // restore commitment state written do disk back into memory once we need to // restart a channe...
[ "diskHtlcToPayDesc", "converts", "an", "HTLC", "previously", "written", "to", "disk", "within", "a", "commitment", "state", "to", "the", "form", "required", "to", "manipulate", "in", "memory", "within", "the", "commitment", "struct", "and", "updateLog", ".", "Th...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L746-L804
129,326
lightningnetwork/lnd
lnwallet/channel.go
extractPayDescs
func (lc *LightningChannel) extractPayDescs(commitHeight uint64, feeRate SatPerKWeight, htlcs []channeldb.HTLC, localCommitKeys, remoteCommitKeys *CommitmentKeyRing) ([]PaymentDescriptor, []PaymentDescriptor, error) { var ( incomingHtlcs []PaymentDescriptor outgoingHtlcs []PaymentDescriptor ) // For each inc...
go
func (lc *LightningChannel) extractPayDescs(commitHeight uint64, feeRate SatPerKWeight, htlcs []channeldb.HTLC, localCommitKeys, remoteCommitKeys *CommitmentKeyRing) ([]PaymentDescriptor, []PaymentDescriptor, error) { var ( incomingHtlcs []PaymentDescriptor outgoingHtlcs []PaymentDescriptor ) // For each inc...
[ "func", "(", "lc", "*", "LightningChannel", ")", "extractPayDescs", "(", "commitHeight", "uint64", ",", "feeRate", "SatPerKWeight", ",", "htlcs", "[", "]", "channeldb", ".", "HTLC", ",", "localCommitKeys", ",", "remoteCommitKeys", "*", "CommitmentKeyRing", ")", ...
// extractPayDescs will convert all HTLC's present within a disk commit state // to a set of incoming and outgoing payment descriptors. Once reconstructed, // these payment descriptors can be re-inserted into the in-memory updateLog // for each side.
[ "extractPayDescs", "will", "convert", "all", "HTLC", "s", "present", "within", "a", "disk", "commit", "state", "to", "a", "set", "of", "incoming", "and", "outgoing", "payment", "descriptors", ".", "Once", "reconstructed", "these", "payment", "descriptors", "can"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L810-L843
129,327
lightningnetwork/lnd
lnwallet/channel.go
diskCommitToMemCommit
func (lc *LightningChannel) diskCommitToMemCommit(isLocal bool, diskCommit *channeldb.ChannelCommitment, localCommitPoint, remoteCommitPoint *btcec.PublicKey) (*commitment, error) { // First, we'll need to re-derive the commitment key ring for each // party used within this particular state. If this is a pending c...
go
func (lc *LightningChannel) diskCommitToMemCommit(isLocal bool, diskCommit *channeldb.ChannelCommitment, localCommitPoint, remoteCommitPoint *btcec.PublicKey) (*commitment, error) { // First, we'll need to re-derive the commitment key ring for each // party used within this particular state. If this is a pending c...
[ "func", "(", "lc", "*", "LightningChannel", ")", "diskCommitToMemCommit", "(", "isLocal", "bool", ",", "diskCommit", "*", "channeldb", ".", "ChannelCommitment", ",", "localCommitPoint", ",", "remoteCommitPoint", "*", "btcec", ".", "PublicKey", ")", "(", "*", "co...
// diskCommitToMemCommit converts the on-disk commitment format to our // in-memory commitment format which is needed in order to properly resume // channel operations after a restart.
[ "diskCommitToMemCommit", "converts", "the", "on", "-", "disk", "commitment", "format", "to", "our", "in", "-", "memory", "commitment", "format", "which", "is", "needed", "in", "order", "to", "properly", "resume", "channel", "operations", "after", "a", "restart",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L848-L913
129,328
lightningnetwork/lnd
lnwallet/channel.go
deriveCommitmentKeys
func deriveCommitmentKeys(commitPoint *btcec.PublicKey, isOurCommit bool, localChanCfg, remoteChanCfg *channeldb.ChannelConfig) *CommitmentKeyRing { // First, we'll derive all the keys that don't depend on the context of // whose commitment transaction this is. keyRing := &CommitmentKeyRing{ CommitPoint: commitP...
go
func deriveCommitmentKeys(commitPoint *btcec.PublicKey, isOurCommit bool, localChanCfg, remoteChanCfg *channeldb.ChannelConfig) *CommitmentKeyRing { // First, we'll derive all the keys that don't depend on the context of // whose commitment transaction this is. keyRing := &CommitmentKeyRing{ CommitPoint: commitP...
[ "func", "deriveCommitmentKeys", "(", "commitPoint", "*", "btcec", ".", "PublicKey", ",", "isOurCommit", "bool", ",", "localChanCfg", ",", "remoteChanCfg", "*", "channeldb", ".", "ChannelConfig", ")", "*", "CommitmentKeyRing", "{", "// First, we'll derive all the keys th...
// deriveCommitmentKey generates a new commitment key set using the base points // and commitment point. The keys are derived differently depending whether the // commitment transaction is ours or the remote peer's.
[ "deriveCommitmentKey", "generates", "a", "new", "commitment", "key", "set", "using", "the", "base", "points", "and", "commitment", "point", ".", "The", "keys", "are", "derived", "differently", "depending", "whether", "the", "commitment", "transaction", "is", "ours...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L967-L1018
129,329
lightningnetwork/lnd
lnwallet/channel.go
hasUnackedCommitment
func (s *commitmentChain) hasUnackedCommitment() bool { return s.commitments.Front() != s.commitments.Back() }
go
func (s *commitmentChain) hasUnackedCommitment() bool { return s.commitments.Front() != s.commitments.Back() }
[ "func", "(", "s", "*", "commitmentChain", ")", "hasUnackedCommitment", "(", ")", "bool", "{", "return", "s", ".", "commitments", ".", "Front", "(", ")", "!=", "s", ".", "commitments", ".", "Back", "(", ")", "\n", "}" ]
// hasUnackedCommitment returns true if the commitment chain has more than one // entry. The tail of the commitment chain has been ACKed by revoking all prior // commitments, but any subsequent commitments have not yet been ACKed.
[ "hasUnackedCommitment", "returns", "true", "if", "the", "commitment", "chain", "has", "more", "than", "one", "entry", ".", "The", "tail", "of", "the", "commitment", "chain", "has", "been", "ACKed", "by", "revoking", "all", "prior", "commitments", "but", "any",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1075-L1077
129,330
lightningnetwork/lnd
lnwallet/channel.go
newUpdateLog
func newUpdateLog(logIndex, htlcCounter uint64) *updateLog { return &updateLog{ List: list.New(), updateIndex: make(map[uint64]*list.Element), htlcIndex: make(map[uint64]*list.Element), logIndex: logIndex, htlcCounter: htlcCounter, modifiedHtlcs: make(map[uint64]struct{}), } }
go
func newUpdateLog(logIndex, htlcCounter uint64) *updateLog { return &updateLog{ List: list.New(), updateIndex: make(map[uint64]*list.Element), htlcIndex: make(map[uint64]*list.Element), logIndex: logIndex, htlcCounter: htlcCounter, modifiedHtlcs: make(map[uint64]struct{}), } }
[ "func", "newUpdateLog", "(", "logIndex", ",", "htlcCounter", "uint64", ")", "*", "updateLog", "{", "return", "&", "updateLog", "{", "List", ":", "list", ".", "New", "(", ")", ",", "updateIndex", ":", "make", "(", "map", "[", "uint64", "]", "*", "list",...
// newUpdateLog creates a new updateLog instance.
[ "newUpdateLog", "creates", "a", "new", "updateLog", "instance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1120-L1129
129,331
lightningnetwork/lnd
lnwallet/channel.go
restoreHtlc
func (u *updateLog) restoreHtlc(pd *PaymentDescriptor) { if _, ok := u.htlcIndex[pd.HtlcIndex]; ok { return } u.htlcIndex[pd.HtlcIndex] = u.PushBack(pd) }
go
func (u *updateLog) restoreHtlc(pd *PaymentDescriptor) { if _, ok := u.htlcIndex[pd.HtlcIndex]; ok { return } u.htlcIndex[pd.HtlcIndex] = u.PushBack(pd) }
[ "func", "(", "u", "*", "updateLog", ")", "restoreHtlc", "(", "pd", "*", "PaymentDescriptor", ")", "{", "if", "_", ",", "ok", ":=", "u", ".", "htlcIndex", "[", "pd", ".", "HtlcIndex", "]", ";", "ok", "{", "return", "\n", "}", "\n\n", "u", ".", "ht...
// restoreHtlc will "restore" a prior HTLC to the updateLog. We say restore as // this method is intended to be used when re-covering a prior commitment // state. This function differs from appendHtlc in that it won't increment // either of log's counters. If the HTLC is already present, then it is // ignored.
[ "restoreHtlc", "will", "restore", "a", "prior", "HTLC", "to", "the", "updateLog", ".", "We", "say", "restore", "as", "this", "method", "is", "intended", "to", "be", "used", "when", "re", "-", "covering", "a", "prior", "commitment", "state", ".", "This", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1136-L1142
129,332
lightningnetwork/lnd
lnwallet/channel.go
appendUpdate
func (u *updateLog) appendUpdate(pd *PaymentDescriptor) { u.updateIndex[u.logIndex] = u.PushBack(pd) u.logIndex++ }
go
func (u *updateLog) appendUpdate(pd *PaymentDescriptor) { u.updateIndex[u.logIndex] = u.PushBack(pd) u.logIndex++ }
[ "func", "(", "u", "*", "updateLog", ")", "appendUpdate", "(", "pd", "*", "PaymentDescriptor", ")", "{", "u", ".", "updateIndex", "[", "u", ".", "logIndex", "]", "=", "u", ".", "PushBack", "(", "pd", ")", "\n", "u", ".", "logIndex", "++", "\n", "}" ...
// appendUpdate appends a new update to the tip of the updateLog. The entry is // also added to index accordingly.
[ "appendUpdate", "appends", "a", "new", "update", "to", "the", "tip", "of", "the", "updateLog", ".", "The", "entry", "is", "also", "added", "to", "index", "accordingly", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1146-L1149
129,333
lightningnetwork/lnd
lnwallet/channel.go
appendHtlc
func (u *updateLog) appendHtlc(pd *PaymentDescriptor) { u.htlcIndex[u.htlcCounter] = u.PushBack(pd) u.htlcCounter++ u.logIndex++ }
go
func (u *updateLog) appendHtlc(pd *PaymentDescriptor) { u.htlcIndex[u.htlcCounter] = u.PushBack(pd) u.htlcCounter++ u.logIndex++ }
[ "func", "(", "u", "*", "updateLog", ")", "appendHtlc", "(", "pd", "*", "PaymentDescriptor", ")", "{", "u", ".", "htlcIndex", "[", "u", ".", "htlcCounter", "]", "=", "u", ".", "PushBack", "(", "pd", ")", "\n", "u", ".", "htlcCounter", "++", "\n\n", ...
// appendHtlc appends a new HTLC offer to the tip of the update log. The entry // is also added to the offer index accordingly.
[ "appendHtlc", "appends", "a", "new", "HTLC", "offer", "to", "the", "tip", "of", "the", "update", "log", ".", "The", "entry", "is", "also", "added", "to", "the", "offer", "index", "accordingly", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1153-L1158
129,334
lightningnetwork/lnd
lnwallet/channel.go
lookupHtlc
func (u *updateLog) lookupHtlc(i uint64) *PaymentDescriptor { htlc, ok := u.htlcIndex[i] if !ok { return nil } return htlc.Value.(*PaymentDescriptor) }
go
func (u *updateLog) lookupHtlc(i uint64) *PaymentDescriptor { htlc, ok := u.htlcIndex[i] if !ok { return nil } return htlc.Value.(*PaymentDescriptor) }
[ "func", "(", "u", "*", "updateLog", ")", "lookupHtlc", "(", "i", "uint64", ")", "*", "PaymentDescriptor", "{", "htlc", ",", "ok", ":=", "u", ".", "htlcIndex", "[", "i", "]", "\n", "if", "!", "ok", "{", "return", "nil", "\n", "}", "\n\n", "return", ...
// lookupHtlc attempts to look up an offered HTLC according to its offer // index. If the entry isn't found, then a nil pointer is returned.
[ "lookupHtlc", "attempts", "to", "look", "up", "an", "offered", "HTLC", "according", "to", "its", "offer", "index", ".", "If", "the", "entry", "isn", "t", "found", "then", "a", "nil", "pointer", "is", "returned", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1162-L1169
129,335
lightningnetwork/lnd
lnwallet/channel.go
removeUpdate
func (u *updateLog) removeUpdate(i uint64) { entry := u.updateIndex[i] u.Remove(entry) delete(u.updateIndex, i) }
go
func (u *updateLog) removeUpdate(i uint64) { entry := u.updateIndex[i] u.Remove(entry) delete(u.updateIndex, i) }
[ "func", "(", "u", "*", "updateLog", ")", "removeUpdate", "(", "i", "uint64", ")", "{", "entry", ":=", "u", ".", "updateIndex", "[", "i", "]", "\n", "u", ".", "Remove", "(", "entry", ")", "\n", "delete", "(", "u", ".", "updateIndex", ",", "i", ")"...
// remove attempts to remove an entry from the update log. If the entry is // found, then the entry will be removed from the update log and index.
[ "remove", "attempts", "to", "remove", "an", "entry", "from", "the", "update", "log", ".", "If", "the", "entry", "is", "found", "then", "the", "entry", "will", "be", "removed", "from", "the", "update", "log", "and", "index", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1173-L1177
129,336
lightningnetwork/lnd
lnwallet/channel.go
removeHtlc
func (u *updateLog) removeHtlc(i uint64) { entry := u.htlcIndex[i] u.Remove(entry) delete(u.htlcIndex, i) delete(u.modifiedHtlcs, i) }
go
func (u *updateLog) removeHtlc(i uint64) { entry := u.htlcIndex[i] u.Remove(entry) delete(u.htlcIndex, i) delete(u.modifiedHtlcs, i) }
[ "func", "(", "u", "*", "updateLog", ")", "removeHtlc", "(", "i", "uint64", ")", "{", "entry", ":=", "u", ".", "htlcIndex", "[", "i", "]", "\n", "u", ".", "Remove", "(", "entry", ")", "\n", "delete", "(", "u", ".", "htlcIndex", ",", "i", ")", "\...
// removeHtlc attempts to remove an HTLC offer form the update log. If the // entry is found, then the entry will be removed from both the main log and // the offer index.
[ "removeHtlc", "attempts", "to", "remove", "an", "HTLC", "offer", "form", "the", "update", "log", ".", "If", "the", "entry", "is", "found", "then", "the", "entry", "will", "be", "removed", "from", "both", "the", "main", "log", "and", "the", "offer", "inde...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1182-L1188
129,337
lightningnetwork/lnd
lnwallet/channel.go
htlcHasModification
func (u *updateLog) htlcHasModification(i uint64) bool { _, o := u.modifiedHtlcs[i] return o }
go
func (u *updateLog) htlcHasModification(i uint64) bool { _, o := u.modifiedHtlcs[i] return o }
[ "func", "(", "u", "*", "updateLog", ")", "htlcHasModification", "(", "i", "uint64", ")", "bool", "{", "_", ",", "o", ":=", "u", ".", "modifiedHtlcs", "[", "i", "]", "\n", "return", "o", "\n", "}" ]
// htlcHasModification returns true if the HTLC identified by the passed index // has a pending modification within the log.
[ "htlcHasModification", "returns", "true", "if", "the", "HTLC", "identified", "by", "the", "passed", "index", "has", "a", "pending", "modification", "within", "the", "log", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1192-L1195
129,338
lightningnetwork/lnd
lnwallet/channel.go
NewLightningChannel
func NewLightningChannel(signer input.Signer, pCache PreimageCache, state *channeldb.OpenChannel, sigPool *SigPool) (*LightningChannel, error) { localCommit := state.LocalCommitment remoteCommit := state.RemoteCommitment // First, initialize the update logs with their current counter values // from the local an...
go
func NewLightningChannel(signer input.Signer, pCache PreimageCache, state *channeldb.OpenChannel, sigPool *SigPool) (*LightningChannel, error) { localCommit := state.LocalCommitment remoteCommit := state.RemoteCommitment // First, initialize the update logs with their current counter values // from the local an...
[ "func", "NewLightningChannel", "(", "signer", "input", ".", "Signer", ",", "pCache", "PreimageCache", ",", "state", "*", "channeldb", ".", "OpenChannel", ",", "sigPool", "*", "SigPool", ")", "(", "*", "LightningChannel", ",", "error", ")", "{", "localCommit", ...
// NewLightningChannel creates a new, active payment channel given an // implementation of the chain notifier, channel database, and the current // settled channel state. Throughout state transitions, then channel will // automatically persist pertinent state to the database in an efficient // manner.
[ "NewLightningChannel", "creates", "a", "new", "active", "payment", "channel", "given", "an", "implementation", "of", "the", "chain", "notifier", "channel", "database", "and", "the", "current", "settled", "channel", "state", ".", "Throughout", "state", "transitions",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1371-L1422
129,339
lightningnetwork/lnd
lnwallet/channel.go
createSignDesc
func (lc *LightningChannel) createSignDesc() error { localKey := lc.localChanCfg.MultiSigKey.PubKey.SerializeCompressed() remoteKey := lc.remoteChanCfg.MultiSigKey.PubKey.SerializeCompressed() multiSigScript, err := input.GenMultiSigScript(localKey, remoteKey) if err != nil { return err } fundingPkScript, err...
go
func (lc *LightningChannel) createSignDesc() error { localKey := lc.localChanCfg.MultiSigKey.PubKey.SerializeCompressed() remoteKey := lc.remoteChanCfg.MultiSigKey.PubKey.SerializeCompressed() multiSigScript, err := input.GenMultiSigScript(localKey, remoteKey) if err != nil { return err } fundingPkScript, err...
[ "func", "(", "lc", "*", "LightningChannel", ")", "createSignDesc", "(", ")", "error", "{", "localKey", ":=", "lc", ".", "localChanCfg", ".", "MultiSigKey", ".", "PubKey", ".", "SerializeCompressed", "(", ")", "\n", "remoteKey", ":=", "lc", ".", "remoteChanCf...
// createSignDesc derives the SignDescriptor for commitment transactions from // other fields on the LightningChannel.
[ "createSignDesc", "derives", "the", "SignDescriptor", "for", "commitment", "transactions", "from", "other", "fields", "on", "the", "LightningChannel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1426-L1451
129,340
lightningnetwork/lnd
lnwallet/channel.go
createStateHintObfuscator
func (lc *LightningChannel) createStateHintObfuscator() { state := lc.channelState if state.IsInitiator { lc.stateHintObfuscator = DeriveStateHintObfuscator( state.LocalChanCfg.PaymentBasePoint.PubKey, state.RemoteChanCfg.PaymentBasePoint.PubKey, ) } else { lc.stateHintObfuscator = DeriveStateHintObfusca...
go
func (lc *LightningChannel) createStateHintObfuscator() { state := lc.channelState if state.IsInitiator { lc.stateHintObfuscator = DeriveStateHintObfuscator( state.LocalChanCfg.PaymentBasePoint.PubKey, state.RemoteChanCfg.PaymentBasePoint.PubKey, ) } else { lc.stateHintObfuscator = DeriveStateHintObfusca...
[ "func", "(", "lc", "*", "LightningChannel", ")", "createStateHintObfuscator", "(", ")", "{", "state", ":=", "lc", ".", "channelState", "\n", "if", "state", ".", "IsInitiator", "{", "lc", ".", "stateHintObfuscator", "=", "DeriveStateHintObfuscator", "(", "state",...
// createStateHintObfuscator derives and assigns the state hint obfuscator for // the channel, which is used to encode the commitment height in the sequence // number of commitment transaction inputs.
[ "createStateHintObfuscator", "derives", "and", "assigns", "the", "state", "hint", "obfuscator", "for", "the", "channel", "which", "is", "used", "to", "encode", "the", "commitment", "height", "in", "the", "sequence", "number", "of", "commitment", "transaction", "in...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1456-L1469
129,341
lightningnetwork/lnd
lnwallet/channel.go
ResetState
func (lc *LightningChannel) ResetState() { lc.Lock() lc.status = channelOpen lc.Unlock() }
go
func (lc *LightningChannel) ResetState() { lc.Lock() lc.status = channelOpen lc.Unlock() }
[ "func", "(", "lc", "*", "LightningChannel", ")", "ResetState", "(", ")", "{", "lc", ".", "Lock", "(", ")", "\n", "lc", ".", "status", "=", "channelOpen", "\n", "lc", ".", "Unlock", "(", ")", "\n", "}" ]
// ResetState resets the state of the channel back to the default state. This // ensures that any active goroutines which need to act based on on-chain // events do so properly.
[ "ResetState", "resets", "the", "state", "of", "the", "channel", "back", "to", "the", "default", "state", ".", "This", "ensures", "that", "any", "active", "goroutines", "which", "need", "to", "act", "based", "on", "on", "-", "chain", "events", "do", "so", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1474-L1478
129,342
lightningnetwork/lnd
lnwallet/channel.go
logUpdateToPayDesc
func (lc *LightningChannel) logUpdateToPayDesc(logUpdate *channeldb.LogUpdate, remoteUpdateLog *updateLog, commitHeight uint64, feeRate SatPerKWeight, remoteCommitKeys *CommitmentKeyRing, remoteDustLimit btcutil.Amount) (*PaymentDescriptor, error) { // Depending on the type of update message we'll map that to a di...
go
func (lc *LightningChannel) logUpdateToPayDesc(logUpdate *channeldb.LogUpdate, remoteUpdateLog *updateLog, commitHeight uint64, feeRate SatPerKWeight, remoteCommitKeys *CommitmentKeyRing, remoteDustLimit btcutil.Amount) (*PaymentDescriptor, error) { // Depending on the type of update message we'll map that to a di...
[ "func", "(", "lc", "*", "LightningChannel", ")", "logUpdateToPayDesc", "(", "logUpdate", "*", "channeldb", ".", "LogUpdate", ",", "remoteUpdateLog", "*", "updateLog", ",", "commitHeight", "uint64", ",", "feeRate", "SatPerKWeight", ",", "remoteCommitKeys", "*", "Co...
// logUpdateToPayDesc converts a LogUpdate into a matching PaymentDescriptor // entry that can be re-inserted into the update log. This method is used when // we extended a state to the remote party, but the connection was obstructed // before we could finish the commitment dance. In this case, we need to // re-insert ...
[ "logUpdateToPayDesc", "converts", "a", "LogUpdate", "into", "a", "matching", "PaymentDescriptor", "entry", "that", "can", "be", "re", "-", "inserted", "into", "the", "update", "log", ".", "This", "method", "is", "used", "when", "we", "extended", "a", "state", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L1486-L1602
129,343
lightningnetwork/lnd
lnwallet/channel.go
fetchHTLCView
func (lc *LightningChannel) fetchHTLCView(theirLogIndex, ourLogIndex uint64) *htlcView { var ourHTLCs []*PaymentDescriptor for e := lc.localUpdateLog.Front(); e != nil; e = e.Next() { htlc := e.Value.(*PaymentDescriptor) // This HTLC is active from this point-of-view iff the log // index of the state update is...
go
func (lc *LightningChannel) fetchHTLCView(theirLogIndex, ourLogIndex uint64) *htlcView { var ourHTLCs []*PaymentDescriptor for e := lc.localUpdateLog.Front(); e != nil; e = e.Next() { htlc := e.Value.(*PaymentDescriptor) // This HTLC is active from this point-of-view iff the log // index of the state update is...
[ "func", "(", "lc", "*", "LightningChannel", ")", "fetchHTLCView", "(", "theirLogIndex", ",", "ourLogIndex", "uint64", ")", "*", "htlcView", "{", "var", "ourHTLCs", "[", "]", "*", "PaymentDescriptor", "\n", "for", "e", ":=", "lc", ".", "localUpdateLog", ".", ...
// fetchHTLCView returns all the candidate HTLC updates which should be // considered for inclusion within a commitment based on the passed HTLC log // indexes.
[ "fetchHTLCView", "returns", "all", "the", "candidate", "HTLC", "updates", "which", "should", "be", "considered", "for", "inclusion", "within", "a", "commitment", "based", "on", "the", "passed", "HTLC", "log", "indexes", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L2231-L2260
129,344
lightningnetwork/lnd
lnwallet/channel.go
fetchCommitmentView
func (lc *LightningChannel) fetchCommitmentView(remoteChain bool, ourLogIndex, ourHtlcIndex, theirLogIndex, theirHtlcIndex uint64, keyRing *CommitmentKeyRing) (*commitment, error) { commitChain := lc.localCommitChain if remoteChain { commitChain = lc.remoteCommitChain } nextHeight := commitChain.tip().height ...
go
func (lc *LightningChannel) fetchCommitmentView(remoteChain bool, ourLogIndex, ourHtlcIndex, theirLogIndex, theirHtlcIndex uint64, keyRing *CommitmentKeyRing) (*commitment, error) { commitChain := lc.localCommitChain if remoteChain { commitChain = lc.remoteCommitChain } nextHeight := commitChain.tip().height ...
[ "func", "(", "lc", "*", "LightningChannel", ")", "fetchCommitmentView", "(", "remoteChain", "bool", ",", "ourLogIndex", ",", "ourHtlcIndex", ",", "theirLogIndex", ",", "theirHtlcIndex", "uint64", ",", "keyRing", "*", "CommitmentKeyRing", ")", "(", "*", "commitment...
// fetchCommitmentView returns a populated commitment which expresses the state // of the channel from the point of view of a local or remote chain, evaluating // the HTLC log up to the passed indexes. This function is used to construct // both local and remote commitment transactions in order to sign or verify new // ...
[ "fetchCommitmentView", "returns", "a", "populated", "commitment", "which", "expresses", "the", "state", "of", "the", "channel", "from", "the", "point", "of", "view", "of", "a", "local", "or", "remote", "chain", "evaluating", "the", "HTLC", "log", "up", "to", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L2268-L2334
129,345
lightningnetwork/lnd
lnwallet/channel.go
processAddEntry
func processAddEntry(htlc *PaymentDescriptor, ourBalance, theirBalance *lnwire.MilliSatoshi, nextHeight uint64, remoteChain bool, isIncoming, mutateState bool) { // If we're evaluating this entry for the remote chain (to create/view // a new commitment), then we'll may be updating the height this entry // was adde...
go
func processAddEntry(htlc *PaymentDescriptor, ourBalance, theirBalance *lnwire.MilliSatoshi, nextHeight uint64, remoteChain bool, isIncoming, mutateState bool) { // If we're evaluating this entry for the remote chain (to create/view // a new commitment), then we'll may be updating the height this entry // was adde...
[ "func", "processAddEntry", "(", "htlc", "*", "PaymentDescriptor", ",", "ourBalance", ",", "theirBalance", "*", "lnwire", ".", "MilliSatoshi", ",", "nextHeight", "uint64", ",", "remoteChain", "bool", ",", "isIncoming", ",", "mutateState", "bool", ")", "{", "// If...
// processAddEntry evaluates the effect of an add entry within the HTLC log. // If the HTLC hasn't yet been committed in either chain, then the height it // was committed is updated. Keeping track of this inclusion height allows us to // later compact the log once the change is fully committed in both chains.
[ "processAddEntry", "evaluates", "the", "effect", "of", "an", "add", "entry", "within", "the", "HTLC", "log", ".", "If", "the", "HTLC", "hasn", "t", "yet", "been", "committed", "in", "either", "chain", "then", "the", "height", "it", "was", "committed", "is"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L2640-L2672
129,346
lightningnetwork/lnd
lnwallet/channel.go
processRemoveEntry
func processRemoveEntry(htlc *PaymentDescriptor, ourBalance, theirBalance *lnwire.MilliSatoshi, nextHeight uint64, remoteChain bool, isIncoming, mutateState bool) { var removeHeight *uint64 if remoteChain { removeHeight = &htlc.removeCommitHeightRemote } else { removeHeight = &htlc.removeCommitHeightLocal } ...
go
func processRemoveEntry(htlc *PaymentDescriptor, ourBalance, theirBalance *lnwire.MilliSatoshi, nextHeight uint64, remoteChain bool, isIncoming, mutateState bool) { var removeHeight *uint64 if remoteChain { removeHeight = &htlc.removeCommitHeightRemote } else { removeHeight = &htlc.removeCommitHeightLocal } ...
[ "func", "processRemoveEntry", "(", "htlc", "*", "PaymentDescriptor", ",", "ourBalance", ",", "theirBalance", "*", "lnwire", ".", "MilliSatoshi", ",", "nextHeight", "uint64", ",", "remoteChain", "bool", ",", "isIncoming", ",", "mutateState", "bool", ")", "{", "va...
// processRemoveEntry processes a log entry which settles or times out a // previously added HTLC. If the removal entry has already been processed, it // is skipped.
[ "processRemoveEntry", "processes", "a", "log", "entry", "which", "settles", "or", "times", "out", "a", "previously", "added", "HTLC", ".", "If", "the", "removal", "entry", "has", "already", "been", "processed", "it", "is", "skipped", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L2677-L2722
129,347
lightningnetwork/lnd
lnwallet/channel.go
processFeeUpdate
func processFeeUpdate(feeUpdate *PaymentDescriptor, nextHeight uint64, remoteChain bool, mutateState bool, view *htlcView) { // Fee updates are applied for all commitments after they are // sent/received, so we consider them being added and removed at the // same height. var addHeight *uint64 var removeHeight *u...
go
func processFeeUpdate(feeUpdate *PaymentDescriptor, nextHeight uint64, remoteChain bool, mutateState bool, view *htlcView) { // Fee updates are applied for all commitments after they are // sent/received, so we consider them being added and removed at the // same height. var addHeight *uint64 var removeHeight *u...
[ "func", "processFeeUpdate", "(", "feeUpdate", "*", "PaymentDescriptor", ",", "nextHeight", "uint64", ",", "remoteChain", "bool", ",", "mutateState", "bool", ",", "view", "*", "htlcView", ")", "{", "// Fee updates are applied for all commitments after they are", "// sent/r...
// processFeeUpdate processes a log update that updates the current commitment // fee.
[ "processFeeUpdate", "processes", "a", "log", "update", "that", "updates", "the", "current", "commitment", "fee", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L2726-L2754
129,348
lightningnetwork/lnd
lnwallet/channel.go
validateCommitmentSanity
func (lc *LightningChannel) validateCommitmentSanity(theirLogCounter, ourLogCounter uint64, remoteChain bool, predictAdded *PaymentDescriptor) error { // Fetch all updates not committed. view := lc.fetchHTLCView(theirLogCounter, ourLogCounter) // If we are checking if we can add a new HTLC, we add this to the /...
go
func (lc *LightningChannel) validateCommitmentSanity(theirLogCounter, ourLogCounter uint64, remoteChain bool, predictAdded *PaymentDescriptor) error { // Fetch all updates not committed. view := lc.fetchHTLCView(theirLogCounter, ourLogCounter) // If we are checking if we can add a new HTLC, we add this to the /...
[ "func", "(", "lc", "*", "LightningChannel", ")", "validateCommitmentSanity", "(", "theirLogCounter", ",", "ourLogCounter", "uint64", ",", "remoteChain", "bool", ",", "predictAdded", "*", "PaymentDescriptor", ")", "error", "{", "// Fetch all updates not committed.", "vie...
// validateCommitmentSanity is used to validate the current state of the // commitment transaction in terms of the ChannelConstraints that we and our // remote peer agreed upon during the funding workflow. The predictAdded // parameter should be set to a valid PaymentDescriptor if we are validating // in the state when...
[ "validateCommitmentSanity", "is", "used", "to", "validate", "the", "current", "state", "of", "the", "commitment", "transaction", "in", "terms", "of", "the", "ChannelConstraints", "that", "we", "and", "our", "remote", "peer", "agreed", "upon", "during", "the", "f...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L3694-L3819
129,349
lightningnetwork/lnd
lnwallet/channel.go
Error
func (i *InvalidCommitSigError) Error() string { return fmt.Sprintf("rejected commitment: commit_height=%v, "+ "invalid_commit_sig=%x, commit_tx=%x, sig_hash=%x", i.commitHeight, i.commitSig[:], i.commitTx, i.sigHash[:]) }
go
func (i *InvalidCommitSigError) Error() string { return fmt.Sprintf("rejected commitment: commit_height=%v, "+ "invalid_commit_sig=%x, commit_tx=%x, sig_hash=%x", i.commitHeight, i.commitSig[:], i.commitTx, i.sigHash[:]) }
[ "func", "(", "i", "*", "InvalidCommitSigError", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", "+", "\"", "\"", ",", "i", ".", "commitHeight", ",", "i", ".", "commitSig", "[", ":", "]", ",", "i", ".", "co...
// Error returns a detailed error string including the exact transaction that // caused an invalid commitment signature.
[ "Error", "returns", "a", "detailed", "error", "string", "including", "the", "exact", "transaction", "that", "caused", "an", "invalid", "commitment", "signature", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4003-L4007
129,350
lightningnetwork/lnd
lnwallet/channel.go
Error
func (i *InvalidHtlcSigError) Error() string { return fmt.Sprintf("rejected commitment: commit_height=%v, "+ "invalid_htlc_sig=%x, commit_tx=%x, sig_hash=%x", i.commitHeight, i.htlcSig, i.commitTx, i.sigHash[:]) }
go
func (i *InvalidHtlcSigError) Error() string { return fmt.Sprintf("rejected commitment: commit_height=%v, "+ "invalid_htlc_sig=%x, commit_tx=%x, sig_hash=%x", i.commitHeight, i.htlcSig, i.commitTx, i.sigHash[:]) }
[ "func", "(", "i", "*", "InvalidHtlcSigError", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", "+", "\"", "\"", ",", "i", ".", "commitHeight", ",", "i", ".", "htlcSig", ",", "i", ".", "commitTx", ",", "i", ...
// Error returns a detailed error string including the exact transaction that // caused an invalid htlc signature.
[ "Error", "returns", "a", "detailed", "error", "string", "including", "the", "exact", "transaction", "that", "caused", "an", "invalid", "htlc", "signature", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4032-L4036
129,351
lightningnetwork/lnd
lnwallet/channel.go
RevokeCurrentCommitment
func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, []channeldb.HTLC, error) { lc.Lock() defer lc.Unlock() revocationMsg, err := lc.generateRevocation(lc.currentHeight) if err != nil { return nil, nil, err } walletLog.Tracef("ChannelPoint(%v): revoking height=%v, now at height=%v", ...
go
func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, []channeldb.HTLC, error) { lc.Lock() defer lc.Unlock() revocationMsg, err := lc.generateRevocation(lc.currentHeight) if err != nil { return nil, nil, err } walletLog.Tracef("ChannelPoint(%v): revoking height=%v, now at height=%v", ...
[ "func", "(", "lc", "*", "LightningChannel", ")", "RevokeCurrentCommitment", "(", ")", "(", "*", "lnwire", ".", "RevokeAndAck", ",", "[", "]", "channeldb", ".", "HTLC", ",", "error", ")", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Un...
// RevokeCurrentCommitment revokes the next lowest unrevoked commitment // transaction in the local commitment chain. As a result the edge of our // revocation window is extended by one, and the tail of our local commitment // chain is advanced by a single commitment. This now lowest unrevoked // commitment becomes our...
[ "RevokeCurrentCommitment", "revokes", "the", "next", "lowest", "unrevoked", "commitment", "transaction", "in", "the", "local", "commitment", "chain", ".", "As", "a", "result", "the", "edge", "of", "our", "revocation", "window", "is", "extended", "by", "one", "an...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4236-L4272
129,352
lightningnetwork/lnd
lnwallet/channel.go
AckAddHtlcs
func (lc *LightningChannel) AckAddHtlcs(addRef channeldb.AddRef) error { return lc.channelState.AckAddHtlcs(addRef) }
go
func (lc *LightningChannel) AckAddHtlcs(addRef channeldb.AddRef) error { return lc.channelState.AckAddHtlcs(addRef) }
[ "func", "(", "lc", "*", "LightningChannel", ")", "AckAddHtlcs", "(", "addRef", "channeldb", ".", "AddRef", ")", "error", "{", "return", "lc", ".", "channelState", ".", "AckAddHtlcs", "(", "addRef", ")", "\n", "}" ]
// AckAddHtlcs sets a bit in the FwdFilter of a forwarding package belonging to // this channel, that corresponds to the given AddRef. This method also succeeds // if no forwarding package is found.
[ "AckAddHtlcs", "sets", "a", "bit", "in", "the", "FwdFilter", "of", "a", "forwarding", "package", "belonging", "to", "this", "channel", "that", "corresponds", "to", "the", "given", "AddRef", ".", "This", "method", "also", "succeeds", "if", "no", "forwarding", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4508-L4510
129,353
lightningnetwork/lnd
lnwallet/channel.go
AckSettleFails
func (lc *LightningChannel) AckSettleFails( settleFailRefs ...channeldb.SettleFailRef) error { return lc.channelState.AckSettleFails(settleFailRefs...) }
go
func (lc *LightningChannel) AckSettleFails( settleFailRefs ...channeldb.SettleFailRef) error { return lc.channelState.AckSettleFails(settleFailRefs...) }
[ "func", "(", "lc", "*", "LightningChannel", ")", "AckSettleFails", "(", "settleFailRefs", "...", "channeldb", ".", "SettleFailRef", ")", "error", "{", "return", "lc", ".", "channelState", ".", "AckSettleFails", "(", "settleFailRefs", "...", ")", "\n", "}" ]
// AckSettleFails sets a bit in the SettleFailFilter of a forwarding package // belonging to this channel, that corresponds to the given SettleFailRef. This // method also succeeds if no forwarding package is found.
[ "AckSettleFails", "sets", "a", "bit", "in", "the", "SettleFailFilter", "of", "a", "forwarding", "package", "belonging", "to", "this", "channel", "that", "corresponds", "to", "the", "given", "SettleFailRef", ".", "This", "method", "also", "succeeds", "if", "no", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4515-L4519
129,354
lightningnetwork/lnd
lnwallet/channel.go
SetFwdFilter
func (lc *LightningChannel) SetFwdFilter(height uint64, fwdFilter *channeldb.PkgFilter) error { return lc.channelState.SetFwdFilter(height, fwdFilter) }
go
func (lc *LightningChannel) SetFwdFilter(height uint64, fwdFilter *channeldb.PkgFilter) error { return lc.channelState.SetFwdFilter(height, fwdFilter) }
[ "func", "(", "lc", "*", "LightningChannel", ")", "SetFwdFilter", "(", "height", "uint64", ",", "fwdFilter", "*", "channeldb", ".", "PkgFilter", ")", "error", "{", "return", "lc", ".", "channelState", ".", "SetFwdFilter", "(", "height", ",", "fwdFilter", ")",...
// SetFwdFilter writes the forwarding decision for a given remote commitment // height.
[ "SetFwdFilter", "writes", "the", "forwarding", "decision", "for", "a", "given", "remote", "commitment", "height", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4523-L4527
129,355
lightningnetwork/lnd
lnwallet/channel.go
RemoveFwdPkg
func (lc *LightningChannel) RemoveFwdPkg(height uint64) error { return lc.channelState.RemoveFwdPkg(height) }
go
func (lc *LightningChannel) RemoveFwdPkg(height uint64) error { return lc.channelState.RemoveFwdPkg(height) }
[ "func", "(", "lc", "*", "LightningChannel", ")", "RemoveFwdPkg", "(", "height", "uint64", ")", "error", "{", "return", "lc", ".", "channelState", ".", "RemoveFwdPkg", "(", "height", ")", "\n", "}" ]
// RemoveFwdPkg permanently deletes the forwarding package at the given height.
[ "RemoveFwdPkg", "permanently", "deletes", "the", "forwarding", "package", "at", "the", "given", "height", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4530-L4532
129,356
lightningnetwork/lnd
lnwallet/channel.go
NextRevocationKey
func (lc *LightningChannel) NextRevocationKey() (*btcec.PublicKey, error) { lc.RLock() defer lc.RUnlock() nextHeight := lc.currentHeight + 1 revocation, err := lc.channelState.RevocationProducer.AtIndex(nextHeight) if err != nil { return nil, err } return input.ComputeCommitmentPoint(revocation[:]), nil }
go
func (lc *LightningChannel) NextRevocationKey() (*btcec.PublicKey, error) { lc.RLock() defer lc.RUnlock() nextHeight := lc.currentHeight + 1 revocation, err := lc.channelState.RevocationProducer.AtIndex(nextHeight) if err != nil { return nil, err } return input.ComputeCommitmentPoint(revocation[:]), nil }
[ "func", "(", "lc", "*", "LightningChannel", ")", "NextRevocationKey", "(", ")", "(", "*", "btcec", ".", "PublicKey", ",", "error", ")", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "nextHeight", ":=", "lc"...
// NextRevocationKey returns the commitment point for the _next_ commitment // height. The pubkey returned by this function is required by the remote party // along with their revocation base to extend our commitment chain with a // new commitment.
[ "NextRevocationKey", "returns", "the", "commitment", "point", "for", "the", "_next_", "commitment", "height", ".", "The", "pubkey", "returned", "by", "this", "function", "is", "required", "by", "the", "remote", "party", "along", "with", "their", "revocation", "b...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4538-L4549
129,357
lightningnetwork/lnd
lnwallet/channel.go
InitNextRevocation
func (lc *LightningChannel) InitNextRevocation(revKey *btcec.PublicKey) error { lc.Lock() defer lc.Unlock() return lc.channelState.InsertNextRevocation(revKey) }
go
func (lc *LightningChannel) InitNextRevocation(revKey *btcec.PublicKey) error { lc.Lock() defer lc.Unlock() return lc.channelState.InsertNextRevocation(revKey) }
[ "func", "(", "lc", "*", "LightningChannel", ")", "InitNextRevocation", "(", "revKey", "*", "btcec", ".", "PublicKey", ")", "error", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Unlock", "(", ")", "\n\n", "return", "lc", ".", "channelSta...
// InitNextRevocation inserts the passed commitment point as the _next_ // revocation to be used when creating a new commitment state for the remote // party. This function MUST be called before the channel can accept or propose // any new states.
[ "InitNextRevocation", "inserts", "the", "passed", "commitment", "point", "as", "the", "_next_", "revocation", "to", "be", "used", "when", "creating", "a", "new", "commitment", "state", "for", "the", "remote", "party", ".", "This", "function", "MUST", "be", "ca...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4555-L4560
129,358
lightningnetwork/lnd
lnwallet/channel.go
ReceiveHTLC
func (lc *LightningChannel) ReceiveHTLC(htlc *lnwire.UpdateAddHTLC) (uint64, error) { lc.Lock() defer lc.Unlock() if htlc.ID != lc.remoteUpdateLog.htlcCounter { return 0, fmt.Errorf("ID %d on HTLC add does not match expected next "+ "ID %d", htlc.ID, lc.remoteUpdateLog.htlcCounter) } pd := &PaymentDescripto...
go
func (lc *LightningChannel) ReceiveHTLC(htlc *lnwire.UpdateAddHTLC) (uint64, error) { lc.Lock() defer lc.Unlock() if htlc.ID != lc.remoteUpdateLog.htlcCounter { return 0, fmt.Errorf("ID %d on HTLC add does not match expected next "+ "ID %d", htlc.ID, lc.remoteUpdateLog.htlcCounter) } pd := &PaymentDescripto...
[ "func", "(", "lc", "*", "LightningChannel", ")", "ReceiveHTLC", "(", "htlc", "*", "lnwire", ".", "UpdateAddHTLC", ")", "(", "uint64", ",", "error", ")", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Unlock", "(", ")", "\n\n", "if", "...
// ReceiveHTLC adds an HTLC to the state machine's remote update log. This // method should be called in response to receiving a new HTLC from the remote // party.
[ "ReceiveHTLC", "adds", "an", "HTLC", "to", "the", "state", "machine", "s", "remote", "update", "log", ".", "This", "method", "should", "be", "called", "in", "response", "to", "receiving", "a", "new", "HTLC", "from", "the", "remote", "party", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4604-L4626
129,359
lightningnetwork/lnd
lnwallet/channel.go
ReceiveHTLCSettle
func (lc *LightningChannel) ReceiveHTLCSettle(preimage [32]byte, htlcIndex uint64) error { lc.Lock() defer lc.Unlock() htlc := lc.localUpdateLog.lookupHtlc(htlcIndex) if htlc == nil { return ErrUnknownHtlcIndex{lc.ShortChanID(), htlcIndex} } // Now that we know the HTLC exists, before checking to see if the ...
go
func (lc *LightningChannel) ReceiveHTLCSettle(preimage [32]byte, htlcIndex uint64) error { lc.Lock() defer lc.Unlock() htlc := lc.localUpdateLog.lookupHtlc(htlcIndex) if htlc == nil { return ErrUnknownHtlcIndex{lc.ShortChanID(), htlcIndex} } // Now that we know the HTLC exists, before checking to see if the ...
[ "func", "(", "lc", "*", "LightningChannel", ")", "ReceiveHTLCSettle", "(", "preimage", "[", "32", "]", "byte", ",", "htlcIndex", "uint64", ")", "error", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Unlock", "(", ")", "\n\n", "htlc", "...
// ReceiveHTLCSettle attempts to settle an existing outgoing HTLC indexed by an // index into the local log. If the specified index doesn't exist within the // log, and error is returned. Similarly if the preimage is invalid w.r.t to // the referenced of then a distinct error is returned.
[ "ReceiveHTLCSettle", "attempts", "to", "settle", "an", "existing", "outgoing", "HTLC", "indexed", "by", "an", "index", "into", "the", "local", "log", ".", "If", "the", "specified", "index", "doesn", "t", "exist", "within", "the", "log", "and", "error", "is",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4699-L4736
129,360
lightningnetwork/lnd
lnwallet/channel.go
ReceiveFailHTLC
func (lc *LightningChannel) ReceiveFailHTLC(htlcIndex uint64, reason []byte, ) error { lc.Lock() defer lc.Unlock() htlc := lc.localUpdateLog.lookupHtlc(htlcIndex) if htlc == nil { return ErrUnknownHtlcIndex{lc.ShortChanID(), htlcIndex} } // Now that we know the HTLC exists, we'll ensure that they haven't //...
go
func (lc *LightningChannel) ReceiveFailHTLC(htlcIndex uint64, reason []byte, ) error { lc.Lock() defer lc.Unlock() htlc := lc.localUpdateLog.lookupHtlc(htlcIndex) if htlc == nil { return ErrUnknownHtlcIndex{lc.ShortChanID(), htlcIndex} } // Now that we know the HTLC exists, we'll ensure that they haven't //...
[ "func", "(", "lc", "*", "LightningChannel", ")", "ReceiveFailHTLC", "(", "htlcIndex", "uint64", ",", "reason", "[", "]", "byte", ",", ")", "error", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Unlock", "(", ")", "\n\n", "htlc", ":=", ...
// ReceiveFailHTLC attempts to cancel a targeted HTLC by its log index, // inserting an entry which will remove the target log entry within the next // commitment update. This method should be called in response to the upstream // party cancelling an outgoing HTLC. The value of the failed HTLC is returned // along with...
[ "ReceiveFailHTLC", "attempts", "to", "cancel", "a", "targeted", "HTLC", "by", "its", "log", "index", "inserting", "an", "entry", "which", "will", "remove", "the", "target", "log", "entry", "within", "the", "next", "commitment", "update", ".", "This", "method",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4855-L4889
129,361
lightningnetwork/lnd
lnwallet/channel.go
genHtlcScript
func genHtlcScript(isIncoming, ourCommit bool, timeout uint32, rHash [32]byte, keyRing *CommitmentKeyRing) ([]byte, []byte, error) { var ( witnessScript []byte err error ) // Generate the proper redeem scripts for the HTLC output modified by // two-bits denoting if this is an incoming HTLC, and if ...
go
func genHtlcScript(isIncoming, ourCommit bool, timeout uint32, rHash [32]byte, keyRing *CommitmentKeyRing) ([]byte, []byte, error) { var ( witnessScript []byte err error ) // Generate the proper redeem scripts for the HTLC output modified by // two-bits denoting if this is an incoming HTLC, and if ...
[ "func", "genHtlcScript", "(", "isIncoming", ",", "ourCommit", "bool", ",", "timeout", "uint32", ",", "rHash", "[", "32", "]", "byte", ",", "keyRing", "*", "CommitmentKeyRing", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", ...
// genHtlcScript generates the proper P2WSH public key scripts for the HTLC // output modified by two-bits denoting if this is an incoming HTLC, and if the // HTLC is being applied to their commitment transaction or ours.
[ "genHtlcScript", "generates", "the", "proper", "P2WSH", "public", "key", "scripts", "for", "the", "HTLC", "output", "modified", "by", "two", "-", "bits", "denoting", "if", "this", "is", "an", "incoming", "HTLC", "and", "if", "the", "HTLC", "is", "being", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4908-L4961
129,362
lightningnetwork/lnd
lnwallet/channel.go
addHTLC
func (lc *LightningChannel) addHTLC(commitTx *wire.MsgTx, ourCommit bool, isIncoming bool, paymentDesc *PaymentDescriptor, keyRing *CommitmentKeyRing) error { timeout := paymentDesc.Timeout rHash := paymentDesc.RHash p2wsh, witnessScript, err := genHtlcScript(isIncoming, ourCommit, timeout, rHash, keyRing) if...
go
func (lc *LightningChannel) addHTLC(commitTx *wire.MsgTx, ourCommit bool, isIncoming bool, paymentDesc *PaymentDescriptor, keyRing *CommitmentKeyRing) error { timeout := paymentDesc.Timeout rHash := paymentDesc.RHash p2wsh, witnessScript, err := genHtlcScript(isIncoming, ourCommit, timeout, rHash, keyRing) if...
[ "func", "(", "lc", "*", "LightningChannel", ")", "addHTLC", "(", "commitTx", "*", "wire", ".", "MsgTx", ",", "ourCommit", "bool", ",", "isIncoming", "bool", ",", "paymentDesc", "*", "PaymentDescriptor", ",", "keyRing", "*", "CommitmentKeyRing", ")", "error", ...
// addHTLC adds a new HTLC to the passed commitment transaction. One of four // full scripts will be generated for the HTLC output depending on if the HTLC // is incoming and if it's being applied to our commitment transaction or that // of the remote node's. Additionally, in order to be able to efficiently // locate t...
[ "addHTLC", "adds", "a", "new", "HTLC", "to", "the", "passed", "commitment", "transaction", ".", "One", "of", "four", "full", "scripts", "will", "be", "generated", "for", "the", "HTLC", "output", "depending", "on", "if", "the", "HTLC", "is", "incoming", "an...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L4970-L4998
129,363
lightningnetwork/lnd
lnwallet/channel.go
getSignedCommitTx
func (lc *LightningChannel) getSignedCommitTx() (*wire.MsgTx, error) { // Fetch the current commitment transaction, along with their signature // for the transaction. localCommit := lc.channelState.LocalCommitment commitTx := localCommit.CommitTx theirSig := append(localCommit.CommitSig, byte(txscript.SigHashAll))...
go
func (lc *LightningChannel) getSignedCommitTx() (*wire.MsgTx, error) { // Fetch the current commitment transaction, along with their signature // for the transaction. localCommit := lc.channelState.LocalCommitment commitTx := localCommit.CommitTx theirSig := append(localCommit.CommitSig, byte(txscript.SigHashAll))...
[ "func", "(", "lc", "*", "LightningChannel", ")", "getSignedCommitTx", "(", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "// Fetch the current commitment transaction, along with their signature", "// for the transaction.", "localCommit", ":=", "lc", ".", ...
// getSignedCommitTx function take the latest commitment transaction and // populate it with witness data.
[ "getSignedCommitTx", "function", "take", "the", "latest", "commitment", "transaction", "and", "populate", "it", "with", "witness", "data", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L5002-L5030
129,364
lightningnetwork/lnd
lnwallet/channel.go
NewLocalForceCloseSummary
func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel, signer input.Signer, pCache PreimageCache, commitTx *wire.MsgTx, localCommit channeldb.ChannelCommitment) (*LocalForceCloseSummary, error) { // Re-derive the original pkScript for to-self output within the // commitment transaction. We'll need this t...
go
func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel, signer input.Signer, pCache PreimageCache, commitTx *wire.MsgTx, localCommit channeldb.ChannelCommitment) (*LocalForceCloseSummary, error) { // Re-derive the original pkScript for to-self output within the // commitment transaction. We'll need this t...
[ "func", "NewLocalForceCloseSummary", "(", "chanState", "*", "channeldb", ".", "OpenChannel", ",", "signer", "input", ".", "Signer", ",", "pCache", "PreimageCache", ",", "commitTx", "*", "wire", ".", "MsgTx", ",", "localCommit", "channeldb", ".", "ChannelCommitment...
// NewLocalForceCloseSummary generates a LocalForceCloseSummary from the given // channel state. The passed commitTx must be a fully signed commitment // transaction corresponding to localCommit.
[ "NewLocalForceCloseSummary", "generates", "a", "LocalForceCloseSummary", "from", "the", "given", "channel", "state", ".", "The", "passed", "commitTx", "must", "be", "a", "fully", "signed", "commitment", "transaction", "corresponding", "to", "localCommit", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L5750-L5845
129,365
lightningnetwork/lnd
lnwallet/channel.go
AvailableBalance
func (lc *LightningChannel) AvailableBalance() lnwire.MilliSatoshi { lc.RLock() defer lc.RUnlock() bal, _ := lc.availableBalance() return bal }
go
func (lc *LightningChannel) AvailableBalance() lnwire.MilliSatoshi { lc.RLock() defer lc.RUnlock() bal, _ := lc.availableBalance() return bal }
[ "func", "(", "lc", "*", "LightningChannel", ")", "AvailableBalance", "(", ")", "lnwire", ".", "MilliSatoshi", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "bal", ",", "_", ":=", "lc", ".", "availableBalance"...
// AvailableBalance returns the current available balance within the channel. // By available balance, we mean that if at this very instance s new commitment // were to be created which evals all the log entries, what would our available // balance me. This method is useful when deciding if a given channel can // accep...
[ "AvailableBalance", "returns", "the", "current", "available", "balance", "within", "the", "channel", ".", "By", "available", "balance", "we", "mean", "that", "if", "at", "this", "very", "instance", "s", "new", "commitment", "were", "to", "be", "created", "whic...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6003-L6009
129,366
lightningnetwork/lnd
lnwallet/channel.go
availableBalance
func (lc *LightningChannel) availableBalance() (lnwire.MilliSatoshi, int64) { // We'll grab the current set of log updates that the remote has // ACKed. remoteACKedIndex := lc.localCommitChain.tip().theirMessageIndex htlcView := lc.fetchHTLCView(remoteACKedIndex, lc.localUpdateLog.logIndex) // Then compute our ...
go
func (lc *LightningChannel) availableBalance() (lnwire.MilliSatoshi, int64) { // We'll grab the current set of log updates that the remote has // ACKed. remoteACKedIndex := lc.localCommitChain.tip().theirMessageIndex htlcView := lc.fetchHTLCView(remoteACKedIndex, lc.localUpdateLog.logIndex) // Then compute our ...
[ "func", "(", "lc", "*", "LightningChannel", ")", "availableBalance", "(", ")", "(", "lnwire", ".", "MilliSatoshi", ",", "int64", ")", "{", "// We'll grab the current set of log updates that the remote has", "// ACKed.", "remoteACKedIndex", ":=", "lc", ".", "localCommitC...
// availableBalance is the private, non mutexed version of AvailableBalance. // This method is provided so methods that already hold the lock can access // this method. Additionally, the total weight of the next to be created // commitment is returned for accounting purposes.
[ "availableBalance", "is", "the", "private", "non", "mutexed", "version", "of", "AvailableBalance", ".", "This", "method", "is", "provided", "so", "methods", "that", "already", "hold", "the", "lock", "can", "access", "this", "method", ".", "Additionally", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6015-L6034
129,367
lightningnetwork/lnd
lnwallet/channel.go
StateSnapshot
func (lc *LightningChannel) StateSnapshot() *channeldb.ChannelSnapshot { lc.RLock() defer lc.RUnlock() return lc.channelState.Snapshot() }
go
func (lc *LightningChannel) StateSnapshot() *channeldb.ChannelSnapshot { lc.RLock() defer lc.RUnlock() return lc.channelState.Snapshot() }
[ "func", "(", "lc", "*", "LightningChannel", ")", "StateSnapshot", "(", ")", "*", "channeldb", ".", "ChannelSnapshot", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "return", "lc", ".", "channelState", ".", "S...
// StateSnapshot returns a snapshot of the current fully committed state within // the channel.
[ "StateSnapshot", "returns", "a", "snapshot", "of", "the", "current", "fully", "committed", "state", "within", "the", "channel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6038-L6043
129,368
lightningnetwork/lnd
lnwallet/channel.go
UpdateFee
func (lc *LightningChannel) UpdateFee(feePerKw SatPerKWeight) error { lc.Lock() defer lc.Unlock() // Only initiator can send fee update, so trying to send one as // non-initiator will fail. if !lc.channelState.IsInitiator { return fmt.Errorf("local fee update as non-initiator") } // Ensure that the passed fe...
go
func (lc *LightningChannel) UpdateFee(feePerKw SatPerKWeight) error { lc.Lock() defer lc.Unlock() // Only initiator can send fee update, so trying to send one as // non-initiator will fail. if !lc.channelState.IsInitiator { return fmt.Errorf("local fee update as non-initiator") } // Ensure that the passed fe...
[ "func", "(", "lc", "*", "LightningChannel", ")", "UpdateFee", "(", "feePerKw", "SatPerKWeight", ")", "error", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Unlock", "(", ")", "\n\n", "// Only initiator can send fee update, so trying to send one as",...
// UpdateFee initiates a fee update for this channel. Must only be called by // the channel initiator, and must be called before sending update_fee to // the remote.
[ "UpdateFee", "initiates", "a", "fee", "update", "for", "this", "channel", ".", "Must", "only", "be", "called", "by", "the", "channel", "initiator", "and", "must", "be", "called", "before", "sending", "update_fee", "to", "the", "remote", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6096-L6120
129,369
lightningnetwork/lnd
lnwallet/channel.go
ReceiveUpdateFee
func (lc *LightningChannel) ReceiveUpdateFee(feePerKw SatPerKWeight) error { lc.Lock() defer lc.Unlock() // Only initiator can send fee update, and we must fail if we receive // fee update as initiator if lc.channelState.IsInitiator { return fmt.Errorf("received fee update as initiator") } // TODO(roasbeef):...
go
func (lc *LightningChannel) ReceiveUpdateFee(feePerKw SatPerKWeight) error { lc.Lock() defer lc.Unlock() // Only initiator can send fee update, and we must fail if we receive // fee update as initiator if lc.channelState.IsInitiator { return fmt.Errorf("received fee update as initiator") } // TODO(roasbeef):...
[ "func", "(", "lc", "*", "LightningChannel", ")", "ReceiveUpdateFee", "(", "feePerKw", "SatPerKWeight", ")", "error", "{", "lc", ".", "Lock", "(", ")", "\n", "defer", "lc", ".", "Unlock", "(", ")", "\n\n", "// Only initiator can send fee update, and we must fail if...
// ReceiveUpdateFee handles an updated fee sent from remote. This method will // return an error if called as channel initiator.
[ "ReceiveUpdateFee", "handles", "an", "updated", "fee", "sent", "from", "remote", ".", "This", "method", "will", "return", "an", "error", "if", "called", "as", "channel", "initiator", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6124-L6144
129,370
lightningnetwork/lnd
lnwallet/channel.go
generateRevocation
func (lc *LightningChannel) generateRevocation(height uint64) (*lnwire.RevokeAndAck, error) { // Now that we've accept a new state transition, we send the remote // party the revocation for our current commitment state. revocationMsg := &lnwire.RevokeAndAck{} commitSecret, err := lc.channelState.RevocationProduce...
go
func (lc *LightningChannel) generateRevocation(height uint64) (*lnwire.RevokeAndAck, error) { // Now that we've accept a new state transition, we send the remote // party the revocation for our current commitment state. revocationMsg := &lnwire.RevokeAndAck{} commitSecret, err := lc.channelState.RevocationProduce...
[ "func", "(", "lc", "*", "LightningChannel", ")", "generateRevocation", "(", "height", "uint64", ")", "(", "*", "lnwire", ".", "RevokeAndAck", ",", "error", ")", "{", "// Now that we've accept a new state transition, we send the remote", "// party the revocation for our curr...
// generateRevocation generates the revocation message for a given height.
[ "generateRevocation", "generates", "the", "revocation", "message", "for", "a", "given", "height", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6147-L6184
129,371
lightningnetwork/lnd
lnwallet/channel.go
CreateCooperativeCloseTx
func CreateCooperativeCloseTx(fundingTxIn wire.TxIn, localDust, remoteDust, ourBalance, theirBalance btcutil.Amount, ourDeliveryScript, theirDeliveryScript []byte, initiator bool) *wire.MsgTx { // Construct the transaction to perform a cooperative closure of the // channel. In the event that one side doesn't have...
go
func CreateCooperativeCloseTx(fundingTxIn wire.TxIn, localDust, remoteDust, ourBalance, theirBalance btcutil.Amount, ourDeliveryScript, theirDeliveryScript []byte, initiator bool) *wire.MsgTx { // Construct the transaction to perform a cooperative closure of the // channel. In the event that one side doesn't have...
[ "func", "CreateCooperativeCloseTx", "(", "fundingTxIn", "wire", ".", "TxIn", ",", "localDust", ",", "remoteDust", ",", "ourBalance", ",", "theirBalance", "btcutil", ".", "Amount", ",", "ourDeliveryScript", ",", "theirDeliveryScript", "[", "]", "byte", ",", "initia...
// CreateCooperativeCloseTx creates a transaction which if signed by both // parties, then broadcast cooperatively closes an active channel. The creation // of the closure transaction is modified by a boolean indicating if the party // constructing the channel is the initiator of the closure. Currently it is // expecte...
[ "CreateCooperativeCloseTx", "creates", "a", "transaction", "which", "if", "signed", "by", "both", "parties", "then", "broadcast", "cooperatively", "closes", "an", "active", "channel", ".", "The", "creation", "of", "the", "closure", "transaction", "is", "modified", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6246-L6276
129,372
lightningnetwork/lnd
lnwallet/channel.go
RemoteNextRevocation
func (lc *LightningChannel) RemoteNextRevocation() *btcec.PublicKey { lc.RLock() defer lc.RUnlock() return lc.channelState.RemoteNextRevocation }
go
func (lc *LightningChannel) RemoteNextRevocation() *btcec.PublicKey { lc.RLock() defer lc.RUnlock() return lc.channelState.RemoteNextRevocation }
[ "func", "(", "lc", "*", "LightningChannel", ")", "RemoteNextRevocation", "(", ")", "*", "btcec", ".", "PublicKey", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "return", "lc", ".", "channelState", ".", "Remo...
// RemoteNextRevocation returns the channelState's RemoteNextRevocation.
[ "RemoteNextRevocation", "returns", "the", "channelState", "s", "RemoteNextRevocation", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6285-L6290
129,373
lightningnetwork/lnd
lnwallet/channel.go
IsInitiator
func (lc *LightningChannel) IsInitiator() bool { lc.RLock() defer lc.RUnlock() return lc.channelState.IsInitiator }
go
func (lc *LightningChannel) IsInitiator() bool { lc.RLock() defer lc.RUnlock() return lc.channelState.IsInitiator }
[ "func", "(", "lc", "*", "LightningChannel", ")", "IsInitiator", "(", ")", "bool", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "return", "lc", ".", "channelState", ".", "IsInitiator", "\n", "}" ]
// IsInitiator returns true if we were the ones that initiated the funding // workflow which led to the creation of this channel. Otherwise, it returns // false.
[ "IsInitiator", "returns", "true", "if", "we", "were", "the", "ones", "that", "initiated", "the", "funding", "workflow", "which", "led", "to", "the", "creation", "of", "this", "channel", ".", "Otherwise", "it", "returns", "false", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6295-L6300
129,374
lightningnetwork/lnd
lnwallet/channel.go
CommitFeeRate
func (lc *LightningChannel) CommitFeeRate() SatPerKWeight { lc.RLock() defer lc.RUnlock() return SatPerKWeight(lc.channelState.LocalCommitment.FeePerKw) }
go
func (lc *LightningChannel) CommitFeeRate() SatPerKWeight { lc.RLock() defer lc.RUnlock() return SatPerKWeight(lc.channelState.LocalCommitment.FeePerKw) }
[ "func", "(", "lc", "*", "LightningChannel", ")", "CommitFeeRate", "(", ")", "SatPerKWeight", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "return", "SatPerKWeight", "(", "lc", ".", "channelState", ".", "LocalC...
// CommitFeeRate returns the current fee rate of the commitment transaction in // units of sat-per-kw.
[ "CommitFeeRate", "returns", "the", "current", "fee", "rate", "of", "the", "commitment", "transaction", "in", "units", "of", "sat", "-", "per", "-", "kw", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6304-L6309
129,375
lightningnetwork/lnd
lnwallet/channel.go
IsPending
func (lc *LightningChannel) IsPending() bool { lc.RLock() defer lc.RUnlock() return lc.channelState.IsPending }
go
func (lc *LightningChannel) IsPending() bool { lc.RLock() defer lc.RUnlock() return lc.channelState.IsPending }
[ "func", "(", "lc", "*", "LightningChannel", ")", "IsPending", "(", ")", "bool", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "return", "lc", ".", "channelState", ".", "IsPending", "\n", "}" ]
// IsPending returns true if the channel's funding transaction has been fully // confirmed, and false otherwise.
[ "IsPending", "returns", "true", "if", "the", "channel", "s", "funding", "transaction", "has", "been", "fully", "confirmed", "and", "false", "otherwise", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6313-L6318
129,376
lightningnetwork/lnd
lnwallet/channel.go
RemoteCommitHeight
func (lc *LightningChannel) RemoteCommitHeight() uint64 { lc.RLock() defer lc.RUnlock() return lc.channelState.RemoteCommitment.CommitHeight }
go
func (lc *LightningChannel) RemoteCommitHeight() uint64 { lc.RLock() defer lc.RUnlock() return lc.channelState.RemoteCommitment.CommitHeight }
[ "func", "(", "lc", "*", "LightningChannel", ")", "RemoteCommitHeight", "(", ")", "uint64", "{", "lc", ".", "RLock", "(", ")", "\n", "defer", "lc", ".", "RUnlock", "(", ")", "\n\n", "return", "lc", ".", "channelState", ".", "RemoteCommitment", ".", "Commi...
// RemoteCommitHeight returns the commitment height of the remote chain.
[ "RemoteCommitHeight", "returns", "the", "commitment", "height", "of", "the", "remote", "chain", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/channel.go#L6381-L6386
129,377
lightningnetwork/lnd
watchtower/wtwire/create_session_reply.go
Decode
func (m *CreateSessionReply) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &m.Code, &m.LastApplied, &m.Data, ) }
go
func (m *CreateSessionReply) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &m.Code, &m.LastApplied, &m.Data, ) }
[ "func", "(", "m", "*", "CreateSessionReply", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "m", ".", "Code", ",", "&", "m", ".", "LastApplied", ",", "&", "m", ...
// Decode deserializes a serialized CreateSessionReply message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "CreateSessionReply", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interfa...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/create_session_reply.go#L69-L75
129,378
lightningnetwork/lnd
watchtower/wtwire/create_session_reply.go
Encode
func (m *CreateSessionReply) Encode(w io.Writer, pver uint32) error { return WriteElements(w, m.Code, m.LastApplied, m.Data, ) }
go
func (m *CreateSessionReply) Encode(w io.Writer, pver uint32) error { return WriteElements(w, m.Code, m.LastApplied, m.Data, ) }
[ "func", "(", "m", "*", "CreateSessionReply", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "m", ".", "Code", ",", "m", ".", "LastApplied", ",", "m", ".", "Data", ",...
// Encode serializes the target CreateSessionReply into the passed io.Writer // observing the protocol version specified. // // This is part of the wtwire.Message interface.
[ "Encode", "serializes", "the", "target", "CreateSessionReply", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/create_session_reply.go#L81-L87
129,379
lightningnetwork/lnd
channeldb/reject_cache.go
packRejectFlags
func packRejectFlags(exists, isZombie bool) rejectFlags { var flags rejectFlags if exists { flags |= rejectFlagExists } if isZombie { flags |= rejectFlagZombie } return flags }
go
func packRejectFlags(exists, isZombie bool) rejectFlags { var flags rejectFlags if exists { flags |= rejectFlagExists } if isZombie { flags |= rejectFlagZombie } return flags }
[ "func", "packRejectFlags", "(", "exists", ",", "isZombie", "bool", ")", "rejectFlags", "{", "var", "flags", "rejectFlags", "\n", "if", "exists", "{", "flags", "|=", "rejectFlagExists", "\n", "}", "\n", "if", "isZombie", "{", "flags", "|=", "rejectFlagZombie", ...
// packRejectFlags computes the rejectFlags corresponding to the passed boolean // values indicating whether the edge exists or is a zombie.
[ "packRejectFlags", "computes", "the", "rejectFlags", "corresponding", "to", "the", "passed", "boolean", "values", "indicating", "whether", "the", "edge", "exists", "or", "is", "a", "zombie", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/reject_cache.go#L20-L30
129,380
lightningnetwork/lnd
channeldb/reject_cache.go
unpack
func (f rejectFlags) unpack() (bool, bool) { return f&rejectFlagExists == rejectFlagExists, f&rejectFlagZombie == rejectFlagZombie }
go
func (f rejectFlags) unpack() (bool, bool) { return f&rejectFlagExists == rejectFlagExists, f&rejectFlagZombie == rejectFlagZombie }
[ "func", "(", "f", "rejectFlags", ")", "unpack", "(", ")", "(", "bool", ",", "bool", ")", "{", "return", "f", "&", "rejectFlagExists", "==", "rejectFlagExists", ",", "f", "&", "rejectFlagZombie", "==", "rejectFlagZombie", "\n", "}" ]
// unpack returns the booleans packed into the rejectFlags. The first indicates // if the edge exists in our graph, the second indicates if the edge is a // zombie.
[ "unpack", "returns", "the", "booleans", "packed", "into", "the", "rejectFlags", ".", "The", "first", "indicates", "if", "the", "edge", "exists", "in", "our", "graph", "the", "second", "indicates", "if", "the", "edge", "is", "a", "zombie", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/reject_cache.go#L35-L38
129,381
lightningnetwork/lnd
channeldb/reject_cache.go
newRejectCache
func newRejectCache(n int) *rejectCache { return &rejectCache{ n: n, edges: make(map[uint64]rejectCacheEntry, n), } }
go
func newRejectCache(n int) *rejectCache { return &rejectCache{ n: n, edges: make(map[uint64]rejectCacheEntry, n), } }
[ "func", "newRejectCache", "(", "n", "int", ")", "*", "rejectCache", "{", "return", "&", "rejectCache", "{", "n", ":", "n", ",", "edges", ":", "make", "(", "map", "[", "uint64", "]", "rejectCacheEntry", ",", "n", ")", ",", "}", "\n", "}" ]
// newRejectCache creates a new rejectCache with maximum capacity of n entries.
[ "newRejectCache", "creates", "a", "new", "rejectCache", "with", "maximum", "capacity", "of", "n", "entries", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/reject_cache.go#L58-L63
129,382
lightningnetwork/lnd
channeldb/reject_cache.go
get
func (c *rejectCache) get(chanid uint64) (rejectCacheEntry, bool) { entry, ok := c.edges[chanid] return entry, ok }
go
func (c *rejectCache) get(chanid uint64) (rejectCacheEntry, bool) { entry, ok := c.edges[chanid] return entry, ok }
[ "func", "(", "c", "*", "rejectCache", ")", "get", "(", "chanid", "uint64", ")", "(", "rejectCacheEntry", ",", "bool", ")", "{", "entry", ",", "ok", ":=", "c", ".", "edges", "[", "chanid", "]", "\n", "return", "entry", ",", "ok", "\n", "}" ]
// get returns the entry from the cache for chanid, if it exists.
[ "get", "returns", "the", "entry", "from", "the", "cache", "for", "chanid", "if", "it", "exists", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/reject_cache.go#L66-L69
129,383
lightningnetwork/lnd
channeldb/reject_cache.go
insert
func (c *rejectCache) insert(chanid uint64, entry rejectCacheEntry) { // If entry exists, replace it. if _, ok := c.edges[chanid]; ok { c.edges[chanid] = entry return } // Otherwise, evict an entry at random and insert. if len(c.edges) == c.n { for id := range c.edges { delete(c.edges, id) break } ...
go
func (c *rejectCache) insert(chanid uint64, entry rejectCacheEntry) { // If entry exists, replace it. if _, ok := c.edges[chanid]; ok { c.edges[chanid] = entry return } // Otherwise, evict an entry at random and insert. if len(c.edges) == c.n { for id := range c.edges { delete(c.edges, id) break } ...
[ "func", "(", "c", "*", "rejectCache", ")", "insert", "(", "chanid", "uint64", ",", "entry", "rejectCacheEntry", ")", "{", "// If entry exists, replace it.", "if", "_", ",", "ok", ":=", "c", ".", "edges", "[", "chanid", "]", ";", "ok", "{", "c", ".", "e...
// insert adds the entry to the reject cache. If an entry for chanid already // exists, it will be replaced with the new entry. If the entry doesn't exists, // it will be inserted to the cache, performing a random eviction if the cache // is at capacity.
[ "insert", "adds", "the", "entry", "to", "the", "reject", "cache", ".", "If", "an", "entry", "for", "chanid", "already", "exists", "it", "will", "be", "replaced", "with", "the", "new", "entry", ".", "If", "the", "entry", "doesn", "t", "exists", "it", "w...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/reject_cache.go#L75-L90
129,384
lightningnetwork/lnd
chainntnfs/txnotifier.go
NewConfRequest
func NewConfRequest(txid *chainhash.Hash, pkScript []byte) (ConfRequest, error) { var r ConfRequest outputScript, err := txscript.ParsePkScript(pkScript) if err != nil { return r, err } // We'll only set a txid for which we'll dispatch a confirmation // notification on this request if one was provided. Otherwi...
go
func NewConfRequest(txid *chainhash.Hash, pkScript []byte) (ConfRequest, error) { var r ConfRequest outputScript, err := txscript.ParsePkScript(pkScript) if err != nil { return r, err } // We'll only set a txid for which we'll dispatch a confirmation // notification on this request if one was provided. Otherwi...
[ "func", "NewConfRequest", "(", "txid", "*", "chainhash", ".", "Hash", ",", "pkScript", "[", "]", "byte", ")", "(", "ConfRequest", ",", "error", ")", "{", "var", "r", "ConfRequest", "\n", "outputScript", ",", "err", ":=", "txscript", ".", "ParsePkScript", ...
// NewConfRequest creates a request for a confirmation notification of either a // txid or output script. A nil txid or an allocated ZeroHash can be used to // dispatch the confirmation notification on the script.
[ "NewConfRequest", "creates", "a", "request", "for", "a", "confirmation", "notification", "of", "either", "a", "txid", "or", "output", "script", ".", "A", "nil", "txid", "or", "an", "allocated", "ZeroHash", "can", "be", "used", "to", "dispatch", "the", "confi...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L149-L165
129,385
lightningnetwork/lnd
chainntnfs/txnotifier.go
String
func (r ConfRequest) String() string { if r.TxID != ZeroHash { return fmt.Sprintf("txid=%v", r.TxID) } return fmt.Sprintf("script=%v", r.PkScript) }
go
func (r ConfRequest) String() string { if r.TxID != ZeroHash { return fmt.Sprintf("txid=%v", r.TxID) } return fmt.Sprintf("script=%v", r.PkScript) }
[ "func", "(", "r", "ConfRequest", ")", "String", "(", ")", "string", "{", "if", "r", ".", "TxID", "!=", "ZeroHash", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "TxID", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf"...
// String returns the string representation of the ConfRequest.
[ "String", "returns", "the", "string", "representation", "of", "the", "ConfRequest", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L168-L173
129,386
lightningnetwork/lnd
chainntnfs/txnotifier.go
ConfHintKey
func (r ConfRequest) ConfHintKey() ([]byte, error) { if r.TxID == ZeroHash { return r.PkScript.Script(), nil } var txid bytes.Buffer if err := channeldb.WriteElement(&txid, r.TxID); err != nil { return nil, err } return txid.Bytes(), nil }
go
func (r ConfRequest) ConfHintKey() ([]byte, error) { if r.TxID == ZeroHash { return r.PkScript.Script(), nil } var txid bytes.Buffer if err := channeldb.WriteElement(&txid, r.TxID); err != nil { return nil, err } return txid.Bytes(), nil }
[ "func", "(", "r", "ConfRequest", ")", "ConfHintKey", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "r", ".", "TxID", "==", "ZeroHash", "{", "return", "r", ".", "PkScript", ".", "Script", "(", ")", ",", "nil", "\n", "}", "\n\n", ...
// ConfHintKey returns the key that will be used to index the confirmation // request's hint within the height hint cache.
[ "ConfHintKey", "returns", "the", "key", "that", "will", "be", "used", "to", "index", "the", "confirmation", "request", "s", "hint", "within", "the", "height", "hint", "cache", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L177-L188
129,387
lightningnetwork/lnd
chainntnfs/txnotifier.go
MatchesTx
func (r ConfRequest) MatchesTx(tx *wire.MsgTx) bool { if r.TxID != ZeroHash { return r.TxID == tx.TxHash() } pkScript := r.PkScript.Script() for _, txOut := range tx.TxOut { if bytes.Equal(txOut.PkScript, pkScript) { return true } } return false }
go
func (r ConfRequest) MatchesTx(tx *wire.MsgTx) bool { if r.TxID != ZeroHash { return r.TxID == tx.TxHash() } pkScript := r.PkScript.Script() for _, txOut := range tx.TxOut { if bytes.Equal(txOut.PkScript, pkScript) { return true } } return false }
[ "func", "(", "r", "ConfRequest", ")", "MatchesTx", "(", "tx", "*", "wire", ".", "MsgTx", ")", "bool", "{", "if", "r", ".", "TxID", "!=", "ZeroHash", "{", "return", "r", ".", "TxID", "==", "tx", ".", "TxHash", "(", ")", "\n", "}", "\n\n", "pkScrip...
// MatchesTx determines whether the given transaction satisfies the confirmation // request. If the confirmation request is for a script, then we'll check all of // the outputs of the transaction to determine if it matches. Otherwise, we'll // match on the txid.
[ "MatchesTx", "determines", "whether", "the", "given", "transaction", "satisfies", "the", "confirmation", "request", ".", "If", "the", "confirmation", "request", "is", "for", "a", "script", "then", "we", "ll", "check", "all", "of", "the", "outputs", "of", "the"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L194-L207
129,388
lightningnetwork/lnd
chainntnfs/txnotifier.go
NewSpendRequest
func NewSpendRequest(op *wire.OutPoint, pkScript []byte) (SpendRequest, error) { var r SpendRequest outputScript, err := txscript.ParsePkScript(pkScript) if err != nil { return r, err } // We'll only set an outpoint for which we'll dispatch a spend // notification on this request if one was provided. Otherwise...
go
func NewSpendRequest(op *wire.OutPoint, pkScript []byte) (SpendRequest, error) { var r SpendRequest outputScript, err := txscript.ParsePkScript(pkScript) if err != nil { return r, err } // We'll only set an outpoint for which we'll dispatch a spend // notification on this request if one was provided. Otherwise...
[ "func", "NewSpendRequest", "(", "op", "*", "wire", ".", "OutPoint", ",", "pkScript", "[", "]", "byte", ")", "(", "SpendRequest", ",", "error", ")", "{", "var", "r", "SpendRequest", "\n", "outputScript", ",", "err", ":=", "txscript", ".", "ParsePkScript", ...
// NewSpendRequest creates a request for a spend notification of either an // outpoint or output script. A nil outpoint or an allocated ZeroOutPoint can be // used to dispatch the confirmation notification on the script.
[ "NewSpendRequest", "creates", "a", "request", "for", "a", "spend", "notification", "of", "either", "an", "outpoint", "or", "output", "script", ".", "A", "nil", "outpoint", "or", "an", "allocated", "ZeroOutPoint", "can", "be", "used", "to", "dispatch", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L271-L287
129,389
lightningnetwork/lnd
chainntnfs/txnotifier.go
String
func (r SpendRequest) String() string { if r.OutPoint != ZeroOutPoint { return fmt.Sprintf("outpoint=%v", r.OutPoint) } return fmt.Sprintf("script=%v", r.PkScript) }
go
func (r SpendRequest) String() string { if r.OutPoint != ZeroOutPoint { return fmt.Sprintf("outpoint=%v", r.OutPoint) } return fmt.Sprintf("script=%v", r.PkScript) }
[ "func", "(", "r", "SpendRequest", ")", "String", "(", ")", "string", "{", "if", "r", ".", "OutPoint", "!=", "ZeroOutPoint", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "OutPoint", ")", "\n", "}", "\n", "return", "fmt", "."...
// String returns the string representation of the SpendRequest.
[ "String", "returns", "the", "string", "representation", "of", "the", "SpendRequest", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L290-L295
129,390
lightningnetwork/lnd
chainntnfs/txnotifier.go
SpendHintKey
func (r SpendRequest) SpendHintKey() ([]byte, error) { if r.OutPoint == ZeroOutPoint { return r.PkScript.Script(), nil } var outpoint bytes.Buffer err := channeldb.WriteElement(&outpoint, r.OutPoint) if err != nil { return nil, err } return outpoint.Bytes(), nil }
go
func (r SpendRequest) SpendHintKey() ([]byte, error) { if r.OutPoint == ZeroOutPoint { return r.PkScript.Script(), nil } var outpoint bytes.Buffer err := channeldb.WriteElement(&outpoint, r.OutPoint) if err != nil { return nil, err } return outpoint.Bytes(), nil }
[ "func", "(", "r", "SpendRequest", ")", "SpendHintKey", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "r", ".", "OutPoint", "==", "ZeroOutPoint", "{", "return", "r", ".", "PkScript", ".", "Script", "(", ")", ",", "nil", "\n", "}", ...
// SpendHintKey returns the key that will be used to index the spend request's // hint within the height hint cache.
[ "SpendHintKey", "returns", "the", "key", "that", "will", "be", "used", "to", "index", "the", "spend", "request", "s", "hint", "within", "the", "height", "hint", "cache", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L299-L311
129,391
lightningnetwork/lnd
chainntnfs/txnotifier.go
MatchesTx
func (r SpendRequest) MatchesTx(tx *wire.MsgTx) (bool, uint32, error) { if r.OutPoint != ZeroOutPoint { for i, txIn := range tx.TxIn { if txIn.PreviousOutPoint == r.OutPoint { return true, uint32(i), nil } } return false, 0, nil } for i, txIn := range tx.TxIn { pkScript, err := txscript.ComputePk...
go
func (r SpendRequest) MatchesTx(tx *wire.MsgTx) (bool, uint32, error) { if r.OutPoint != ZeroOutPoint { for i, txIn := range tx.TxIn { if txIn.PreviousOutPoint == r.OutPoint { return true, uint32(i), nil } } return false, 0, nil } for i, txIn := range tx.TxIn { pkScript, err := txscript.ComputePk...
[ "func", "(", "r", "SpendRequest", ")", "MatchesTx", "(", "tx", "*", "wire", ".", "MsgTx", ")", "(", "bool", ",", "uint32", ",", "error", ")", "{", "if", "r", ".", "OutPoint", "!=", "ZeroOutPoint", "{", "for", "i", ",", "txIn", ":=", "range", "tx", ...
// MatchesTx determines whether the given transaction satisfies the spend // request. If the spend request is for an outpoint, then we'll check all of // the outputs being spent by the inputs of the transaction to determine if it // matches. Otherwise, we'll need to match on the output script being spent, so // we'll r...
[ "MatchesTx", "determines", "whether", "the", "given", "transaction", "satisfies", "the", "spend", "request", ".", "If", "the", "spend", "request", "is", "for", "an", "outpoint", "then", "we", "ll", "check", "all", "of", "the", "outputs", "being", "spent", "b...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L319-L347
129,392
lightningnetwork/lnd
chainntnfs/txnotifier.go
filterTx
func (n *TxNotifier) filterTx(tx *btcutil.Tx, blockHash *chainhash.Hash, blockHeight uint32, onConf func(ConfRequest, *TxConfirmation), onSpend func(SpendRequest, *SpendDetail)) { // In order to determine if this transaction is relevant to the // notifier, we'll check its inputs for any outstanding spend // reque...
go
func (n *TxNotifier) filterTx(tx *btcutil.Tx, blockHash *chainhash.Hash, blockHeight uint32, onConf func(ConfRequest, *TxConfirmation), onSpend func(SpendRequest, *SpendDetail)) { // In order to determine if this transaction is relevant to the // notifier, we'll check its inputs for any outstanding spend // reque...
[ "func", "(", "n", "*", "TxNotifier", ")", "filterTx", "(", "tx", "*", "btcutil", ".", "Tx", ",", "blockHash", "*", "chainhash", ".", "Hash", ",", "blockHeight", "uint32", ",", "onConf", "func", "(", "ConfRequest", ",", "*", "TxConfirmation", ")", ",", ...
// filterTx determines whether the transaction spends or confirms any // outstanding pending requests. The onConf and onSpend callbacks can be used to // retrieve all the requests fulfilled by this transaction as they occur.
[ "filterTx", "determines", "whether", "the", "transaction", "spends", "or", "confirms", "any", "outstanding", "pending", "requests", ".", "The", "onConf", "and", "onSpend", "callbacks", "can", "be", "used", "to", "retrieve", "all", "the", "requests", "fulfilled", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L1231-L1334
129,393
lightningnetwork/lnd
chainntnfs/txnotifier.go
NotifyHeight
func (n *TxNotifier) NotifyHeight(height uint32) error { n.Lock() defer n.Unlock() // First, we'll dispatch an update to all of the notification clients // for our watched requests with the number of confirmations left at // this new height. for _, confRequests := range n.confsByInitialHeight { for confRequest...
go
func (n *TxNotifier) NotifyHeight(height uint32) error { n.Lock() defer n.Unlock() // First, we'll dispatch an update to all of the notification clients // for our watched requests with the number of confirmations left at // this new height. for _, confRequests := range n.confsByInitialHeight { for confRequest...
[ "func", "(", "n", "*", "TxNotifier", ")", "NotifyHeight", "(", "height", "uint32", ")", "error", "{", "n", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "Unlock", "(", ")", "\n\n", "// First, we'll dispatch an update to all of the notification clients", "// fo...
// NotifyHeight dispatches confirmation and spend notifications to the clients // who registered for a notification which has been fulfilled at the passed // height.
[ "NotifyHeight", "dispatches", "confirmation", "and", "spend", "notifications", "to", "the", "clients", "who", "registered", "for", "a", "notification", "which", "has", "been", "fulfilled", "at", "the", "passed", "height", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L1417-L1480
129,394
lightningnetwork/lnd
chainntnfs/txnotifier.go
TearDown
func (n *TxNotifier) TearDown() { n.Lock() defer n.Unlock() close(n.quit) for _, confSet := range n.confNotifications { for _, ntfn := range confSet.ntfns { close(ntfn.Event.Confirmed) close(ntfn.Event.Updates) close(ntfn.Event.NegativeConf) close(ntfn.Event.Done) } } for _, spendSet := range n...
go
func (n *TxNotifier) TearDown() { n.Lock() defer n.Unlock() close(n.quit) for _, confSet := range n.confNotifications { for _, ntfn := range confSet.ntfns { close(ntfn.Event.Confirmed) close(ntfn.Event.Updates) close(ntfn.Event.NegativeConf) close(ntfn.Event.Done) } } for _, spendSet := range n...
[ "func", "(", "n", "*", "TxNotifier", ")", "TearDown", "(", ")", "{", "n", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "Unlock", "(", ")", "\n\n", "close", "(", "n", ".", "quit", ")", "\n\n", "for", "_", ",", "confSet", ":=", "range", "n", ...
// TearDown is to be called when the owner of the TxNotifier is exiting. This // closes the event channels of all registered notifications that have not been // dispatched yet.
[ "TearDown", "is", "to", "be", "called", "when", "the", "owner", "of", "the", "TxNotifier", "is", "exiting", ".", "This", "closes", "the", "event", "channels", "of", "all", "registered", "notifications", "that", "have", "not", "been", "dispatched", "yet", "."...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/txnotifier.go#L1747-L1769
129,395
lightningnetwork/lnd
chancloser.go
newChannelCloser
func newChannelCloser(cfg chanCloseCfg, deliveryScript []byte, idealFeePerKw lnwallet.SatPerKWeight, negotiationHeight uint32, closeReq *htlcswitch.ChanClose) *channelCloser { // Given the target fee-per-kw, we'll compute what our ideal _total_ // fee will be starting at for this fee negotiation. // // TODO(roas...
go
func newChannelCloser(cfg chanCloseCfg, deliveryScript []byte, idealFeePerKw lnwallet.SatPerKWeight, negotiationHeight uint32, closeReq *htlcswitch.ChanClose) *channelCloser { // Given the target fee-per-kw, we'll compute what our ideal _total_ // fee will be starting at for this fee negotiation. // // TODO(roas...
[ "func", "newChannelCloser", "(", "cfg", "chanCloseCfg", ",", "deliveryScript", "[", "]", "byte", ",", "idealFeePerKw", "lnwallet", ".", "SatPerKWeight", ",", "negotiationHeight", "uint32", ",", "closeReq", "*", "htlcswitch", ".", "ChanClose", ")", "*", "channelClo...
// newChannelCloser creates a new instance of the channel closure given the // passed configuration, and delivery+fee preference. The final argument should // only be populated iff, we're the initiator of this closing request.
[ "newChannelCloser", "creates", "a", "new", "instance", "of", "the", "channel", "closure", "given", "the", "passed", "configuration", "and", "delivery", "+", "fee", "preference", ".", "The", "final", "argument", "should", "only", "be", "populated", "iff", "we", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chancloser.go#L152-L191
129,396
lightningnetwork/lnd
chancloser.go
initChanShutdown
func (c *channelCloser) initChanShutdown() (*lnwire.Shutdown, error) { // With both items constructed we'll now send the shutdown message for // this particular channel, advertising a shutdown request to our // desired closing script. shutdown := lnwire.NewShutdown(c.cid, c.localDeliveryScript) // TODO(roasbeef):...
go
func (c *channelCloser) initChanShutdown() (*lnwire.Shutdown, error) { // With both items constructed we'll now send the shutdown message for // this particular channel, advertising a shutdown request to our // desired closing script. shutdown := lnwire.NewShutdown(c.cid, c.localDeliveryScript) // TODO(roasbeef):...
[ "func", "(", "c", "*", "channelCloser", ")", "initChanShutdown", "(", ")", "(", "*", "lnwire", ".", "Shutdown", ",", "error", ")", "{", "// With both items constructed we'll now send the shutdown message for", "// this particular channel, advertising a shutdown request to our",...
// initChanShutdown begins the shutdown process by un-registering the channel, // and creating a valid shutdown message to our target delivery address.
[ "initChanShutdown", "begins", "the", "shutdown", "process", "by", "un", "-", "registering", "the", "channel", "and", "creating", "a", "valid", "shutdown", "message", "to", "our", "target", "delivery", "address", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chancloser.go#L195-L212
129,397
lightningnetwork/lnd
chancloser.go
ShutdownChan
func (c *channelCloser) ShutdownChan() (*lnwire.Shutdown, error) { // If we attempt to shutdown the channel for the first time, and we're // not in the closeIdle state, then the caller made an error. if c.state != closeIdle { return nil, ErrChanAlreadyClosing } peerLog.Infof("ChannelPoint(%v): initiating shutdo...
go
func (c *channelCloser) ShutdownChan() (*lnwire.Shutdown, error) { // If we attempt to shutdown the channel for the first time, and we're // not in the closeIdle state, then the caller made an error. if c.state != closeIdle { return nil, ErrChanAlreadyClosing } peerLog.Infof("ChannelPoint(%v): initiating shutdo...
[ "func", "(", "c", "*", "channelCloser", ")", "ShutdownChan", "(", ")", "(", "*", "lnwire", ".", "Shutdown", ",", "error", ")", "{", "// If we attempt to shutdown the channel for the first time, and we're", "// not in the closeIdle state, then the caller made an error.", "if",...
// ShutdownChan is the first method that's to be called by the initiator of the // cooperative channel closure. This message returns the shutdown message to // send to the remote party. Upon completion, we enter the // closeShutdownInitiated phase as we await a response.
[ "ShutdownChan", "is", "the", "first", "method", "that", "s", "to", "be", "called", "by", "the", "initiator", "of", "the", "cooperative", "channel", "closure", ".", "This", "message", "returns", "the", "shutdown", "message", "to", "send", "to", "the", "remote...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chancloser.go#L218-L240
129,398
lightningnetwork/lnd
chancloser.go
proposeCloseSigned
func (c *channelCloser) proposeCloseSigned(fee btcutil.Amount) (*lnwire.ClosingSigned, error) { rawSig, _, _, err := c.cfg.channel.CreateCloseProposal( fee, c.localDeliveryScript, c.remoteDeliveryScript, ) if err != nil { return nil, err } // We'll note our last signature and proposed fee so when the remote ...
go
func (c *channelCloser) proposeCloseSigned(fee btcutil.Amount) (*lnwire.ClosingSigned, error) { rawSig, _, _, err := c.cfg.channel.CreateCloseProposal( fee, c.localDeliveryScript, c.remoteDeliveryScript, ) if err != nil { return nil, err } // We'll note our last signature and proposed fee so when the remote ...
[ "func", "(", "c", "*", "channelCloser", ")", "proposeCloseSigned", "(", "fee", "btcutil", ".", "Amount", ")", "(", "*", "lnwire", ".", "ClosingSigned", ",", "error", ")", "{", "rawSig", ",", "_", ",", "_", ",", "err", ":=", "c", ".", "cfg", ".", "c...
// proposeCloseSigned attempts to propose a new signature for the closing // transaction for a channel based on the prior fee negotiations and our // current compromise fee.
[ "proposeCloseSigned", "attempts", "to", "propose", "a", "new", "signature", "for", "the", "closing", "transaction", "for", "a", "channel", "based", "on", "the", "prior", "fee", "negotiations", "and", "our", "current", "compromise", "fee", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chancloser.go#L483-L514
129,399
lightningnetwork/lnd
chancloser.go
feeInAcceptableRange
func feeInAcceptableRange(localFee, remoteFee btcutil.Amount) bool { // If our offer is lower than theirs, then we'll accept their // offer if it's no more than 30% *greater* than our current // offer. if localFee < remoteFee { acceptableRange := localFee + ((localFee * 3) / 10) return remoteFee <= acceptableRa...
go
func feeInAcceptableRange(localFee, remoteFee btcutil.Amount) bool { // If our offer is lower than theirs, then we'll accept their // offer if it's no more than 30% *greater* than our current // offer. if localFee < remoteFee { acceptableRange := localFee + ((localFee * 3) / 10) return remoteFee <= acceptableRa...
[ "func", "feeInAcceptableRange", "(", "localFee", ",", "remoteFee", "btcutil", ".", "Amount", ")", "bool", "{", "// If our offer is lower than theirs, then we'll accept their", "// offer if it's no more than 30% *greater* than our current", "// offer.", "if", "localFee", "<", "rem...
// feeInAcceptableRange returns true if the passed remote fee is deemed to be // in an "acceptable" range to our local fee. This is an attempt at a // compromise and to ensure that the fee negotiation has a stopping point. We // consider their fee acceptable if it's within 30% of our fee.
[ "feeInAcceptableRange", "returns", "true", "if", "the", "passed", "remote", "fee", "is", "deemed", "to", "be", "in", "an", "acceptable", "range", "to", "our", "local", "fee", ".", "This", "is", "an", "attempt", "at", "a", "compromise", "and", "to", "ensure...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chancloser.go#L520-L533