Skip to content

Commit

Permalink
temp relay
Browse files Browse the repository at this point in the history
  • Loading branch information
RainFallsSilent committed Jan 15, 2025
1 parent a516cfc commit 0a766f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mempool/blockpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ func (bm *BlockPool) AppendDposBlock(dposBlock *types.DposBlock) (bool, bool, er
return bm.appendBlockAndConfirm(dposBlock)
}

func (bm *BlockPool) RelayBlock(block *types.Block) {
events.Notify(events.ETBlockConfirmAccepted, block)
}

func (bm *BlockPool) appendBlock(dposBlock *types.DposBlock) (bool, bool, error) {
// add block
block := dposBlock.Block
Expand Down
9 changes: 9 additions & 0 deletions pow/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,15 @@ func (pow *Service) SubmitAuxBlock(hash *common.Uint256, auxPow *auxpow.AuxPow)
func (pow *Service) DiscreteMining(n uint32) ([]*common.Uint256, error) {
pow.mutex.Lock()

// temp relay last block
block, err := pow.chain.GetBlockByHeight(pow.chain.GetBestChain().Height)
if err != nil {
return nil, err
}
pow.blkMemPool.RelayBlock(block)
log.Info("### [DiscreteMining] relay last block:", block.Hash().String())
time.Sleep(time.Second * 2)

if pow.started || pow.discreteMining {
pow.mutex.Unlock()
return nil, errors.New("node is mining")
Expand Down

0 comments on commit 0a766f4

Please sign in to comment.