Skip to content
Snippets Groups Projects
Commit 54eb7f37 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1260 The chaining test was wrong

parent 89fbc1a3
No related branches found
No related tags found
1 merge request!1239Resolve "default TransactionDepth must be zero"
import {CommonConstants} from "../../app/lib/common-libs/constants" import {CommonConstants} from "../../app/lib/common-libs/constants"
import {TestUser} from "./tools/TestUser" import {TestUser} from "./tools/TestUser"
import {TestingServer} from "./tools/toolbox" import {TestingServer} from "./tools/toolbox"
import {NewLogger} from "../../app/lib/logger"
const should = require('should'); const should = require('should');
const assert = require('assert'); const assert = require('assert');
...@@ -71,9 +70,12 @@ describe("Transaction chaining", () => { ...@@ -71,9 +70,12 @@ describe("Transaction chaining", () => {
CommonConstants.TRANSACTION_MAX_TRIES = 2; CommonConstants.TRANSACTION_MAX_TRIES = 2;
await unit.shouldNotFail(toc.sendTX(tx1)); await unit.shouldNotFail(toc.sendTX(tx1));
await unit.shouldNotFail(toc.sendTX(tx2)); await unit.shouldNotFail(toc.sendTX(tx2));
(await s1.get('/tx/sources/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo')).should.have.property('sources').length(1); (await s1.get('/tx/sources/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo')).should.have.property('sources').length(1); // 1200
(await s1.get('/tx/sources/DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV')).should.have.property('sources').length(1); (await s1.get('/tx/sources/DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV')).should.have.property('sources').length(1); // 1200
await s1.commit({ time: now + 7210 }); // TX1 + TX2 commited await s1.commit({ time: now + 7210 }); // TX1 commited only
(await s1.get('/tx/sources/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo')).should.have.property('sources').length(1); // 1200 - 1040 = 160 remaining
(await s1.get('/tx/sources/DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV')).should.have.property('sources').length(2); // The UD + 1040 units sent by toc
await s1.commit({ time: now + 7210 }); // TX2 commited now (cause it couldn't be chained before)
(await s1.get('/tx/sources/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo')).should.have.property('sources').length(0); (await s1.get('/tx/sources/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo')).should.have.property('sources').length(0);
(await s1.get('/tx/sources/DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV')).should.have.property('sources').length(3); // The UD + 1040 + 160 units sent by toc (await s1.get('/tx/sources/DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV')).should.have.property('sources').length(3); // The UD + 1040 + 160 units sent by toc
CommonConstants.TRANSACTION_MAX_TRIES = tmp; CommonConstants.TRANSACTION_MAX_TRIES = tmp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment