some more passing tests
This commit is contained in:
parent
73874ae873
commit
a761ac91c2
|
@ -897,6 +897,7 @@ ScriptInterpreter.prototype.step = function() {
|
||||||
console.log('FALSEEEEEEEEEEEEEEEEee ' + e);
|
console.log('FALSEEEEEEEEEEEEEEEEee ' + e);
|
||||||
fSuccess = false;
|
fSuccess = false;
|
||||||
}
|
}
|
||||||
|
this.tx.verify(sig, pubkey, this.nin, subscript);
|
||||||
|
|
||||||
this.stack.pop();
|
this.stack.pop();
|
||||||
this.stack.pop();
|
this.stack.pop();
|
||||||
|
|
|
@ -84,10 +84,10 @@ function sighash(transaction, sighashType, inputNumber, subscript) {
|
||||||
.write(txcopy.toBuffer())
|
.write(txcopy.toBuffer())
|
||||||
.writeInt32LE(sighashType)
|
.writeInt32LE(sighashType)
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
console.log('actual:');
|
//console.log('actual:');
|
||||||
console.log(buf.toString('hex'));
|
//console.log(buf.toString('hex'));
|
||||||
console.log('expected:');
|
//console.log('expected:');
|
||||||
console.log('01000000019ce5586f04dd407719ab7e2ed3583583b9022f29652702cfac5ed082013461fe0000000043410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8acffffffff010000000000000000000000000001000000');
|
//console.log('01000000019ce5586f04dd407719ab7e2ed3583583b9022f29652702cfac5ed082013461fe0000000043410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8acffffffff010000000000000000000000000001000000');
|
||||||
return BufferReader(Hash.sha256sha256(buf)).readReverse();
|
return BufferReader(Hash.sha256sha256(buf)).readReverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,6 @@ function sign(transaction, keypair, nhashtype, nin, subscript) {
|
||||||
|
|
||||||
function verify(transaction, sig, pubkey, nin, subscript) {
|
function verify(transaction, sig, pubkey, nin, subscript) {
|
||||||
var hashbuf = sighash(transaction, sig.nhashtype, nin, subscript);
|
var hashbuf = sighash(transaction, sig.nhashtype, nin, subscript);
|
||||||
hashbuf = new BufferReader(hashbuf).readReverse();
|
|
||||||
console.log('actual:');
|
console.log('actual:');
|
||||||
console.log(hashbuf.toString('hex'));
|
console.log(hashbuf.toString('hex'));
|
||||||
console.log('expected:');
|
console.log('expected:');
|
||||||
|
|
|
@ -269,10 +269,11 @@ describe('ScriptInterpreter', function() {
|
||||||
script: scriptSig
|
script: scriptSig
|
||||||
}));
|
}));
|
||||||
//spendtx.addTxout(BN(0), Script());
|
//spendtx.addTxout(BN(0), Script());
|
||||||
credtx._addOutput(new Transaction.Output({
|
spendtx._addOutput(new Transaction.Output({
|
||||||
script: Script(),
|
script: Script(),
|
||||||
satoshis: 0
|
satoshis: 0
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var interp = ScriptInterpreter();
|
var interp = ScriptInterpreter();
|
||||||
console.log(scriptSig.toString() + ' ' + scriptPubkey.toString());
|
console.log(scriptSig.toString() + ' ' + scriptPubkey.toString());
|
||||||
var verified = interp.verify(scriptSig, scriptPubkey, spendtx, 0, flags);
|
var verified = interp.verify(scriptSig, scriptPubkey, spendtx, 0, flags);
|
||||||
|
|
Loading…
Reference in New Issue