mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-07 22:56:41 +00:00
[NOD-521] Add blocks to Kasparov DB immediately after getblocks request (#532)
This commit is contained in:
parent
89dee3e005
commit
60ab6330ff
@ -105,8 +105,6 @@ func syncBlocks(client *jsonrpc.Client) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var rawBlocks []string
|
|
||||||
var verboseBlocks []btcjson.GetBlockVerboseResult
|
|
||||||
for {
|
for {
|
||||||
log.Debugf("Calling getBlocks with start hash %v", stringPointerToString(startHash))
|
log.Debugf("Calling getBlocks with start hash %v", stringPointerToString(startHash))
|
||||||
blocksResult, err := client.GetBlocks(true, true, startHash)
|
blocksResult, err := client.GetBlocks(true, true, startHash)
|
||||||
@ -118,11 +116,13 @@ func syncBlocks(client *jsonrpc.Client) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startHash = &blocksResult.Hashes[len(blocksResult.Hashes)-1]
|
startHash = &blocksResult.Hashes[len(blocksResult.Hashes)-1]
|
||||||
rawBlocks = append(rawBlocks, blocksResult.RawBlocks...)
|
err = addBlocks(client, blocksResult.RawBlocks, blocksResult.VerboseBlocks)
|
||||||
verboseBlocks = append(verboseBlocks, blocksResult.VerboseBlocks...)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return addBlocks(client, rawBlocks, verboseBlocks)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// syncSelectedParentChain attempts to download the selected parent
|
// syncSelectedParentChain attempts to download the selected parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user