* Calculate fee from percentage. - Reverted config to accept a fee percentage, not absolute value. - The fee amount to be paid is now included in the `getfeeaddress` response. The current best block is used to calculate the fee percentage, and new blocks may be mined before the fee is paid, so the fee expiry period is shortened from 24 hours to 1 hour to mitigate this. - Rename ticket db field to FeeAmount so it is more representative of the data it holds. - API fields renamed to "FeePercentage" and "FeeAmount" - Relay fee is still hard coded. * Use getbestblockhash
24 lines
410 B
Go
24 lines
410 B
Go
package webapi
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// pubKey is the handler for "GET /pubkey".
|
|
func pubKey(c *gin.Context) {
|
|
sendJSONResponse(pubKeyResponse{
|
|
Timestamp: time.Now().Unix(),
|
|
PubKey: cfg.PubKey,
|
|
}, c)
|
|
}
|
|
|
|
// fee is the handler for "GET /fee".
|
|
func fee(c *gin.Context) {
|
|
sendJSONResponse(feeResponse{
|
|
Timestamp: time.Now().Unix(),
|
|
FeePercentage: cfg.VSPFee,
|
|
}, c)
|
|
}
|