Skip to content

Commit 2a4e0af

Browse files
committed
fix: Dynamic use of backends instead of hardcoded index
Signed-off-by: Sophia Koehler <sophia@perun.network>
1 parent 22cdc68 commit 2a4e0af

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

channel/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func SetBackend(b Backend, id int) {
6666
// CalcID calculates the CalcID.
6767
func CalcID(p *Params) (ID, error) {
6868
var lastErr error
69-
for _, b := range backend {
70-
id, err := b.CalcID(p)
69+
for i := range p.Parts[0] {
70+
id, err := backend[i].CalcID(p)
7171
if err == nil {
7272
return id, nil
7373
}

wire/account.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,16 @@ func NewAuthResponseMsg(acc map[wallet.BackendID]Account) (Msg, error) {
103103
}
104104
addressBytes = append(addressBytes, addrBytes...)
105105
}
106-
signature, err := acc[testBackendID].Sign(addressBytes)
106+
var signature []byte
107+
var err error
108+
for _, a := range acc {
109+
sig, e := a.Sign(addressBytes)
110+
if e != nil {
111+
err = e
112+
} else {
113+
signature = sig
114+
}
115+
}
107116
if err != nil {
108117
return nil, fmt.Errorf("failed to sign address: %w", err)
109118
}

0 commit comments

Comments
 (0)