Skip to content

Commit 265d653

Browse files
author
miko
committed
Keep dryrun working for old LBC tips
1 parent 654bdee commit 265d653

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

server/services/v1/comments/create.go

+16-7
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,27 @@ func create(_ *http.Request, args *commentapi.CreateArgs, reply *commentapi.Crea
9898
if args.PaymentIntentID != nil {
9999
cents := uint64(*args.Amount * 100)
100100
request.comment.Amount.SetValid(cents)
101-
} else if args.SupportTxID != nil && args.Currency != nil {
102-
switch *args.Currency {
103-
case "USDC":
104-
cents := uint64(*args.Amount * 100)
105-
request.comment.Amount.SetValid(cents)
106-
request.comment.Currency.SetValid(*args.Currency)
107-
case "LBC":
101+
} else if args.SupportTxID != nil {
102+
if args.Currency == nil {
103+
// Support for old LBC tips
108104
lbc, err := btcutil.NewAmount(*args.Amount)
109105
if err != nil {
110106
return errors.Err(err)
111107
}
112108
request.comment.Amount.SetValid(uint64(lbc.ToUnit(btcutil.AmountSatoshi)))
109+
} else {
110+
switch *args.Currency {
111+
case "USDC":
112+
cents := uint64(*args.Amount * 100)
113+
request.comment.Amount.SetValid(cents)
114+
request.comment.Currency.SetValid(*args.Currency)
115+
case "LBC":
116+
lbc, err := btcutil.NewAmount(*args.Amount)
117+
if err != nil {
118+
return errors.Err(err)
119+
}
120+
request.comment.Amount.SetValid(uint64(lbc.ToUnit(btcutil.AmountSatoshi)))
121+
}
113122
}
114123
}
115124
}

0 commit comments

Comments
 (0)