Skip to content

Commit 5e255a7

Browse files
authored
Merge pull request #140 from libsv/fix/pc-path
Fix: Peer channel paths
2 parents abd523a + 53cb974 commit 5e255a7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

service/payments.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,10 @@ func (p *payments) PaymentCreate(ctx context.Context, args payd.PaymentCreateArg
219219
}
220220
}
221221

222-
pc := &dpp.PeerChannelData{
223-
Host: p.pCfg.Host,
224-
ChannelID: ch.ID,
225-
Token: tokens[2].Token,
226-
}
227-
228222
// Broadcast the transaction
229223
if err := p.broadcaster.Broadcast(ctx, payd.BroadcastArgs{
230224
InvoiceID: inv.ID,
231-
CallbackURL: fmt.Sprintf("http://%s%s", p.pCfg.Host, path.Join("/api/v1/channel/", ch.ID)),
225+
CallbackURL: fmt.Sprintf("http://%s%s", p.pCfg.Host, path.Join(p.pCfg.Path, "/api/v1/channel/", ch.ID)),
232226
Token: "Bearer " + tokens[0].Token,
233227
}, tx); err != nil {
234228
// set as failed
@@ -242,6 +236,7 @@ func (p *payments) PaymentCreate(ctx context.Context, args payd.PaymentCreateArg
242236
ID: ch.ID,
243237
Token: tokens[1].Token,
244238
Host: p.pCfg.Host,
239+
Path: p.pCfg.Path,
245240
CreatedAt: ch.CreatedAt,
246241
Type: payd.PeerChannelHandlerTypeProof,
247242
}); err != nil {
@@ -271,9 +266,14 @@ func (p *payments) PaymentCreate(ctx context.Context, args payd.PaymentCreateArg
271266
}
272267

273268
return &dpp.PaymentACK{
274-
ID: inv.ID,
275-
TxID: tx.TxID(),
276-
PeerChannel: pc,
269+
ID: inv.ID,
270+
TxID: tx.TxID(),
271+
PeerChannel: &dpp.PeerChannelData{
272+
Host: p.pCfg.Host,
273+
Path: p.pCfg.Path,
274+
ChannelID: ch.ID,
275+
Token: tokens[2].Token,
276+
},
277277
}, nil
278278
}
279279

0 commit comments

Comments
 (0)