chain: extend try..finally; restore consts to copy
This commit is contained in:
parent
49143b2c16
commit
d53fa0a1c5
@ -817,31 +817,33 @@ describe('Chain', function() {
|
|||||||
|
|
||||||
it('should fail to connect total fee toolarge', async () => {
|
it('should fail to connect total fee toolarge', async () => {
|
||||||
const job = await cpu.createJob();
|
const job = await cpu.createJob();
|
||||||
|
const outputs = [{ address: wallet.getAddress(), value: 0 }];
|
||||||
|
|
||||||
Selector.MAX_FEE = 50 * consensus.COIN;
|
Selector.MAX_FEE = 50 * consensus.COIN;
|
||||||
|
const maxFee = Selector.MAX_FEE;
|
||||||
const outputs = [{ address: wallet.getAddress(), value: 0 }];
|
const maxMoney = consensus.MAX_MONEY;
|
||||||
const tx1 = await wallet.send({
|
|
||||||
outputs: outputs,
|
|
||||||
hardFee: Selector.MAX_FEE
|
|
||||||
});
|
|
||||||
job.pushTX(tx1.toTX());
|
|
||||||
|
|
||||||
const tx2 = await wallet.send({
|
|
||||||
outputs: outputs,
|
|
||||||
hardFee: Selector.MAX_FEE
|
|
||||||
});
|
|
||||||
job.pushTX(tx2.toTX());
|
|
||||||
|
|
||||||
consensus.MAX_MONEY = tx1.getFee() + tx2.getFee() - 1;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const tx1 = await wallet.send({
|
||||||
|
outputs: outputs,
|
||||||
|
hardFee: Selector.MAX_FEE
|
||||||
|
});
|
||||||
|
job.pushTX(tx1.toTX());
|
||||||
|
|
||||||
|
const tx2 = await wallet.send({
|
||||||
|
outputs: outputs,
|
||||||
|
hardFee: Selector.MAX_FEE
|
||||||
|
});
|
||||||
|
job.pushTX(tx2.toTX());
|
||||||
|
|
||||||
|
consensus.MAX_MONEY = tx1.getFee() + tx2.getFee() - 1;
|
||||||
|
|
||||||
job.refresh();
|
job.refresh();
|
||||||
assert.strictEqual(await mineBlock(job),
|
assert.strictEqual(await mineBlock(job),
|
||||||
'bad-txns-accumulated-fee-outofrange');
|
'bad-txns-accumulated-fee-outofrange');
|
||||||
} finally {
|
} finally {
|
||||||
consensus.MAX_MONEY = 21000000 * consensus.COIN;
|
Selector.MAX_FEE = maxFee;
|
||||||
Selector.MAX_FEE = consensus.COIN / 10;
|
consensus.MAX_MONEY = maxMoney;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user