itest: use hex encoded hash in error message

This commit is contained in:
Johan T. Halseth 2020-12-09 12:24:02 +01:00
parent 09f2307d14
commit 241e21a0d1
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

View File

@ -11019,11 +11019,12 @@ func assertActiveHtlcs(nodes []*lntest.HarnessNode, payHashes ...[]byte) error {
// Record all payment hashes active for this channel.
htlcHashes := make(map[string]struct{})
for _, htlc := range channel.PendingHtlcs {
_, ok := htlcHashes[string(htlc.HashLock)]
h := hex.EncodeToString(htlc.HashLock)
_, ok := htlcHashes[h]
if ok {
return fmt.Errorf("duplicate HashLock")
}
htlcHashes[string(htlc.HashLock)] = struct{}{}
htlcHashes[h] = struct{}{}
}
// Channel should have exactly the payHashes active.
@ -11035,12 +11036,13 @@ func assertActiveHtlcs(nodes []*lntest.HarnessNode, payHashes ...[]byte) error {
// Make sure all the payHashes are active.
for _, payHash := range payHashes {
if _, ok := htlcHashes[string(payHash)]; ok {
h := hex.EncodeToString(payHash)
if _, ok := htlcHashes[h]; ok {
continue
}
return fmt.Errorf("node %x didn't have the "+
"payHash %v active", node.PubKey[:],
payHash)
h)
}
}
}