Add check on ErcToNative onFailedAffirmation method
This commit is contained in:
parent
414e437b60
commit
12d0422ca0
|
@ -97,6 +97,10 @@ contract HomeBridgeErcToNative is EternalStorage, BasicBridge, BasicHomeBridge {
|
|||
}
|
||||
|
||||
function onFailedAffirmation(address _recipient, uint256 _value, bytes32 _txHash) internal {
|
||||
address recipient;
|
||||
uint256 value;
|
||||
(recipient, value) = txAboveLimits(_txHash);
|
||||
require(value == 0);
|
||||
setOutOfLimitAmount(outOfLimitAmount().add(_value));
|
||||
setTxAboveLimits(_recipient, _value, _txHash);
|
||||
emit AmountLimitExceeded(_recipient, _value, _txHash);
|
||||
|
|
|
@ -400,6 +400,22 @@ contract('HomeBridge_ERC20_to_Native', async (accounts) => {
|
|||
transactionHash
|
||||
});
|
||||
})
|
||||
it('should fail if txHash already set as above of limits', async () => {
|
||||
const recipient = accounts[5];
|
||||
const value = oneEther;
|
||||
const transactionHash = "0x806335163828a8eda675cff9c84fa6e6c7cf06bb44cc6ec832e42fe789d01415";
|
||||
const {logs} = await homeBridge.executeAffirmation(recipient, value, transactionHash, {from: authorities[0]}).should.be.fulfilled;
|
||||
|
||||
logs[0].event.should.be.equal("AmountLimitExceeded");
|
||||
logs[0].args.should.be.deep.equal({
|
||||
recipient,
|
||||
value,
|
||||
transactionHash
|
||||
});
|
||||
|
||||
await homeBridge.executeAffirmation(recipient, value, transactionHash, {from: authorities[0]}).should.be.rejectedWith(ERROR_MSG)
|
||||
await homeBridge.executeAffirmation(accounts[6], value, transactionHash, {from: authorities[0]}).should.be.rejectedWith(ERROR_MSG)
|
||||
})
|
||||
it('should not allow execute affirmation over daily foreign limit', async () => {
|
||||
await blockRewardContract.sendTransaction({
|
||||
from: accounts[2],
|
||||
|
|
Loading…
Reference in New Issue