Skip to content

Commit b44e008

Browse files
committed
dataformat: also match remote pubkey
1 parent e39835c commit b44e008

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dataformat/summary.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,15 @@ type SummaryEntryFile struct {
9999
func ExtractSummaryFromDump(data string) ([]*SummaryEntry, error) {
100100
// Regex to match the data pattern.
101101
pattern := `(?ms) ChanPoint: \(string\) \(len=\d+\) "(.*?)",.*? ` +
102+
`RemotePub: \(string\) \(len=66\) "(.*?)",.*? ` +
102103
`Capacity: \(btcutil\.Amount\) ([\d\.]+) BTC,.*? ` +
103104
`LocalUnrevokedCommitPoint: \(string\) \(len=66\) "(.*?)"`
104105
re := regexp.MustCompile(pattern)
105106

106107
var results []*SummaryEntry
107108
matches := re.FindAllStringSubmatch(data, -1)
108109
for _, match := range matches {
109-
if len(match) == 4 {
110+
if len(match) == 5 {
110111
chanPoint := strings.TrimSpace(match[1])
111112
chanPointParts := strings.Split(chanPoint, ":")
112113
if len(chanPointParts) != 2 {
@@ -120,20 +121,21 @@ func ExtractSummaryFromDump(data string) ([]*SummaryEntry, error) {
120121
"index: %w", err)
121122
}
122123

123-
capacity, err := strconv.ParseFloat(match[2], 64)
124+
capacity, err := strconv.ParseFloat(match[3], 64)
124125
if err != nil {
125126
return nil, fmt.Errorf("unable to parse "+
126127
"capacity: %w", err)
127128
}
128129

129130
results = append(results, &SummaryEntry{
131+
RemotePubkey: match[2],
130132
ChannelPoint: chanPoint,
131133
FundingTXID: txid,
132134
FundingTXIndex: uint32(index),
133135
Capacity: uint64(
134136
capacity * 1e8,
135137
),
136-
LocalUnrevokedCommitPoint: match[3],
138+
LocalUnrevokedCommitPoint: match[4],
137139
})
138140
}
139141
}

0 commit comments

Comments
 (0)