mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Add a few log error messages.
In addition to returning errors to the caller, log the error with a prefix in a few key places that helps identify the origin for errors. In some cases, the underlying error comes from a different subsystem such as the SQL database driver and the error messages can be fairly generic.
This commit is contained in:
parent
f219ed5baf
commit
1deeb05627
@ -19,6 +19,7 @@ func (b *BlockChain) maybeAcceptBlock(block *btcutil.Block) error {
|
||||
// if this is the genesis block.
|
||||
prevNode, err := b.getPrevNodeFromBlock(block)
|
||||
if err != nil {
|
||||
log.Errorf("getPrevNodeFromBlock: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -34,6 +35,7 @@ func (b *BlockChain) maybeAcceptBlock(block *btcutil.Block) error {
|
||||
blockHeader := block.MsgBlock().Header
|
||||
expectedDifficulty, err := b.calcNextRequiredDifficulty(prevNode, block)
|
||||
if err != nil {
|
||||
log.Errorf("calcNextRequiredDifficulty: %v", err)
|
||||
return err
|
||||
}
|
||||
blockDifficulty := blockHeader.Bits
|
||||
@ -47,6 +49,7 @@ func (b *BlockChain) maybeAcceptBlock(block *btcutil.Block) error {
|
||||
// the last several blocks (medianTimeBlocks).
|
||||
medianTime, err := b.calcPastMedianTime(prevNode)
|
||||
if err != nil {
|
||||
log.Errorf("calcPastMedianTime: %v", err)
|
||||
return err
|
||||
}
|
||||
if !blockHeader.Timestamp.After(medianTime) {
|
||||
@ -147,6 +150,7 @@ func (b *BlockChain) maybeAcceptBlock(block *btcutil.Block) error {
|
||||
// also handles validation of the transaction scripts.
|
||||
err = b.connectBestChain(newNode, block)
|
||||
if err != nil {
|
||||
log.Errorf("connectBestChain: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user