Fix /v2/get_transactions?simple=true.

This commit is contained in:
luk3yx 2020-06-17 14:50:06 +12:00
parent a603cbc94f
commit 2422cae7e8
2 changed files with 4 additions and 3 deletions

View File

@ -247,8 +247,8 @@ func addV2API(router *httprouter.Router, db lurkcoin.Database,
func(r *HTTPRequest, f v2Form) (interface{}, error) {
transactions := r.Server.GetPendingTransactions()
if f.Get("simple") != "" {
_, exc := r.Server.GetExchangeRate(c1, false)
if len(transactions) == 0 {
_, exc := r.Server.GetExchangeRate(c1, false)
return exc, nil
}
s := func(n string) string {
@ -257,7 +257,8 @@ func addV2API(router *httprouter.Router, db lurkcoin.Database,
transaction := transactions[0]
// To support fragile clients (such as versions of the lurkcoin
// mod that use the /v2 API), "¤" is replaced with "_".
return fmt.Sprintf("%d|%s|%s|%s",
return fmt.Sprintf("%g|%d|%s|%s|%s",
exc,
transaction.GetLegacyID(),
s(strings.Replace(transaction.Target, "¤", "_", -1)),
transaction.ReceivedAmount.RawString(),

View File

@ -35,7 +35,7 @@ import (
)
const SYMBOL = "¤"
const VERSION = "3.0.1"
const VERSION = "3.0.2"
// Note that public source code is required by the AGPL
const SOURCE_URL = "https://github.com/luk3yx/lurkcoin-core"