works sometimes
This commit is contained in:
parent
10dbc073f4
commit
4092f0cb9d
6 changed files with 78 additions and 17 deletions
|
|
@ -59,10 +59,63 @@ var createPKR = function (bip32s) {
|
|||
return w;
|
||||
};
|
||||
|
||||
var vopts = {
|
||||
verifyP2SH: true,
|
||||
dontVerifyStrictEnc: true
|
||||
};
|
||||
|
||||
|
||||
describe('TxProposals model', function() {
|
||||
|
||||
it('should create an instance', function () {
|
||||
|
||||
it('verify TXs', function (done) {
|
||||
|
||||
var priv = new PrivateKey(config);
|
||||
var priv2 = new PrivateKey(config);
|
||||
var priv3 = new PrivateKey(config);
|
||||
var ts = Date.now();
|
||||
var isChange=0;
|
||||
var index=0;
|
||||
var pkr = createPKR([priv, priv2, priv3]);
|
||||
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
|
||||
|
||||
var w = new TxProposals({
|
||||
networkName: config.networkName,
|
||||
});
|
||||
unspentTest[0].address = pkr.getAddress(index, isChange).toString();
|
||||
unspentTest[0].scriptPubKey = pkr.getScriptPubKeyHex(index, isChange);
|
||||
w.add(createTx(
|
||||
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
||||
'123456789',
|
||||
unspentTest,
|
||||
opts,
|
||||
priv,
|
||||
pkr
|
||||
));
|
||||
var k = Object.keys(w.txps)[0];
|
||||
var b = w.txps[k].builder;
|
||||
var tx = b.build();
|
||||
tx.isComplete().should.equal(false);
|
||||
b.sign( priv2.getAll(pkr.addressIndex, pkr.changeAddressIndex) );
|
||||
b.sign( priv3.getAll(pkr.addressIndex, pkr.changeAddressIndex) );
|
||||
tx = b.build();
|
||||
tx.isComplete().should.equal(true);
|
||||
|
||||
var s = new Script(new Buffer(unspentTest[0].scriptPubKey,'hex'));
|
||||
|
||||
tx.verifyInput(0,s, {
|
||||
verifyP2SH: true,
|
||||
dontVerifyStrictEnc: true
|
||||
}, function(err, results){
|
||||
console.log('[test.TxProposals.js.106:err:]',err, results); //TODO
|
||||
// should.not.exist(err);
|
||||
// results.should.equal(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it.skip('should create an instance', function () {
|
||||
var w = new TxProposals({
|
||||
networkName: config.networkName
|
||||
});
|
||||
|
|
@ -104,7 +157,7 @@ describe('TxProposals model', function() {
|
|||
};
|
||||
|
||||
|
||||
it('#getUsedUnspend', function () {
|
||||
it.skip('#getUsedUnspend', function () {
|
||||
var priv = new PrivateKey(config);
|
||||
var w = new TxProposals({
|
||||
networkName: config.networkName,
|
||||
|
|
@ -128,7 +181,7 @@ describe('TxProposals model', function() {
|
|||
w.getUsedUnspent()[0].should.equal(unspentTest[0].txid);
|
||||
});
|
||||
|
||||
it('#merge with self', function () {
|
||||
it.skip('#merge with self', function () {
|
||||
var priv = new PrivateKey(config);
|
||||
var w = new TxProposals({
|
||||
networkName: config.networkName,
|
||||
|
|
@ -169,7 +222,7 @@ describe('TxProposals model', function() {
|
|||
|
||||
|
||||
|
||||
it('#merge, merge signatures case 1', function () {
|
||||
it.skip('#merge, merge signatures case 1', function () {
|
||||
var priv2 = new PrivateKey(config);
|
||||
var priv = new PrivateKey(config);
|
||||
var ts = Date.now();
|
||||
|
|
@ -244,7 +297,7 @@ var _dumpChunks = function (scriptSig, label) {
|
|||
};
|
||||
|
||||
|
||||
it('#merge, merge signatures case 2', function () {
|
||||
it.skip('#merge, merge signatures case 2', function () {
|
||||
|
||||
var priv = new PrivateKey(config);
|
||||
var priv2 = new PrivateKey(config);
|
||||
|
|
@ -346,7 +399,7 @@ var _dumpChunks = function (scriptSig, label) {
|
|||
});
|
||||
|
||||
|
||||
it('#merge, merge signatures case 3', function () {
|
||||
it.skip('#merge, merge signatures case 3', function () {
|
||||
|
||||
var priv = new PrivateKey(config);
|
||||
var priv2 = new PrivateKey(config);
|
||||
|
|
@ -443,7 +496,7 @@ var _dumpChunks = function (scriptSig, label) {
|
|||
|
||||
|
||||
|
||||
it('#toObj #fromObj roundtrip', function () {
|
||||
it.skip('#toObj #fromObj roundtrip', function () {
|
||||
|
||||
var priv = new PrivateKey(config);
|
||||
var pkr = createPKR([priv]);
|
||||
|
|
@ -496,5 +549,6 @@ var _dumpChunks = function (scriptSig, label) {
|
|||
w2.merge(w);
|
||||
Object.keys(w2.txps).length.should.equal(1);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue