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

lightningnetwork / lnd / 13794449444

11 Mar 2025 05:31PM UTC coverage: 58.305% (-10.3%) from 68.646%
13794449444

push

github

web-flow
Merge pull request #9596 from JoeGruffins/testingbtcwalletchange

deps: Update btcwallet to v0.16.10.

94487 of 162056 relevant lines covered (58.31%)

1.81 hits per line

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

0.0
/netann/msg_hash.go
1
package netann
2

3
import (
4
        "github.com/btcsuite/btcd/chaincfg/chainhash"
5
)
6

7
// MsgHashTag will prefix the message name and the field name in order to
8
// construct the message tag.
9
const MsgHashTag = "lightning"
10

11
// MsgTag computes the full tag that will be used to prefix a message before
12
// calculating the tagged hash. The tag is constructed as follows:
13
//
14
//        tag = "lightning"||"msg_name"||"field_name"
15
func MsgTag(msgName, fieldName string) []byte {
×
16
        tag := []byte(MsgHashTag)
×
17
        tag = append(tag, []byte(msgName)...)
×
18

×
19
        return append(tag, []byte(fieldName)...)
×
20
}
×
21

22
// MsgHash computes the tagged hash of the given message as follows:
23
//
24
//        tag = "lightning"||"msg_name"||"field_name"
25
//        hash = sha256(sha246(tag) || sha256(tag) || msg)
26
func MsgHash(msgName, fieldName string, msg []byte) *chainhash.Hash {
×
27
        tag := MsgTag(msgName, fieldName)
×
28

×
29
        return chainhash.TaggedHash(tag, msg)
×
30
}
×
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