Skip to content

Commit 71c10a2

Browse files
author
Hyunsik Jeong
committed
Fix timelock test as the current behavior
In the original code, sending parcels with Timelock which are currently not possible make an empty block. But now, it will not create any blocks.
1 parent d24657e commit 71c10a2

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

test/src/integration.long/timelock.test.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe("Timelock", function() {
3333

3434
beforeEach(async function() {
3535
node = new CodeChain({
36-
argv: ["--force-sealing"],
36+
argv: ["--force-sealing", "--no-reseal-timer"],
3737
base: BASE
3838
});
3939
await node.start();
@@ -157,9 +157,10 @@ describe("Timelock", function() {
157157
value: 3
158158
});
159159

160-
expect(await node.getBestBlockNumber()).to.equal(2);
160+
expect(await node.getBestBlockNumber()).to.equal(1);
161161
await checkTx(txhash, false);
162162

163+
await node.sdk.rpc.devel.startSealing();
163164
await node.sdk.rpc.devel.startSealing();
164165

165166
expect(await node.getBestBlockNumber()).to.equal(3);
@@ -173,7 +174,7 @@ describe("Timelock", function() {
173174
value: 3
174175
});
175176

176-
for (let i = 2; i <= 3; i++) {
177+
for (let i = 1; i <= 3; i++) {
177178
expect(await node.getBestBlockNumber()).to.equal(i);
178179
await checkTx(txhash, false);
179180

@@ -278,9 +279,10 @@ describe("Timelock", function() {
278279
await node.signTransactionInput(tx, 1);
279280
await node.sendTransaction(tx, { awaitInvoice: false });
280281

281-
expect(await node.getBestBlockNumber()).to.equal(3);
282+
expect(await node.getBestBlockNumber()).to.equal(2);
282283
await checkTx(tx.hash(), false);
283284

285+
await node.sdk.rpc.devel.startSealing();
284286
await node.sdk.rpc.devel.startSealing();
285287
expect(await node.getBestBlockNumber()).to.equal(4);
286288
await checkTx(tx.hash(), false);
@@ -314,9 +316,10 @@ describe("Timelock", function() {
314316
await node.signTransactionInput(tx, 1);
315317
await node.sendTransaction(tx, { awaitInvoice: false });
316318

317-
expect(await node.getBestBlockNumber()).to.equal(3);
319+
expect(await node.getBestBlockNumber()).to.equal(2);
318320
await checkTx(tx.hash(), false);
319321

322+
await node.sdk.rpc.devel.startSealing();
320323
await node.sdk.rpc.devel.startSealing();
321324
expect(await node.getBestBlockNumber()).to.equal(4);
322325
await checkTx(tx.hash(), false);
@@ -350,9 +353,10 @@ describe("Timelock", function() {
350353
await node.signTransactionInput(tx, 1);
351354
await node.sendTransaction(tx, { awaitInvoice: false });
352355

353-
expect(await node.getBestBlockNumber()).to.equal(3);
356+
expect(await node.getBestBlockNumber()).to.equal(2);
354357
await checkTx(tx.hash(), false);
355358

359+
await node.sdk.rpc.devel.startSealing();
356360
await node.sdk.rpc.devel.startSealing();
357361
expect(await node.getBestBlockNumber()).to.equal(4);
358362
await checkTx(tx.hash(), true);
@@ -381,14 +385,15 @@ describe("Timelock", function() {
381385
await node.signTransactionInput(tx, 1);
382386
await node.sendTransaction(tx, { awaitInvoice: false });
383387

384-
expect(await node.getBestBlockNumber()).to.equal(3);
388+
expect(await node.getBestBlockNumber()).to.equal(2);
385389
await checkTx(tx.hash(), false);
386390

391+
await node.sdk.rpc.devel.startSealing();
387392
await node.sdk.rpc.devel.startSealing();
388393
expect(await node.getBestBlockNumber()).to.equal(4);
389394
await checkTx(tx.hash(), false);
390395

391-
await wait(3000);
396+
await wait(3_000);
392397

393398
await node.sdk.rpc.devel.startSealing();
394399
await node.sdk.rpc.devel.startSealing();

test/src/integration/mempool.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe("Timelock", function() {
8080

8181
beforeEach(async function() {
8282
node = new CodeChain({
83-
argv: ["--force-sealing"]
83+
argv: ["--force-sealing", "--no-reseal-timer"]
8484
});
8585
await node.start();
8686
});
@@ -133,7 +133,7 @@ describe("Timelock", function() {
133133
asset,
134134
{
135135
type: "block",
136-
value: 3
136+
value: 4
137137
},
138138
{
139139
fee: 20
@@ -144,6 +144,8 @@ describe("Timelock", function() {
144144

145145
await node.sdk.rpc.devel.startSealing();
146146
expect(await node.getBestBlockNumber()).to.equal(2);
147+
await checkTx(txhash1, false);
148+
await checkTx(txhash2, false);
147149

148150
await node.sdk.rpc.devel.startSealing();
149151
expect(await node.getBestBlockNumber()).to.equal(3);

0 commit comments

Comments
 (0)