Closes #3534. Do not use APPROX_RELEASE_HEIGHT to get consensus branch

id when in regtest mode.

Co-authored-by: Larry Ruane <larryruane@gmail.com>
This commit is contained in:
Simon
2018-09-21 11:10:15 -07:00
parent 36243f41f1
commit 18f8abb62d
3 changed files with 40 additions and 2 deletions

View File

@@ -918,8 +918,11 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);
// Use the approximate release height if it is greater so offline nodes
// have a better estimation of the current height and will be more likely to
// determine the correct consensus branch ID.
int chainHeight = std::max(chainActive.Height() + 1, APPROX_RELEASE_HEIGHT);
// determine the correct consensus branch ID. Regtest mode ignores release height.
int chainHeight = chainActive.Height() + 1;
if (Params().NetworkIDString() != "regtest") {
chainHeight = std::max(chainHeight, APPROX_RELEASE_HEIGHT);
}
// Grab the current consensus branch ID
auto consensusBranchId = CurrentEpochBranchId(chainHeight, Params().GetConsensus());