@@ -19,8 +19,32 @@ import (
19
19
// Will keep for now just in case, so I don't have to refactor twice
20
20
type ApiHandler struct {}
21
21
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
+ })
24
48
}
25
49
26
50
func (h * ApiHandler ) GetBestBlockHeight (c * gin.Context ) {
@@ -303,6 +327,10 @@ func (h *ApiHandler) GetSpentOutpointsIndex(c *gin.Context) {
303
327
c .JSON (http .StatusOK , result )
304
328
}
305
329
330
+ type TxRequest struct {
331
+ Data string `form:"data" json:"data" binding:"required"`
332
+ }
333
+
306
334
func (h * ApiHandler ) ForwardRawTX (c * gin.Context ) {
307
335
var txRequest TxRequest
308
336
if err := c .ShouldBind (& txRequest ); err != nil {
0 commit comments