Merge pull request #17 from openrelayxyz/bugfix/commit-untracked
Fix tracking of ancients
This commit is contained in:
commit
efb6546a11
@ -37,11 +37,16 @@ func PluginCommitUpdate(pl *plugins.PluginLoader, num uint64) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
if freezerUpdates == nil { freezerUpdates = make(map[uint64]map[string]interface{}) }
|
||||
defer func() { delete(freezerUpdates, num) }()
|
||||
update, ok := freezerUpdates[num]
|
||||
min := ^uint64(0)
|
||||
for i := range freezerUpdates{
|
||||
if min < i { min = i }
|
||||
}
|
||||
for i := min ; i < num; i++ {
|
||||
update, ok := freezerUpdates[i]
|
||||
defer func() { delete(freezerUpdates, i) }()
|
||||
if !ok {
|
||||
log.Warn("Attempting to commit untracked block", "num", num)
|
||||
return
|
||||
log.Warn("Attempting to commit untracked block", "num", i)
|
||||
continue
|
||||
}
|
||||
fnList := pl.Lookup("ModifyAncients", func(item interface{}) bool {
|
||||
_, ok := item.(func(uint64, map[string]interface{}))
|
||||
@ -49,7 +54,7 @@ func PluginCommitUpdate(pl *plugins.PluginLoader, num uint64) {
|
||||
})
|
||||
for _, fni := range fnList {
|
||||
if fn, ok := fni.(func(uint64, map[string]interface{})); ok {
|
||||
fn(num, update)
|
||||
fn(i, update)
|
||||
}
|
||||
}
|
||||
appendAncientFnList := pl.Lookup("AppendAncient", func(item interface{}) bool {
|
||||
@ -107,7 +112,8 @@ func PluginCommitUpdate(pl *plugins.PluginLoader, num uint64) {
|
||||
}
|
||||
for _, fni := range appendAncientFnList {
|
||||
if fn, ok := fni.(func(number uint64, hash, header, body, receipts, td []byte)); ok {
|
||||
fn(num, hash, header, body, receipts, td)
|
||||
fn(i, hash, header, body, receipts, td)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user