mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-10-14 00:59:33 +00:00
[NOD-296] Send SyncMgr.SubmitBlock errors as rpc errors (#381)
* [NOD-296] Send SyncMgr.SubmitBlock errors as rpc errors * [NOD-296] Add error message prefix
This commit is contained in:
parent
552a5917c2
commit
5cf7f01d3f
@ -3537,7 +3537,10 @@ func handleSubmitBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (i
|
|||||||
// nodes. This will in turn relay it to the network like normal.
|
// nodes. This will in turn relay it to the network like normal.
|
||||||
_, err = s.cfg.SyncMgr.SubmitBlock(block, blockdag.BFNone)
|
_, err = s.cfg.SyncMgr.SubmitBlock(block, blockdag.BFNone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Sprintf("rejected: %s", err.Error()), nil
|
return nil, &btcjson.RPCError{
|
||||||
|
Code: btcjson.ErrRPCVerify,
|
||||||
|
Message: fmt.Sprintf("Block rejected. Reason: %s", err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Accepted block %s via submitBlock", block.Hash())
|
log.Infof("Accepted block %s via submitBlock", block.Hash())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user