Skip to content

Commit

Permalink
Merge pull request #140 from libsv/fix/pc-path
Browse files Browse the repository at this point in the history
Fix: Peer channel paths
  • Loading branch information
roppa authored Mar 23, 2022
2 parents abd523a + 53cb974 commit 5e255a7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions service/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,10 @@ func (p *payments) PaymentCreate(ctx context.Context, args payd.PaymentCreateArg
}
}

pc := &dpp.PeerChannelData{
Host: p.pCfg.Host,
ChannelID: ch.ID,
Token: tokens[2].Token,
}

// Broadcast the transaction
if err := p.broadcaster.Broadcast(ctx, payd.BroadcastArgs{
InvoiceID: inv.ID,
CallbackURL: fmt.Sprintf("http://%s%s", p.pCfg.Host, path.Join("/api/v1/channel/", ch.ID)),
CallbackURL: fmt.Sprintf("http://%s%s", p.pCfg.Host, path.Join(p.pCfg.Path, "/api/v1/channel/", ch.ID)),
Token: "Bearer " + tokens[0].Token,
}, tx); err != nil {
// set as failed
Expand All @@ -242,6 +236,7 @@ func (p *payments) PaymentCreate(ctx context.Context, args payd.PaymentCreateArg
ID: ch.ID,
Token: tokens[1].Token,
Host: p.pCfg.Host,
Path: p.pCfg.Path,
CreatedAt: ch.CreatedAt,
Type: payd.PeerChannelHandlerTypeProof,
}); err != nil {
Expand Down Expand Up @@ -271,9 +266,14 @@ func (p *payments) PaymentCreate(ctx context.Context, args payd.PaymentCreateArg
}

return &dpp.PaymentACK{
ID: inv.ID,
TxID: tx.TxID(),
PeerChannel: pc,
ID: inv.ID,
TxID: tx.TxID(),
PeerChannel: &dpp.PeerChannelData{
Host: p.pCfg.Host,
Path: p.pCfg.Path,
ChannelID: ch.ID,
Token: tokens[2].Token,
},
}, nil
}

Expand Down

0 comments on commit 5e255a7

Please sign in to comment.