diff --git a/device/hashrate.go b/device/hashrate.go index e010344..cc6672d 100644 --- a/device/hashrate.go +++ b/device/hashrate.go @@ -63,6 +63,9 @@ func NewHashrateLog() *HashrateLogTable { func (h *HashrateLogTable) loopPrintHashrate() { for { <-h.hsrtc.C + if h.current_blk == nil { + continue + } var hei = h.current_blk.GetHeight() var lphr = difficulty.ConvertHashToRate(hei, h.period_max_power_hash, h.blktm) h.hxrate_show_count++ @@ -73,6 +76,9 @@ func (h *HashrateLogTable) loopPrintHashrate() { h.logts[5] = average_hashrate var ratio = big.NewFloat(float64(100)) ratio = ratio.Mul(ratio, big.NewFloat(0).SetInt(average_lphr)) + if h.blk_rate.Sign() == 0 { + continue + } ratio = ratio.Quo(ratio, big.NewFloat(0).SetInt(h.blk_rate)) percentf, _ := ratio.Float64() h.logts[3] = fmt.Sprintf("%.6f%%", percentf) diff --git a/memtxpool/check.go b/memtxpool/check.go index 59643fd..cb76be8 100644 --- a/memtxpool/check.go +++ b/memtxpool/check.go @@ -26,7 +26,7 @@ func (p *MemTxPool) checkDiamondCreate(newtx interfaces.Transaction, act *action return fmt.Errorf("diamond create tx %s timestamp cannot more than now.", txhxhex) } // fee purity - if newtx.FeePurity() < mint.MinTransactionFeePurityOfOneByte { + if newtx.FeePurity() < mint.MinTransactionFeePurity { return fmt.Errorf("diamond create tx %s handling fee is too low for miners to accept.", txhxhex) } // sign diff --git a/memtxpool/item.go b/memtxpool/item.go index 14c1266..603d109 100644 --- a/memtxpool/item.go +++ b/memtxpool/item.go @@ -10,7 +10,7 @@ type TxItem struct { tx interfaces.Transaction hash fields.Hash size uint32 - feepurity uint64 + feepurity uint32 next *TxItem prev *TxItem