Incorporate APPROX_RELEASE_HEIGHT when determining what consensus branch to sign with

This commit is contained in:
Eirik Ogilvie-Wigley
2018-09-13 16:55:18 -06:00
parent 19697025c6
commit 40b9527301
2 changed files with 6 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
#include "consensus/validation.h"
#include "core_io.h"
#include "init.h"
#include "deprecation.h"
#include "key_io.h"
#include "keystore.h"
#include "main.h"
@@ -872,9 +873,12 @@ 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);
// Grab the current consensus branch ID
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
auto consensusBranchId = CurrentEpochBranchId(chainHeight, Params().GetConsensus());
// Script verification errors
UniValue vErrors(UniValue::VARR);