fixes on last commit, especially StageBlocksCreate
This commit is contained in:
parent
f1e793796f
commit
3bada32bee
|
@ -151,7 +151,7 @@ func getBlockFromRPC(height int) (*walletrpc.CompactBlock, error) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ingestorRunning bool
|
ingestorRunning bool
|
||||||
stopIngestorChan chan struct{}
|
stopIngestorChan = make(chan struct{})
|
||||||
)
|
)
|
||||||
|
|
||||||
func startIngestor(c *BlockCache) {
|
func startIngestor(c *BlockCache) {
|
||||||
|
@ -164,7 +164,6 @@ func stopIngestor() {
|
||||||
if ingestorRunning {
|
if ingestorRunning {
|
||||||
ingestorRunning = false
|
ingestorRunning = false
|
||||||
stopIngestorChan <- struct{}{}
|
stopIngestorChan <- struct{}{}
|
||||||
<-stopIngestorChan
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +181,6 @@ func BlockIngestor(c *BlockCache, rep int) {
|
||||||
// stop if requested
|
// stop if requested
|
||||||
select {
|
select {
|
||||||
case <-stopIngestorChan:
|
case <-stopIngestorChan:
|
||||||
stopIngestorChan <- struct{}{}
|
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,6 +299,7 @@ func DarksideStageBlocksCreate(height int32, nonce int32, count int32) error {
|
||||||
blockBytes = append(blockBytes, byte(1))
|
blockBytes = append(blockBytes, byte(1))
|
||||||
blockBytes = append(blockBytes, fakeCoinbaseBytes...)
|
blockBytes = append(blockBytes, fakeCoinbaseBytes...)
|
||||||
state.stagedBlocks = append(state.stagedBlocks, blockBytes)
|
state.stagedBlocks = append(state.stagedBlocks, blockBytes)
|
||||||
|
height++
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -362,15 +363,7 @@ func darksideRawRequest(method string, params []json.RawMessage) (json.RawMessag
|
||||||
if len(state.activeBlocks) == 0 {
|
if len(state.activeBlocks) == 0 {
|
||||||
return nil, errors.New(notFoundErr)
|
return nil, errors.New(notFoundErr)
|
||||||
}
|
}
|
||||||
if height == state.latestHeight {
|
|
||||||
// The ingestor keeps going until it sees this error,
|
|
||||||
// meaning it's up to the latest height.
|
|
||||||
return nil, errors.New(notFoundErr)
|
|
||||||
}
|
|
||||||
if height > state.latestHeight {
|
if height > state.latestHeight {
|
||||||
// If an integration test can reach this, it could be a bug, so generate an error.
|
|
||||||
Log.Errorf("getblock request made for out-of-range height %d (have %d to %d)",
|
|
||||||
height, state.startHeight, state.startHeight+len(state.activeBlocks)-1)
|
|
||||||
return nil, errors.New(notFoundErr)
|
return nil, errors.New(notFoundErr)
|
||||||
}
|
}
|
||||||
index := height - state.startHeight
|
index := height - state.startHeight
|
||||||
|
|
Loading…
Reference in New Issue