test broadcast fail with tx in blockchain
This commit is contained in:
parent
33827c5b18
commit
38d6ee83d3
|
@ -1662,7 +1662,7 @@ describe('Wallet service', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail to brodcast an already broadcasted tx', function(done) {
|
it('should fail to brodcast a tx already marked as broadcasted', function(done) {
|
||||||
helpers.stubBroadcast('999');
|
helpers.stubBroadcast('999');
|
||||||
server.broadcastTx({
|
server.broadcastTx({
|
||||||
txProposalId: txpid
|
txProposalId: txpid
|
||||||
|
@ -1696,6 +1696,7 @@ describe('Wallet service', function() {
|
||||||
|
|
||||||
it('should keep tx as accepted if unable to broadcast it', function(done) {
|
it('should keep tx as accepted if unable to broadcast it', function(done) {
|
||||||
helpers.stubBroadcastFail();
|
helpers.stubBroadcastFail();
|
||||||
|
blockchainExplorer.getTransaction = sinon.stub().callsArgWith(1, null, null);
|
||||||
server.broadcastTx({
|
server.broadcastTx({
|
||||||
txProposalId: txpid
|
txProposalId: txpid
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
|
@ -1713,6 +1714,28 @@ describe('Wallet service', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should mark tx as broadcasted if accepted but already in blockchain', function(done) {
|
||||||
|
helpers.stubBroadcastFail();
|
||||||
|
blockchainExplorer.getTransaction = sinon.stub().callsArgWith(1, null, {
|
||||||
|
txid: '999'
|
||||||
|
});
|
||||||
|
server.broadcastTx({
|
||||||
|
txProposalId: txpid
|
||||||
|
}, function(err) {
|
||||||
|
should.not.exist(err);
|
||||||
|
server.getTx({
|
||||||
|
txProposalId: txpid
|
||||||
|
}, function(err, txp) {
|
||||||
|
should.not.exist(err);
|
||||||
|
should.exist(txp.txid);
|
||||||
|
txp.txid.should.equal('999');
|
||||||
|
txp.isBroadcasted().should.be.true;
|
||||||
|
should.exist(txp.broadcastedOn);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Tx proposal workflow', function() {
|
describe('Tx proposal workflow', function() {
|
||||||
|
|
Loading…
Reference in New Issue