Show block for EthereumType coins
This commit is contained in:
parent
fead52881f
commit
a08f568353
@ -824,24 +824,37 @@ func (w *Worker) GetBlock(bid string, page int, txsOnPage int) (*Block, error) {
|
||||
return nil, errors.Annotatef(err, "GetBestBlock")
|
||||
}
|
||||
pg, from, to, page := computePaging(txCount, page, txsOnPage)
|
||||
glog.Info("GetBlock ", bid, ", page ", page, " finished in ", time.Since(start))
|
||||
txs := make([]*Tx, to-from)
|
||||
txi := 0
|
||||
for i := from; i < to; i++ {
|
||||
txid := bi.Txids[i]
|
||||
ta, err := w.db.GetTxAddresses(txid)
|
||||
if err != nil {
|
||||
return nil, errors.Annotatef(err, "GetTxAddresses %v", txid)
|
||||
if w.chainType == bchain.ChainBitcoinType {
|
||||
ta, err := w.db.GetTxAddresses(txid)
|
||||
if err != nil {
|
||||
return nil, errors.Annotatef(err, "GetTxAddresses %v", txid)
|
||||
}
|
||||
if ta == nil {
|
||||
glog.Warning("DB inconsistency: tx ", txid, ": not found in txAddresses")
|
||||
continue
|
||||
}
|
||||
txs[txi] = w.txFromTxAddress(txid, ta, dbi, bestheight)
|
||||
} else {
|
||||
txs[txi], err = w.GetTransaction(txid, false, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if ta == nil {
|
||||
glog.Warning("DB inconsistency: tx ", txid, ": not found in txAddresses")
|
||||
continue
|
||||
}
|
||||
txs[txi] = w.txFromTxAddress(txid, ta, dbi, bestheight)
|
||||
txi++
|
||||
}
|
||||
if bi.Prev == "" && bi.Height != 0 {
|
||||
bi.Prev, _ = w.db.GetBlockHash(bi.Height - 1)
|
||||
}
|
||||
if bi.Next == "" && bi.Height != bestheight {
|
||||
bi.Next, _ = w.db.GetBlockHash(bi.Height + 1)
|
||||
}
|
||||
txs = txs[:txi]
|
||||
bi.Txids = nil
|
||||
glog.Info("GetBlock ", bid, ", page ", page, " finished in ", time.Since(start))
|
||||
return &Block{
|
||||
Paging: pg,
|
||||
BlockInfo: *bi,
|
||||
|
||||
@ -33,6 +33,7 @@ func NewEthereumParser(b int) *EthereumParser {
|
||||
|
||||
type rpcHeader struct {
|
||||
Hash string `json:"hash"`
|
||||
ParentHash string `json:"parentHash"`
|
||||
Difficulty string `json:"difficulty"`
|
||||
Number string `json:"number"`
|
||||
Time string `json:"timestamp"`
|
||||
|
||||
@ -370,6 +370,7 @@ func (b *EthereumRPC) ethHeaderToBlockHeader(h *rpcHeader) (*bchain.BlockHeader,
|
||||
}
|
||||
return &bchain.BlockHeader{
|
||||
Hash: h.Hash,
|
||||
Prev: h.ParentHash,
|
||||
Height: uint32(height),
|
||||
Confirmations: int(c),
|
||||
Time: time,
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
<div class="alert alert-data ellipsis">
|
||||
<span class="data">{{$b.Hash}}</span>
|
||||
</div>
|
||||
<div class="h-container">
|
||||
<h3 class="h-container-6">Summary</h3>
|
||||
<nav class="h-container-6">
|
||||
<div class="row h-container">
|
||||
<h3 class="col-md-6 col-sm-12">Summary</h3>
|
||||
<nav class="col-md-6 col-sm-12">
|
||||
<ul class="pagination justify-content-end">
|
||||
<li class="page-item">{{if $b.Prev}}<a class="page-link" href="/block/{{$b.Prev}}">Previous Block</a>{{else}}<span class="page-link text-muted disabled">Previous Block</span>{{end}}</li>
|
||||
<li class="page-item">{{if $b.Next}}<a class="page-link" href="/block/{{$b.Next}}">Next Block</a>{{else}}<span class="page-link text-muted disabled">Next Block</span>{{end}}</li>
|
||||
@ -67,9 +67,9 @@
|
||||
</div>
|
||||
</div>
|
||||
{{- if $b.Transactions -}}
|
||||
<div class="h-container">
|
||||
<h3 class="h-container-6">Transactions</h3>
|
||||
<nav class="h-container-6">{{template "paging" $data}}</nav>
|
||||
<div class="row h-container">
|
||||
<h3 class="col-md-6 col-sm-12">Transactions</h3>
|
||||
<nav class="col-md-6 col-sm-12">{{template "paging" $data}}</nav>
|
||||
</div>
|
||||
<div class="data-div">
|
||||
{{- range $tx := $b.Transactions}}{{$data := setTxToTemplateData $data $tx}}{{template "txdetail" $data}}{{end -}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user