3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 07:12:17 +00:00

Expose hashTransactionForSignature. The API will likely change in future.

This commit is contained in:
Mike Hearn 2012-02-02 18:21:28 +01:00
parent b72c170086
commit b0739df2e5

View File

@ -628,7 +628,17 @@ public class Transaction extends ChildMessage implements Serializable {
// Every input is now complete.
}
private byte[] hashTransactionForSignature(SigHash type, boolean anyoneCanPay) {
/**
* Calculates a signature hash, that is, a hash of a simplified form of the transaction. How exactly the transaction
* is simplified is specified by the type and anyoneCanPay parameters.<p>
*
* You don't normally ever need to call this yourself. It will become more useful in future as the contracts
* features of Bitcoin are developed.
*
* @param type Should be SigHash.ALL
* @param anyoneCanPay should be false.
*/
public byte[] hashTransactionForSignature(SigHash type, boolean anyoneCanPay) {
try {
ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(length == UNKNOWN_LENGTH ? 256 : length + 4);
bitcoinSerialize(bos);