MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / formatBlock

Method formatBlock

sqlchain/observer/api.go:448–466  ·  view source on GitHub ↗
(height int32, b *types.Block)

Source from the content-addressed store, hash-verified

446}
447
448func (a *explorerAPI) formatBlock(height int32, b *types.Block) (res map[string]interface{}) {
449 queries := make([]string, 0, len(b.Acks))
450
451 for _, q := range b.Acks {
452 queries = append(queries, q.Hash().String())
453 }
454
455 return map[string]interface{}{
456 "block": map[string]interface{}{
457 "height": height,
458 "hash": b.BlockHash().String(),
459 "genesis_hash": b.GenesisHash().String(),
460 "timestamp": a.formatTime(b.Timestamp()),
461 "version": b.SignedHeader.Version,
462 "producer": b.Producer(),
463 "queries": queries,
464 },
465 }
466}
467
468func (a *explorerAPI) formatBlockV2(count, height int32, b *types.Block) (res map[string]interface{}) {
469 res = a.formatBlock(height, b)

Callers 4

GetBlockMethod · 0.95
GetBlockByHeightMethod · 0.95
GetHighestBlockMethod · 0.95
formatBlockV2Method · 0.95

Calls 7

formatTimeMethod · 0.95
GenesisHashMethod · 0.80
HashMethod · 0.65
StringMethod · 0.45
BlockHashMethod · 0.45
TimestampMethod · 0.45
ProducerMethod · 0.45

Tested by

no test coverage detected