use of co.rsk.bitcoinj.core.Sha256Hash in project rskj by rsksmart.
the class BridgeState method create.
public static BridgeState create(BridgeConstants bridgeConstants, byte[] data) throws IOException {
RLPList rlpList = (RLPList) RLP.decode2(data).get(0);
byte[] btcBlockchainBestChainHeightBytes = rlpList.get(0).getRLPData();
int btcBlockchainBestChainHeight = btcBlockchainBestChainHeightBytes == null ? 0 : (new BigInteger(1, btcBlockchainBestChainHeightBytes)).intValue();
byte[] btcTxHashesAlreadyProcessedBytes = rlpList.get(1).getRLPData();
Map<Sha256Hash, Long> btcTxHashesAlreadyProcessed = BridgeSerializationUtils.deserializeMapOfHashesToLong(btcTxHashesAlreadyProcessedBytes);
byte[] btcUTXOsBytes = rlpList.get(2).getRLPData();
List<UTXO> btcUTXOs = BridgeSerializationUtils.deserializeUTXOList(btcUTXOsBytes);
byte[] rskTxsWaitingForSignaturesBytes = rlpList.get(3).getRLPData();
SortedMap<Keccak256, BtcTransaction> rskTxsWaitingForSignatures = BridgeSerializationUtils.deserializeMap(rskTxsWaitingForSignaturesBytes, bridgeConstants.getBtcParams(), false);
byte[] releaseRequestQueueBytes = rlpList.get(4).getRLPData();
ReleaseRequestQueue releaseRequestQueue = BridgeSerializationUtils.deserializeReleaseRequestQueue(releaseRequestQueueBytes, bridgeConstants.getBtcParams());
byte[] releaseTransactionSetBytes = rlpList.get(5).getRLPData();
ReleaseTransactionSet releaseTransactionSet = BridgeSerializationUtils.deserializeReleaseTransactionSet(releaseTransactionSetBytes, bridgeConstants.getBtcParams());
return new BridgeState(btcBlockchainBestChainHeight, btcTxHashesAlreadyProcessed, btcUTXOs, rskTxsWaitingForSignatures, releaseRequestQueue, releaseTransactionSet);
}
use of co.rsk.bitcoinj.core.Sha256Hash in project rskj by rsksmart.
the class LockTest method isBtcTxHashAlreadyProcessed_no.
private void isBtcTxHashAlreadyProcessed_no(int times, ExecutionStats stats) {
Sha256Hash hash = Sha256Hash.of(BigInteger.valueOf(new Random().nextLong()).toByteArray());
ABIEncoder abiEncoder = (int executionIndex) -> Bridge.IS_BTC_TX_HASH_ALREADY_PROCESSED.encode(new Object[] { Hex.toHexString(hash.getBytes()) });
executeAndAverage("isBtcTxHashAlreadyProcessed-no", times, abiEncoder, buildInitializer(), Helper.getZeroValueRandomSenderTxBuilder(), Helper.getRandomHeightProvider(10), stats);
}
Aggregations