Update addblock util for recent chain API changes.
This commit is contained in:
parent
c3065d32f4
commit
d078deb4a7
1 changed files with 4 additions and 1 deletions
|
@ -32,6 +32,7 @@ type importResults struct {
|
||||||
type blockImporter struct {
|
type blockImporter struct {
|
||||||
db btcdb.Db
|
db btcdb.Db
|
||||||
chain *btcchain.BlockChain
|
chain *btcchain.BlockChain
|
||||||
|
medianTime btcchain.MedianTimeSource
|
||||||
r io.ReadSeeker
|
r io.ReadSeeker
|
||||||
processQueue chan []byte
|
processQueue chan []byte
|
||||||
doneChan chan bool
|
doneChan chan bool
|
||||||
|
@ -132,7 +133,8 @@ func (bi *blockImporter) processBlock(serializedBlock []byte) (bool, error) {
|
||||||
|
|
||||||
// Ensure the blocks follows all of the chain rules and match up to the
|
// Ensure the blocks follows all of the chain rules and match up to the
|
||||||
// known checkpoints.
|
// known checkpoints.
|
||||||
isOrphan, err := bi.chain.ProcessBlock(block, btcchain.BFFastAdd)
|
isOrphan, err := bi.chain.ProcessBlock(block, bi.medianTime,
|
||||||
|
btcchain.BFFastAdd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -306,6 +308,7 @@ func newBlockImporter(db btcdb.Db, r io.ReadSeeker) *blockImporter {
|
||||||
errChan: make(chan error),
|
errChan: make(chan error),
|
||||||
quit: make(chan struct{}),
|
quit: make(chan struct{}),
|
||||||
chain: btcchain.New(db, activeNetParams, nil),
|
chain: btcchain.New(db, activeNetParams, nil),
|
||||||
|
medianTime: btcchain.NewMedianTime(),
|
||||||
lastLogTime: time.Now(),
|
lastLogTime: time.Now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue