fix `comment` handling

This commit is contained in:
Matias Alejo Garcia 2014-08-06 15:56:17 -03:00
parent afde77e575
commit ddc8649bd3
4 changed files with 8 additions and 6 deletions

View File

@ -11,7 +11,7 @@ var buffertools = bitcore.buffertools;
var preconditions = require('preconditions').instance(); var preconditions = require('preconditions').instance();
var VERSION = 1; var VERSION = 1;
var CORE_FIELDS = ['builderObj', 'inputChainPaths', 'version']; var CORE_FIELDS = ['builderObj', 'inputChainPaths', 'version', 'comment'];
function TxProposal(opts) { function TxProposal(opts) {

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
var imports = require('soop').imports();
var bitcore = require('bitcore'); var bitcore = require('bitcore');
function FakeBlockchain(opts) { function FakeBlockchain(opts) {
@ -47,4 +46,4 @@ FakeBlockchain.prototype.sendRawTransaction = function(rawtx, cb) {
return cb(txid); return cb(txid);
}; };
module.exports = require('soop')(FakeBlockchain); module.exports = FakeBlockchain;

View File

@ -98,11 +98,13 @@ describe('TxProposal', function() {
createdTs: 1, createdTs: 1,
builder: b, builder: b,
inputChainPaths: 'm/1', inputChainPaths: 'm/1',
comment: 'hola',
}); });
var o = txp.toObjTrim(); var o = txp.toObjTrim();
should.exist(o); should.exist(o);
should.not.exist(o.creator); should.not.exist(o.creator);
should.not.exist(o.builder); should.not.exist(o.builder);
should.exist(o.comment);
should.exist(o.builderObj); should.exist(o.builderObj);
}); });
@ -256,7 +258,7 @@ describe('TxProposal', function() {
it('with less signatures', function() { it('with less signatures', function() {
var backup = txp.builder.vanilla.scriptSig[0]; var backup = txp.builder.vanilla.scriptSig[0];
txp.builder.merge = function() { txp.builder.merge = function() {
// 3 signatures. // 2 signatures.
this.vanilla.scriptSig = ['0048304502207d8e832bd576c93300e53ab6cbd68641961bec60690c358fd42d8e42b7d7d687022100a1daa89923efdb4c9b615d065058d9e1644f67000694a7d0806759afa7bef19b014cad532103197599f6e209cefef07da2fddc6fe47715a70162c531ffff8e611cef23dfb70d210380a29968851f93af55e581c43d9ef9294577a439a3ca9fc2bc47d1ca2b3e9127210392dccb2ed470a45984811d6402fdca613c175f8f3e4eb8e2306e8ccd7d0aed032103a94351fecc4328bb683bf93a1aa67378374904eac5980c7966723a51897c56e32103e085eb6fa1f20b2722c16161144314070a2c316a9cae2489fd52ce5f63fff6e455ae']; this.vanilla.scriptSig = ['0048304502207d8e832bd576c93300e53ab6cbd68641961bec60690c358fd42d8e42b7d7d687022100a1daa89923efdb4c9b615d065058d9e1644f67000694a7d0806759afa7bef19b014cad532103197599f6e209cefef07da2fddc6fe47715a70162c531ffff8e611cef23dfb70d210380a29968851f93af55e581c43d9ef9294577a439a3ca9fc2bc47d1ca2b3e9127210392dccb2ed470a45984811d6402fdca613c175f8f3e4eb8e2306e8ccd7d0aed032103a94351fecc4328bb683bf93a1aa67378374904eac5980c7966723a51897c56e32103e085eb6fa1f20b2722c16161144314070a2c316a9cae2489fd52ce5f63fff6e455ae'];
this.tx.ins[0].s = new Buffer(this.vanilla.scriptSig[0], 'hex'); this.tx.ins[0].s = new Buffer(this.vanilla.scriptSig[0], 'hex');
}; };

View File

@ -106,9 +106,10 @@ describe('TxProposals', function() {
}); });
}); });
describe.skip('#merge', function() { describe.skip('#merge', function() {
it('mergeFromObj', function() { it('should merge', function() {
var txps = new TxProposals(); var txps = new TxProposals();
txps.mergeFromObj(dummyProposal.toObj()); var d = dummyProposal;
txps.merge(d.toObj(),{});
}); });
}); });
}); });