Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a single transaction format; instead, we use the transaction format to determine the SigVersion. The consensus branch ID *does* need to be passed in from the outside, as only the caller knows the context in which the SignatureHash is being calculated (ie. mempool acceptance vs. block validation). JoinSplit signature verification has been moved into ContextualCheckTransaction, where the consensus branch ID can be obtained. The argument to the sign command for zcash-tx has been modified to take a height in addition to the optional sigtype flags.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "crypto/equihash.h"
|
||||
#include "chain.h"
|
||||
#include "chainparams.h"
|
||||
#include "consensus/upgrades.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "main.h"
|
||||
#include "miner.h"
|
||||
@@ -251,8 +252,9 @@ double benchmark_large_tx()
|
||||
}
|
||||
|
||||
// Sign for all the inputs
|
||||
auto consensusBranchId = NetworkUpgradeInfo[Consensus::UPGRADE_OVERWINTER].nBranchId;
|
||||
for (size_t i = 0; i < NUM_INPUTS; i++) {
|
||||
SignSignature(tempKeystore, prevPubKey, spending_tx, i, 1000000, SIGHASH_ALL);
|
||||
SignSignature(tempKeystore, prevPubKey, spending_tx, i, 1000000, SIGHASH_ALL, consensusBranchId);
|
||||
}
|
||||
|
||||
// Serialize:
|
||||
@@ -278,6 +280,7 @@ double benchmark_large_tx()
|
||||
prevPubKey,
|
||||
STANDARD_SCRIPT_VERIFY_FLAGS,
|
||||
TransactionSignatureChecker(&final_spending_tx, i, 1000000),
|
||||
consensusBranchId,
|
||||
&serror));
|
||||
}
|
||||
return timer_stop(tv_start);
|
||||
|
||||
Reference in New Issue
Block a user