Show blockbook status in case of backend error
parent
d7d596bf4b
commit
d26995a1e4
23
api/types.go
23
api/types.go
|
@ -341,17 +341,18 @@ type BlockbookInfo struct {
|
|||
|
||||
// BackendInfo is used to get information about blockchain
|
||||
type BackendInfo struct {
|
||||
Chain string `json:"chain"`
|
||||
Blocks int `json:"blocks"`
|
||||
Headers int `json:"headers"`
|
||||
Bestblockhash string `json:"bestBlockHash"`
|
||||
Difficulty string `json:"difficulty"`
|
||||
SizeOnDisk int64 `json:"sizeOnDisk"`
|
||||
Version string `json:"version"`
|
||||
Subversion string `json:"subversion"`
|
||||
ProtocolVersion string `json:"protocolVersion"`
|
||||
Timeoffset float64 `json:"timeOffset"`
|
||||
Warnings string `json:"warnings"`
|
||||
BackendError string `json:"error,omitempty"`
|
||||
Chain string `json:"chain,omitempty"`
|
||||
Blocks int `json:"blocks,omitempty"`
|
||||
Headers int `json:"headers,omitempty"`
|
||||
BestBlockHash string `json:"bestBlockHash,omitempty"`
|
||||
Difficulty string `json:"difficulty,omitempty"`
|
||||
SizeOnDisk int64 `json:"sizeOnDisk,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Subversion string `json:"subversion,omitempty"`
|
||||
ProtocolVersion string `json:"protocolVersion,omitempty"`
|
||||
Timeoffset float64 `json:"timeOffset,omitempty"`
|
||||
Warnings string `json:"warnings,omitempty"`
|
||||
}
|
||||
|
||||
// SystemInfo contains information about the running blockbook and backend instance
|
||||
|
|
|
@ -1091,13 +1091,18 @@ func (w *Worker) ComputeFeeStats(blockFrom, blockTo int, stopCompute chan os.Sig
|
|||
// GetSystemInfo returns information about system
|
||||
func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) {
|
||||
start := time.Now()
|
||||
ci, err := w.chain.GetChainInfo()
|
||||
if err != nil {
|
||||
return nil, errors.Annotatef(err, "GetChainInfo")
|
||||
}
|
||||
vi := common.GetVersionInfo()
|
||||
inSync, bestHeight, lastBlockTime := w.is.GetSyncState()
|
||||
inSyncMempool, lastMempoolTime, mempoolSize := w.is.GetMempoolSyncState()
|
||||
ci, err := w.chain.GetChainInfo()
|
||||
var backendError string
|
||||
if err != nil {
|
||||
backendError = errors.Annotatef(err, "GetChainInfo").Error()
|
||||
ci = &bchain.ChainInfo{}
|
||||
// set not in sync in case of backend error
|
||||
inSync = false
|
||||
inSyncMempool = false
|
||||
}
|
||||
var columnStats []common.InternalStateColumn
|
||||
var internalDBSize int64
|
||||
if internal {
|
||||
|
@ -1125,7 +1130,8 @@ func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) {
|
|||
About: Text.BlockbookAbout,
|
||||
}
|
||||
backendInfo := &BackendInfo{
|
||||
Bestblockhash: ci.Bestblockhash,
|
||||
BackendError: backendError,
|
||||
BestBlockHash: ci.Bestblockhash,
|
||||
Blocks: ci.Blocks,
|
||||
Chain: ci.Chain,
|
||||
Difficulty: ci.Difficulty,
|
||||
|
|
|
@ -58,6 +58,12 @@
|
|||
<h3>Backend</h3>
|
||||
<table class="table data-table">
|
||||
<tbody>
|
||||
{{- if $be.BackendError -}}
|
||||
<tr>
|
||||
<td style="width: 30%;">Backend Error</td>
|
||||
<td class="data text-danger">{{$be.BackendError}}</td>
|
||||
</tr>
|
||||
{{- end -}}
|
||||
<tr>
|
||||
<td style="width: 30%;">Chain</td>
|
||||
<td class="data">{{$be.Chain}}</td>
|
||||
|
|
Loading…
Reference in New Issue