Fix signingHash calls; make rsign output pre-sign hash.

This commit is contained in:
Michael Elsdörfer
2014-01-19 16:04:38 +01:00
parent 2396a53b03
commit c95d976e84
2 changed files with 3 additions and 2 deletions

View File

@@ -76,6 +76,7 @@ function sign_transaction() {
tx.complete();
var unsigned_blob = tx.serialize().to_hex();
var unsigned_hash = tx.signingHash();
tx.sign();
if (verbose) {
@@ -83,7 +84,7 @@ function sign_transaction() {
sim.tx_blob = tx.serialize().to_hex();
sim.tx_json = tx.tx_json;
sim.tx_signing_hash = tx.signing_hash().to_hex();
sim.tx_signing_hash = unsigned_hash;
sim.tx_unsigned = unsigned_blob;
console.log(JSON.stringify(sim, null, 2));

View File

@@ -280,7 +280,7 @@ Transaction.prototype.sign = function() {
var prev_sig = this.tx_json.TxnSignature;
delete this.tx_json.TxnSignature;
var hash = this.signing_hash();
var hash = this.signingHash();
// If the hash is the same, we can re-use the previous signature
if (prev_sig && hash === this.previousSigningHash) {