Merge pull request #1 from LarryRuane/remove_0mq
add prev_hash to logging
This commit is contained in:
commit
03118ba2d7
|
@ -217,6 +217,7 @@ func handleBlock(db *sql.DB, block *parser.Block) {
|
||||||
entry := log.WithFields(logrus.Fields{
|
entry := log.WithFields(logrus.Fields{
|
||||||
"block_height": block.GetHeight(),
|
"block_height": block.GetHeight(),
|
||||||
"block_hash": hex.EncodeToString(block.GetDisplayHash()),
|
"block_hash": hex.EncodeToString(block.GetDisplayHash()),
|
||||||
|
"prev_hash": hex.EncodeToString(block.GetDisplayPrevHash()),
|
||||||
"block_version": block.GetVersion(),
|
"block_version": block.GetVersion(),
|
||||||
"tx_count": block.GetTxCount(),
|
"tx_count": block.GetTxCount(),
|
||||||
"sapling": block.HasSaplingTransactions(),
|
"sapling": block.HasSaplingTransactions(),
|
||||||
|
|
|
@ -43,6 +43,16 @@ func (b *Block) GetEncodableHash() []byte {
|
||||||
return b.hdr.GetEncodableHash()
|
return b.hdr.GetEncodableHash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Block) GetDisplayPrevHash() []byte {
|
||||||
|
h := b.hdr.HashPrevBlock
|
||||||
|
// Reverse byte order
|
||||||
|
for i := 0; i < len(h)/2; i++ {
|
||||||
|
j := len(h) - 1 - i
|
||||||
|
h[i], h[j] = h[j], h[i]
|
||||||
|
}
|
||||||
|
return h
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Block) HasSaplingTransactions() bool {
|
func (b *Block) HasSaplingTransactions() bool {
|
||||||
for _, tx := range b.vtx {
|
for _, tx := range b.vtx {
|
||||||
if tx.HasSaplingTransactions() {
|
if tx.HasSaplingTransactions() {
|
||||||
|
|
Loading…
Reference in New Issue