Search in sources :

Example 41 with LockWhitelist

use of co.rsk.peg.whitelist.LockWhitelist 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;
}
Also used : OneOffWhiteListEntry(co.rsk.peg.whitelist.OneOffWhiteListEntry) FastBridgeFederationInformation(co.rsk.peg.fastbridge.FastBridgeFederationInformation) java.util(java.util) LockWhitelistEntry(co.rsk.peg.whitelist.LockWhitelistEntry) CoinbaseInformation(co.rsk.peg.bitcoin.CoinbaseInformation) Hex(org.spongycastle.util.encoders.Hex) DataWord(org.ethereum.vm.DataWord) RskAddress(co.rsk.core.RskAddress) IOException(java.io.IOException) LockWhitelist(co.rsk.peg.whitelist.LockWhitelist) Keccak256(co.rsk.crypto.Keccak256) Repository(org.ethereum.core.Repository) UnlimitedWhiteListEntry(co.rsk.peg.whitelist.UnlimitedWhiteListEntry) ActivationConfig(org.ethereum.config.blockchain.upgrades.ActivationConfig) Script(co.rsk.bitcoinj.script.Script) Pair(org.apache.commons.lang3.tuple.Pair) BridgeConstants(co.rsk.config.BridgeConstants) co.rsk.bitcoinj.core(co.rsk.bitcoinj.core) ConsensusRule(org.ethereum.config.blockchain.upgrades.ConsensusRule) LockWhitelist(co.rsk.peg.whitelist.LockWhitelist) RskAddress(co.rsk.core.RskAddress) LockWhitelistEntry(co.rsk.peg.whitelist.LockWhitelistEntry)

Aggregations

LockWhitelist (co.rsk.peg.whitelist.LockWhitelist)41 RskAddress (co.rsk.core.RskAddress)38 Test (org.junit.Test)36 ActivationConfigsForTest (org.ethereum.config.blockchain.upgrades.ActivationConfigsForTest)34 InternalTransaction (org.ethereum.vm.program.InternalTransaction)33 MutableRepository (org.ethereum.db.MutableRepository)20 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)20 ActivationConfig (org.ethereum.config.blockchain.upgrades.ActivationConfig)19 Repository (org.ethereum.core.Repository)19 co.rsk.bitcoinj.core (co.rsk.bitcoinj.core)18 PeginInstructionsProvider (co.rsk.peg.pegininstructions.PeginInstructionsProvider)17 BtcLockSenderProvider (co.rsk.peg.btcLockSender.BtcLockSenderProvider)16 SimpleRskTransaction (co.rsk.peg.simples.SimpleRskTransaction)16 OneOffWhiteListEntry (co.rsk.peg.whitelist.OneOffWhiteListEntry)16 Block (org.ethereum.core.Block)16 Transaction (org.ethereum.core.Transaction)16 BigInteger (java.math.BigInteger)15 PegTestUtils.createBaseInputScriptThatSpendsFromTheFederation (co.rsk.peg.PegTestUtils.createBaseInputScriptThatSpendsFromTheFederation)9 PegTestUtils.createBaseRedeemScriptThatSpendsFromTheFederation (co.rsk.peg.PegTestUtils.createBaseRedeemScriptThatSpendsFromTheFederation)9 ECKey (org.ethereum.crypto.ECKey)9