use of co.rsk.peg.whitelist.LockWhitelistEntry in project rskj by rsksmart.
the class BridgeStorageProvider method getLockWhitelist.
public LockWhitelist getLockWhitelist() {
if (lockWhitelist != null) {
return lockWhitelist;
}
Pair<HashMap<Address, OneOffWhiteListEntry>, Integer> oneOffWhitelistAndDisableBlockHeightData = safeGetFromRepository(LOCK_ONE_OFF_WHITELIST_KEY, data -> BridgeSerializationUtils.deserializeOneOffLockWhitelistAndDisableBlockHeight(data, networkParameters));
if (oneOffWhitelistAndDisableBlockHeightData == null) {
lockWhitelist = new LockWhitelist(new HashMap<>());
return lockWhitelist;
}
Map<Address, LockWhitelistEntry> whitelistedAddresses = new HashMap<>();
whitelistedAddresses.putAll(oneOffWhitelistAndDisableBlockHeightData.getLeft());
if (activations.isActive(RSKIP87)) {
whitelistedAddresses.putAll(safeGetFromRepository(LOCK_UNLIMITED_WHITELIST_KEY, data -> BridgeSerializationUtils.deserializeUnlimitedLockWhitelistEntries(data, networkParameters)));
}
lockWhitelist = new LockWhitelist(whitelistedAddresses, oneOffWhitelistAndDisableBlockHeightData.getRight());
return lockWhitelist;
}
use of co.rsk.peg.whitelist.LockWhitelistEntry in project rskj by rsksmart.
the class Bridge method getLockWhitelistEntryByAddress.
public long getLockWhitelistEntryByAddress(Object[] args) {
logger.trace("getLockWhitelistEntryByAddress");
String addressBase58;
try {
addressBase58 = (String) args[0];
} catch (Exception e) {
logger.warn("Exception in getLockWhitelistEntryByAddress", e);
return LOCK_WHITELIST_INVALID_ADDRESS_FORMAT_ERROR_CODE;
}
LockWhitelistEntry entry = bridgeSupport.getLockWhitelistEntryByAddress(addressBase58);
if (entry == null) {
// Empty string is returned when address is not found
return LOCK_WHITELIST_ENTRY_NOT_FOUND_CODE;
}
return entry.getClass() == OneOffWhiteListEntry.class ? ((OneOffWhiteListEntry) entry).maxTransferValue().getValue() : LOCK_WHITELIST_UNLIMITED_MODE_CODE;
}
Aggregations