• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13211764208

08 Feb 2025 03:08AM UTC coverage: 49.288% (-9.5%) from 58.815%
13211764208

Pull #9489

github

calvinrzachman
itest: verify switchrpc server enforces send then track

We prevent the rpc server from allowing onion dispatches for
attempt IDs which have already been tracked by rpc clients.

This helps protect the client from leaking a duplicate onion
attempt. NOTE: This is not the only method for solving this
issue! The issue could be addressed via careful client side
programming which accounts for the uncertainty and async
nature of dispatching onions to a remote process via RPC.
This would require some lnd ChannelRouter changes for how
we intend to use these RPCs though.
Pull Request #9489: multi: add BuildOnion, SendOnion, and TrackOnion RPCs

474 of 990 new or added lines in 11 files covered. (47.88%)

27321 existing lines in 435 files now uncovered.

101192 of 205306 relevant lines covered (49.29%)

1.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/watchtower/wtdb/migration5/codec.go
1
package migration5
2

3
import (
4
        "encoding/binary"
5
        "fmt"
6
)
7

8
// TowerID is a unique 64-bit identifier allocated to each unique watchtower.
9
// This allows the client to conserve on-disk space by not needing to always
10
// reference towers by their pubkey.
11
type TowerID uint64
12

13
// TowerIDFromBytes constructs a TowerID from the provided byte slice. The
14
// argument must have at least 8 bytes, and should contain the TowerID in
15
// big-endian byte order.
UNCOV
16
func TowerIDFromBytes(towerIDBytes []byte) (TowerID, error) {
×
UNCOV
17
        if len(towerIDBytes) != 8 {
×
UNCOV
18
                return 0, fmt.Errorf("not enough bytes in tower ID. "+
×
UNCOV
19
                        "Expected 8, got: %d", len(towerIDBytes))
×
UNCOV
20
        }
×
21

UNCOV
22
        return TowerID(byteOrder.Uint64(towerIDBytes)), nil
×
23
}
24

25
// Bytes encodes a TowerID into an 8-byte slice in big-endian byte order.
UNCOV
26
func (id TowerID) Bytes() []byte {
×
UNCOV
27
        var buf [8]byte
×
UNCOV
28
        binary.BigEndian.PutUint64(buf[:], uint64(id))
×
UNCOV
29
        return buf[:]
×
UNCOV
30
}
×
31

32
// SessionIDSize is 33-bytes; it is a serialized, compressed public key.
33
const SessionIDSize = 33
34

35
// SessionID is created from the remote public key of a client, and serves as a
36
// unique identifier and authentication for sending state updates.
37
type SessionID [SessionIDSize]byte
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc