"context"
"strconv"
- chainjson "github.com/bytom/encoding/json"
- "github.com/bytom/errors"
- "github.com/bytom/protocol/bc"
- "github.com/bytom/protocol/bc/types"
+ chainjson "github.com/bytom/bytom/encoding/json"
+ "github.com/bytom/bytom/errors"
+ "github.com/bytom/bytom/event"
+ "github.com/bytom/bytom/protocol/bc"
+ "github.com/bytom/bytom/protocol/bc/types"
)
// BlockHeaderJSON struct provides support for get work in json format, when it also follows
if err != nil {
return NewErrorResponse(err)
}
+
if isOrphan {
return NewErrorResponse(errors.New("block submitted is orphan"))
}
- blockHash := req.Block.BlockHeader.Hash()
- a.newBlockCh <- &blockHash
+ if err = a.eventDispatcher.Post(event.NewMinedBlockEvent{Block: *req.Block}); err != nil {
+ return NewErrorResponse(err)
+ }
+
return NewSuccessResponse(true)
}