Skip to content

Commit

Permalink
fix submit-block to account for fees from block reward recipient (#498)
Browse files Browse the repository at this point in the history
* fix submit-block to account for fees from block reward recipient

* more thorough computation of block reward

* update miner to use function from core to recompute block reward
  • Loading branch information
lazynina authored Jun 6, 2023
1 parent 82408a7 commit 72cf4fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions routes/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ func (fes *APIServer) SubmitBlock(ww http.ResponseWriter, req *http.Request) {
blockFound.Txns[0].TxOutputs[0].PublicKey = pkBytes
blockFound.Txns[0].TxnMeta.(*lib.BlockRewardMetadataa).ExtraData = lib.UintToBuf(requestData.ExtraData)

blockFound, err = lib.RecomputeBlockRewardWithBlockRewardOutputPublicKey(blockFound, pkBytes)
if err != nil {
_AddBadRequestError(ww, fmt.Sprintf("SubmitBlock: Problem recomputing block reward: %v", err))
return
}

header := &lib.MsgDeSoHeader{}
if err := header.FromBytes(requestData.Header); err != nil {
_AddBadRequestError(ww, fmt.Sprintf("SubmitBlock: Problem parsing header: %v", err))
Expand Down

0 comments on commit 72cf4fc

Please sign in to comment.