mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 20:11:23 +00:00
Transaction: Rename hashForSignatureWitness() to hashForWitnessSignature() for consistency.
This commit is contained in:
@@ -1241,7 +1241,7 @@ public class Transaction extends ChildMessage {
|
||||
Coin value,
|
||||
SigHash hashType,
|
||||
boolean anyoneCanPay) {
|
||||
Sha256Hash hash = hashForSignatureWitness(inputIndex, scriptCode, value, hashType, anyoneCanPay);
|
||||
Sha256Hash hash = hashForWitnessSignature(inputIndex, scriptCode, value, hashType, anyoneCanPay);
|
||||
return new TransactionSignature(key.sign(hash), hashType, anyoneCanPay);
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,7 @@ public class Transaction extends ChildMessage {
|
||||
Coin value,
|
||||
SigHash hashType,
|
||||
boolean anyoneCanPay) {
|
||||
Sha256Hash hash = hashForSignatureWitness(inputIndex, scriptCode, value, hashType, anyoneCanPay);
|
||||
Sha256Hash hash = hashForWitnessSignature(inputIndex, scriptCode, value, hashType, anyoneCanPay);
|
||||
return new TransactionSignature(key.sign(hash, aesKey), hashType, anyoneCanPay);
|
||||
}
|
||||
|
||||
@@ -1278,14 +1278,14 @@ public class Transaction extends ChildMessage {
|
||||
return calculateWitnessSignature(inputIndex, key, aesKey, scriptCode.getProgram(), value, hashType, anyoneCanPay);
|
||||
}
|
||||
|
||||
public synchronized Sha256Hash hashForSignatureWitness(
|
||||
public synchronized Sha256Hash hashForWitnessSignature(
|
||||
int inputIndex,
|
||||
byte[] scriptCode,
|
||||
Coin prevValue,
|
||||
SigHash type,
|
||||
boolean anyoneCanPay) {
|
||||
int sigHash = TransactionSignature.calcSigHashValue(type, anyoneCanPay);
|
||||
return hashForSignatureWitness(inputIndex, scriptCode, prevValue, (byte) sigHash);
|
||||
return hashForWitnessSignature(inputIndex, scriptCode, prevValue, (byte) sigHash);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1303,16 +1303,16 @@ public class Transaction extends ChildMessage {
|
||||
* @param type Should be SigHash.ALL
|
||||
* @param anyoneCanPay should be false.
|
||||
*/
|
||||
public synchronized Sha256Hash hashForSignatureWitness(
|
||||
public synchronized Sha256Hash hashForWitnessSignature(
|
||||
int inputIndex,
|
||||
Script scriptCode,
|
||||
Coin prevValue,
|
||||
SigHash type,
|
||||
boolean anyoneCanPay) {
|
||||
return hashForSignatureWitness(inputIndex, scriptCode.getProgram(), prevValue, type, anyoneCanPay);
|
||||
return hashForWitnessSignature(inputIndex, scriptCode.getProgram(), prevValue, type, anyoneCanPay);
|
||||
}
|
||||
|
||||
public synchronized Sha256Hash hashForSignatureWitness(
|
||||
public synchronized Sha256Hash hashForWitnessSignature(
|
||||
int inputIndex,
|
||||
byte[] scriptCode,
|
||||
Coin prevValue,
|
||||
|
@@ -1581,7 +1581,7 @@ public class Script {
|
||||
ECKey pubkey = ECKey.fromPublicOnly(witness.getPush(1));
|
||||
Script scriptCode = new ScriptBuilder().data(ScriptBuilder.createP2PKHOutputScript(pubkey).getProgram())
|
||||
.build();
|
||||
Sha256Hash sigHash = txContainingThis.hashForSignatureWitness(scriptSigIndex, scriptCode, value,
|
||||
Sha256Hash sigHash = txContainingThis.hashForWitnessSignature(scriptSigIndex, scriptCode, value,
|
||||
signature.sigHashMode(), false);
|
||||
boolean validSig = pubkey.verify(sigHash, signature);
|
||||
if (!validSig)
|
||||
|
@@ -350,7 +350,7 @@ public class TransactionTest {
|
||||
HEX.encode(scriptCode.getProgram()));
|
||||
|
||||
assertEquals("c37af31116d1b27caf68aae9e3ac82f1477929014d5b917657d0eb49478cb670",
|
||||
tx.hashForSignatureWitness(1, scriptCode, txIn1.getValue(), Transaction.SigHash.ALL, false).toString());
|
||||
tx.hashForWitnessSignature(1, scriptCode, txIn1.getValue(), Transaction.SigHash.ALL, false).toString());
|
||||
TransactionSignature txSig1 = tx.calculateWitnessSignature(1, key1,
|
||||
scriptCode, txIn1.getValue(),
|
||||
Transaction.SigHash.ALL, false);
|
||||
@@ -426,7 +426,7 @@ public class TransactionTest {
|
||||
HEX.encode(scriptCode.getProgram()));
|
||||
|
||||
assertEquals("64f3b0f4dd2bb3aa1ce8566d220cc74dda9df97d8490cc81d89d735c92e59fb6",
|
||||
tx.hashForSignatureWitness(0, scriptCode, Coin.COIN.multiply(10), Transaction.SigHash.ALL, false)
|
||||
tx.hashForWitnessSignature(0, scriptCode, Coin.COIN.multiply(10), Transaction.SigHash.ALL, false)
|
||||
.toString());
|
||||
TransactionSignature txSig = tx.calculateWitnessSignature(0, key,
|
||||
scriptCode, Coin.COIN.multiply(10),
|
||||
|
Reference in New Issue
Block a user