From 9fdfc8bf26e94ec230889502cc92477dbd37bde7 Mon Sep 17 00:00:00 2001 From: The3D Date: Tue, 6 Oct 2020 18:20:44 +0200 Subject: [PATCH] Added check if the reserve was already added --- contracts/lendingpool/LendingPool.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol index 1a5b8152..6016ee95 100644 --- a/contracts/lendingpool/LendingPool.sol +++ b/contracts/lendingpool/LendingPool.sol @@ -951,10 +951,14 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage require(_reservesCount < MAX_NUMBER_RESERVES, Errors.NO_MORE_RESERVES_ALLOWED); + bool reserveAlreadyAdded = _reserves[asset].id != 0 || _reservesList[0]==asset; + + if(!reserveAlreadyAdded){ _reserves[asset].id = uint8(_reservesCount); _reservesList[_reservesCount] = asset; _reservesCount++; + } } /**