fix regtest difficulty

This commit is contained in:
Brannon King 2021-09-10 16:15:15 -04:00
parent cee79f6635
commit 103ab86904
2 changed files with 5 additions and 4 deletions

View file

@ -245,10 +245,11 @@ func (b *BlockChain) calcNextRequiredDifficulty(lastNode *blockNode, newBlockTim
// Get the block node at the previous retarget (targetTimespan days
// worth of blocks).
firstNode := lastNode.RelativeAncestor(b.blocksPerRetarget)
if lastNode.height == 0 {
firstNode = lastNode
blocksBack := b.blocksPerRetarget
if blocksBack > lastNode.height {
blocksBack = lastNode.height
}
firstNode := lastNode.RelativeAncestor(blocksBack)
if firstNode == nil {
return 0, AssertError("unable to obtain previous retarget block")
}

View file

@ -137,7 +137,7 @@ func normalizeAddress(addr string, chain *chaincfg.Params, useWallet bool) (stri
paramErr := fmt.Errorf("cannot use -wallet with -regtest, btcwallet not yet compatible with regtest")
return "", paramErr
} else {
defaultPort = "18334"
defaultPort = "29245"
}
case &chaincfg.SigNetParams:
if useWallet {