fix sighash opts + add tests
This commit is contained in:
parent
f87030c6cb
commit
765d3dd658
2 changed files with 20 additions and 2 deletions
|
|
@ -107,7 +107,7 @@ inherits(Wallet, events.EventEmitter);
|
||||||
*/
|
*/
|
||||||
Wallet.builderOpts = {
|
Wallet.builderOpts = {
|
||||||
lockTime: null,
|
lockTime: null,
|
||||||
signhash: bitcore.Transaction.SIGNHASH_ALL,
|
signhash: bitcore.Transaction.SIGHASH_ALL,
|
||||||
fee: undefined,
|
fee: undefined,
|
||||||
feeSat: undefined,
|
feeSat: undefined,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -205,8 +205,26 @@ describe('Wallet model', function() {
|
||||||
f.should.throw(Error);
|
f.should.throw(Error);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#create, 1 sign', function() {
|
|
||||||
|
|
||||||
|
it('#create, check builder opts', function() {
|
||||||
|
var w = cachedCreateW2();
|
||||||
|
unspentTest[0].address = w.publicKeyRing.getAddress(1, true, w.publicKey).toString();
|
||||||
|
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(1, true, w.publicKey);
|
||||||
|
var ntxid = w.createTxSync(
|
||||||
|
'mgGJEugdPnvhmRuFdbdQcFfoFLc1XXeB79',
|
||||||
|
'123456789',
|
||||||
|
null,
|
||||||
|
unspentTest
|
||||||
|
);
|
||||||
|
var t = w.txProposals;
|
||||||
|
var opts = JSON.parse(t.txps[ntxid].builder.vanilla.opts);
|
||||||
|
opts.signhash.should.equal(1);
|
||||||
|
(opts.lockTime===null).should.be.true;
|
||||||
|
should.not.exist(opts.fee);
|
||||||
|
should.not.exist(opts.feeSat);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('#create, 1 sign', function() {
|
||||||
var w = cachedCreateW2();
|
var w = cachedCreateW2();
|
||||||
|
|
||||||
unspentTest[0].address = w.publicKeyRing.getAddress(1, true, w.publicKey).toString();
|
unspentTest[0].address = w.publicKeyRing.getAddress(1, true, w.publicKey).toString();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue