Fix API block window
This commit is contained in:
parent
3ec6e36a12
commit
239f135fcd
|
@ -32,11 +32,8 @@ func (a *Api) GetBlockWindowPayouts(tip *database.Block) (shares map[uint64]type
|
|||
//TODO: adjust for fork
|
||||
shares = make(map[uint64]types.Difficulty)
|
||||
|
||||
var blockDepth uint64
|
||||
|
||||
block := tip
|
||||
|
||||
blockCache := make(map[uint64]*database.Block, a.p2api.Consensus().ChainWindowSize)
|
||||
|
||||
for b := range a.db.GetBlocksInWindow(&tip.Height, a.p2api.Consensus().ChainWindowSize) {
|
||||
blockCache[b.Height] = b
|
||||
}
|
||||
|
@ -59,6 +56,9 @@ func (a *Api) GetBlockWindowPayouts(tip *database.Block) (shares map[uint64]type
|
|||
}
|
||||
var pplnsWeight types.Difficulty
|
||||
|
||||
var blockDepth uint64
|
||||
block := tip
|
||||
|
||||
for {
|
||||
|
||||
curWeight := block.Difficulty
|
||||
|
@ -76,12 +76,14 @@ func (a *Api) GetBlockWindowPayouts(tip *database.Block) (shares map[uint64]type
|
|||
continue
|
||||
}
|
||||
|
||||
curWeight = curWeight.Add(uncleWeight)
|
||||
curWeight = curWeight.Add(unclePenalty)
|
||||
|
||||
if _, ok := shares[uncle.Block.MinerId]; !ok {
|
||||
shares[uncle.Block.MinerId] = types.DifficultyFrom64(0)
|
||||
}
|
||||
shares[uncle.Block.MinerId] = shares[uncle.Block.MinerId].Add(uncleWeight)
|
||||
|
||||
pplnsWeight = newPplnsWeight
|
||||
}
|
||||
|
||||
if _, ok := shares[block.MinerId]; !ok {
|
||||
|
|
3
p2pool/cache/archive/archive.go
vendored
3
p2pool/cache/archive/archive.go
vendored
|
@ -87,8 +87,7 @@ func (c *Cache) Store(block *sidechain.PoolBlock) {
|
|||
binary.BigEndian.PutUint64(mainHeight[:], block.Main.Coinbase.GenHeight)
|
||||
|
||||
if c.existsByMainId(mainId) {
|
||||
//return
|
||||
//TODO: remove this next day
|
||||
return
|
||||
}
|
||||
|
||||
var storePruned, storeCompact bool
|
||||
|
|
Loading…
Reference in a new issue