Auto merge of #3520 - Eirik0:3327-sign-offline, r=bitcartel

Fix signing raw transactions with unsynced offline nodes

This PR address the issue in two different ways:

- In `signrawtransaction` we determine the consensus branch ID (which we then later use to construct the transaction) using the chain height. We now also consider the `APPROX_RELEASE_HEIGHT` as this is a better estimation than 0 for the height of the chain if we are unsynced. (This in and of itself solves the Overwinter signing issue).
- We have added an additional parameter to `signrawtransaction` to allow manually overriding the consensus branch ID that zcashd determines we are on. This allows users to work around corner cases where the first strategy is still insufficient.

Closes #3327.
This commit is contained in:
Homu
2018-09-19 15:02:52 -07:00
6 changed files with 81 additions and 4 deletions

View File

@@ -82,6 +82,15 @@ uint32_t CurrentEpochBranchId(int nHeight, const Consensus::Params& params) {
return NetworkUpgradeInfo[CurrentEpoch(nHeight, params)].nBranchId;
}
bool IsConsensusBranchId(int branchId) {
for (int idx = Consensus::BASE_SPROUT; idx < Consensus::MAX_NETWORK_UPGRADES; idx++) {
if (branchId == NetworkUpgradeInfo[idx].nBranchId) {
return true;
}
}
return false;
}
bool IsActivationHeight(
int nHeight,
const Consensus::Params& params,