valid tx tests passing!
This commit is contained in:
parent
34ed503830
commit
406600720e
|
@ -74,9 +74,12 @@ Script.prototype.parse = function() {
|
|||
};
|
||||
|
||||
Script.prototype.isPushOnly = function() {
|
||||
for (var i = 0; i < this.chunks.length; i++)
|
||||
if (!Buffer.isBuffer(this.chunks[i]))
|
||||
for (var i = 0; i < this.chunks.length; i++) {
|
||||
var op = this.chunks[i];
|
||||
if (!Buffer.isBuffer(op) && op > OP_16) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -938,6 +938,7 @@ ScriptInterpreter.prototype.verifyStep3 = function(scriptSig,
|
|||
// if P2SH, scriptSig should be push-only
|
||||
if (!scriptSig.isPushOnly()) {
|
||||
console.log('3rd step: scriptSig should be push only');
|
||||
console.log();
|
||||
callback(null, false);
|
||||
return;
|
||||
}
|
||||
|
@ -1028,7 +1029,7 @@ var checkSig = ScriptInterpreter.checkSig =
|
|||
|
||||
// Verify signature
|
||||
var key = new Key();
|
||||
//pubkey = buffertools.reverse(pubkey);
|
||||
if (pubkey.length === 0) pubkey = new Buffer('00', 'hex');
|
||||
key.public = pubkey;
|
||||
|
||||
console.log('pubkey before verification: '+buffertools.toHex(key.public));
|
||||
|
|
|
@ -309,9 +309,11 @@ Key::SetPublic(Local<String> property, Local<Value> value, const AccessorInfo& i
|
|||
Key* key = node::ObjectWrap::Unwrap<Key>(info.Holder());
|
||||
Handle<Object> buffer = value->ToObject();
|
||||
const unsigned char *data = (const unsigned char*) Buffer::Data(buffer);
|
||||
ec_key_st* ret = o2i_ECPublicKey(&(key->ec), &data, Buffer::Length(buffer));
|
||||
|
||||
if (!o2i_ECPublicKey(&(key->ec), &data, Buffer::Length(buffer))) {
|
||||
if (!ret) {
|
||||
// TODO: Error
|
||||
std::cout << ret << "C++++++++++++++++++++++++++++++++++++++\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@ describe('Transaction', function() {
|
|||
var i = j;
|
||||
j += 1;
|
||||
it('should validate input #' + i, function(done) {
|
||||
console.log('inputs foreach '+i+': '+tx.serialize().toHex());
|
||||
|
||||
var outpointHash = new Buffer(input[0].length);
|
||||
input[0].copy(outpointHash);
|
||||
|
@ -96,7 +95,6 @@ describe('Transaction', function() {
|
|||
var mapKey = [input];
|
||||
var scriptPubKey = testTx.inputs[mapKey];
|
||||
if (!scriptPubKey) throw new Error('Bad test: ' + datum);
|
||||
console.log('PRE TX:'+buffertools.toHex(tx.serialize()));
|
||||
tx.verifyInput(
|
||||
i,
|
||||
scriptPubKey, {
|
||||
|
|
Loading…
Reference in New Issue