@@ -19,8 +19,32 @@ import (
1919// Will keep for now just in case, so I don't have to refactor twice
2020type ApiHandler struct {}
2121
22- type TxRequest struct {
23- Data string `form:"data" json:"data" binding:"required"`
22+ type Info struct {
23+ Network string `json:"network"`
24+ Height uint32 `json:"height"`
25+ TweaksOnly bool `json:"tweaks_only"`
26+ TweaksFullBasic bool `json:"tweaks_full_basic"`
27+ TweaksFullWithDustFilter bool `json:"tweaks_full_with_dust_filter"`
28+ TweaksCutThroughWithDustFilter bool `json:"tweaks_cut_through_with_dust_filter"`
29+ }
30+
31+ func (h * ApiHandler ) GetInfo (c * gin.Context ) {
32+ lastHeader , err := dblevel .FetchHighestBlockHeaderInvByFlag (true )
33+ if err != nil {
34+ common .ErrorLogger .Println (err )
35+ c .JSON (http .StatusInternalServerError , gin.H {
36+ "error" : "could could not retrieve data from database" ,
37+ })
38+ return
39+ }
40+ c .JSON (http .StatusOK , Info {
41+ Network : common .ChainToString (common .Chain ),
42+ Height : lastHeader .Height ,
43+ TweaksOnly : common .TweaksOnly ,
44+ TweaksFullBasic : common .TweakIndexFullNoDust ,
45+ TweaksFullWithDustFilter : common .TweakIndexFullIncludingDust ,
46+ TweaksCutThroughWithDustFilter : common .TweaksCutThroughWithDust ,
47+ })
2448}
2549
2650func (h * ApiHandler ) GetBestBlockHeight (c * gin.Context ) {
@@ -303,6 +327,10 @@ func (h *ApiHandler) GetSpentOutpointsIndex(c *gin.Context) {
303327 c .JSON (http .StatusOK , result )
304328}
305329
330+ type TxRequest struct {
331+ Data string `form:"data" json:"data" binding:"required"`
332+ }
333+
306334func (h * ApiHandler ) ForwardRawTX (c * gin.Context ) {
307335 var txRequest TxRequest
308336 if err := c .ShouldBind (& txRequest ); err != nil {
0 commit comments