mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Add blueScore to RPC GetBlock, and add more INFO logs (#1103)
* Add BlueScore to RPC command GetBlock * Add info logs when getting new blocks from the p2p
This commit is contained in:
parent
8500acd86b
commit
3f92ddd827
@ -58,6 +58,7 @@ type BlockVerboseData struct {
|
||||
Difficulty float64
|
||||
ParentHashes []string
|
||||
SelectedParentHash string
|
||||
BlueScore uint64
|
||||
}
|
||||
|
||||
// TransactionVerboseData holds verbose data about a transaction
|
||||
|
@ -13,6 +13,8 @@ func (f *FlowContext) AddOrphan(orphanBlock *externalapi.DomainBlock) {
|
||||
|
||||
orphanHash := consensusserialization.BlockHash(orphanBlock)
|
||||
f.orphans[*orphanHash] = orphanBlock
|
||||
|
||||
log.Infof("Received a block with missing parents, adding to orphan pool: %s", orphanHash)
|
||||
}
|
||||
|
||||
// UnorphanBlocks removes the block from the orphan set, and remove all of the blocks that are not orphans anymore.
|
||||
|
@ -249,6 +249,8 @@ func (flow *handleRelayInvsFlow) processAndRelayBlock(requestQueue *hashesQueueS
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Accepted block %s via relay", blockHash)
|
||||
|
||||
err = flow.StartIBDIfRequired()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -3,6 +3,7 @@ package rpccontext
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/kaspanet/kaspad/domain/consensus/utils/blocks"
|
||||
"math/big"
|
||||
"strconv"
|
||||
|
||||
@ -25,6 +26,11 @@ func (ctx *Context) BuildBlockVerboseData(block *externalapi.DomainBlock, includ
|
||||
hash := consensusserialization.BlockHash(block)
|
||||
blockHeader := block.Header
|
||||
|
||||
blueScore, err := blocks.ExtractBlueScore(block)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &appmessage.BlockVerboseData{
|
||||
Hash: hash.String(),
|
||||
Version: blockHeader.Version,
|
||||
@ -37,6 +43,7 @@ func (ctx *Context) BuildBlockVerboseData(block *externalapi.DomainBlock, includ
|
||||
Time: blockHeader.TimeInMilliseconds,
|
||||
Bits: strconv.FormatInt(int64(blockHeader.Bits), 16),
|
||||
Difficulty: ctx.GetDifficultyRatio(blockHeader.Bits, ctx.Config.ActiveNetParams),
|
||||
BlueScore: blueScore,
|
||||
}
|
||||
|
||||
txIDs := make([]string, len(block.Transactions))
|
||||
|
@ -21,7 +21,7 @@ func HandleSubmitBlock(context *rpccontext.Context, _ *router.Router, request ap
|
||||
return errorMessage, nil
|
||||
}
|
||||
|
||||
log.Infof("Accepted domainBlock %s via submitBlock", consensusserialization.BlockHash(domainBlock))
|
||||
log.Infof("Accepted block %s via submitBlock", consensusserialization.BlockHash(domainBlock))
|
||||
|
||||
response := appmessage.NewSubmitBlockResponseMessage()
|
||||
return response, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user