mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Merge branch 'master' of https://github.com/tomochain/tomochain
This commit is contained in:
commit
1340304b9a
2 changed files with 16 additions and 18 deletions
|
|
@ -151,6 +151,7 @@ exec tomo $params \
|
||||||
--identity $IDENTITY \
|
--identity $IDENTITY \
|
||||||
--password ./password \
|
--password ./password \
|
||||||
--port 30303 \
|
--port 30303 \
|
||||||
|
--maxpeer 200 \
|
||||||
--rpc \
|
--rpc \
|
||||||
--rpccorsdomain "*" \
|
--rpccorsdomain "*" \
|
||||||
--rpcaddr 0.0.0.0 \
|
--rpcaddr 0.0.0.0 \
|
||||||
|
|
|
||||||
|
|
@ -1326,31 +1326,28 @@ func (d *Downloader) processFullSyncContent() error {
|
||||||
if d.blockchain.Config() != nil && d.blockchain.Config().Posv != nil {
|
if d.blockchain.Config() != nil && d.blockchain.Config().Posv != nil {
|
||||||
epoch := d.blockchain.Config().Posv.Epoch
|
epoch := d.blockchain.Config().Posv.Epoch
|
||||||
gap := d.blockchain.Config().Posv.Gap
|
gap := d.blockchain.Config().Posv.Gap
|
||||||
length := len(results)
|
inserts := []*fetchResult{}
|
||||||
start := int(results[0].Header.Number.Uint64() % epoch)
|
for i := 0; i < len(results); i++ {
|
||||||
end := int(epoch - gap - uint64(start))
|
number := results[i].Header.Number.Uint64() % epoch
|
||||||
if end < 0 {
|
if number == 0 || number == epoch-1 || number == epoch-gap {
|
||||||
end = end + int(epoch)
|
inserts = append(inserts, results[i])
|
||||||
}
|
|
||||||
start = 0
|
|
||||||
for {
|
|
||||||
if end >= length {
|
|
||||||
end = length - 1
|
|
||||||
}
|
|
||||||
inserts := make([]*fetchResult, end-start+1)
|
|
||||||
copy(inserts, results[start:end+1])
|
|
||||||
if len(inserts) > 0 {
|
|
||||||
if d.chainInsertHook != nil {
|
if d.chainInsertHook != nil {
|
||||||
d.chainInsertHook(inserts)
|
d.chainInsertHook(inserts)
|
||||||
}
|
}
|
||||||
if err := d.importBlockResults(inserts); err != nil {
|
if err := d.importBlockResults(inserts); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
inserts = []*fetchResult{}
|
||||||
|
} else {
|
||||||
|
inserts = append(inserts, results[i])
|
||||||
}
|
}
|
||||||
start = end + 1
|
}
|
||||||
end = end + int(epoch)
|
if len(inserts) > 0 {
|
||||||
if start >= length {
|
if d.chainInsertHook != nil {
|
||||||
break
|
d.chainInsertHook(inserts)
|
||||||
|
}
|
||||||
|
if err := d.importBlockResults(inserts); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue