Browse Source

add back SIGHASH code to transaction

hk-custom-address
Kyle Drake 11 years ago
parent
commit
40881a7dd8
No known key found for this signature in database GPG Key ID: 8BE721072E1864BE
  1. 17
      src/transaction.js

17
src/transaction.js

@ -173,6 +173,23 @@ function (connectedScript, inIndex, hashType)
txTmp.ins[inIndex].script = connectedScript;
// Blank out some of the outputs
if ((hashType & 0x1f) == SIGHASH_NONE) {
txTmp.outs = [];
// Let the others update at will
for (var i = 0; i < txTmp.ins.length; i++)
if (i != inIndex)
txTmp.ins[i].sequence = 0;
} else if ((hashType & 0x1f) == SIGHASH_SINGLE) {
// TODO: Implement
}
// Blank out other inputs completely, not recommended for open transactions
if (hashType & SIGHASH_ANYONECANPAY) {
txTmp.ins = [txTmp.ins[inIndex]];
}
var buffer = txTmp.serialize();
buffer = buffer.concat(convert.numToBytes(parseInt(hashType),4));

Loading…
Cancel
Save