htlcswitch: Change circuit map keys to (channel ID, HTLC ID).
This changes the circuit map internals and API to reference circuits by a primary key of (channel ID, HTLC ID) instead of paymnet hash. This is because each circuit has a unique offered HTLC, but there may be multiple circuits for a payment hash with different source or destination channels.
This commit is contained in:
1 parent
bc8d674958
commit
1328e61c00
6 files changed
+274
-151
No files matched your search
@@ -1,5 +1,9 @@
|
||||
package lnwire
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ShortChannelID represents the set of data which is needed to retrieve all
|
||||
// necessary data to validate the channel existence.
|
||||
type ShortChannelID struct {
|
||||
@@ -37,3 +41,8 @@ func (c *ShortChannelID) ToUint64() uint64 {
|
||||
return ((uint64(c.BlockHeight) << 40) | (uint64(c.TxIndex) << 16) |
|
||||
(uint64(c.TxPosition)))
|
||||
}
|
||||
|
||||
// String generates a human-readable representation of the channel ID.
|
||||
func (c ShortChannelID) String() string {
|
||||
return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition)
|
||||
}
|
||||
Reference in new issue
Block a user