target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testToString() { Assert.assertEquals("6 signatures pending federation (complete)", pendingFederation.toString()); PendingFederation otherPendingFederation = new PendingFederation(FederationTestUtils.getFederationMembersFromPks(100)); Assert.assertEquals("1 signatures pending federation (incomplete)", ... | @Override public String toString() { return String.format("%d signatures pending federation (%s)", members.size(), isComplete() ? "complete" : "incomplete"); } | PendingFederation { @Override public String toString() { return String.format("%d signatures pending federation (%s)", members.size(), isComplete() ? "complete" : "incomplete"); } } | PendingFederation { @Override public String toString() { return String.format("%d signatures pending federation (%s)", members.size(), isComplete() ? "complete" : "incomplete"); } PendingFederation(List<FederationMember> members); } | PendingFederation { @Override public String toString() { return String.format("%d signatures pending federation (%s)", members.size(), isComplete() ? "complete" : "incomplete"); } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boolean isComplet... | PendingFederation { @Override public String toString() { return String.format("%d signatures pending federation (%s)", members.size(), isComplete() ? "complete" : "incomplete"); } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boolean isComplet... |
@Test public void buildFederation_ok_a() { PendingFederation otherPendingFederation = new PendingFederation(FederationTestUtils.getFederationMembersFromPks(100, 200, 300, 400, 500, 600)); Federation expectedFederation = new Federation( FederationTestUtils.getFederationMembersFromPks(100, 200, 300, 400, 500, 600), Insta... | public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } } | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... |
@Test public void buildFederation_ok_b() { PendingFederation otherPendingFederation = new PendingFederation(FederationTestUtils.getFederationMembersFromPks( 100, 200, 300, 400, 500, 600, 700, 800, 900 )); Federation expectedFederation = new Federation( FederationTestUtils.getFederationMembersFromPks(100, 200, 300, 400,... | public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } } | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... |
@Test public void testGetPrivKeyBytes() { ECKey key = new ECKey(); assertNotNull(key.getPrivKeyBytes()); assertEquals(32, key.getPrivKeyBytes().length); } | @Nullable public byte[] getPrivKeyBytes() { return bigIntegerToBytes(priv, 32); } | ECKey { @Nullable public byte[] getPrivKeyBytes() { return bigIntegerToBytes(priv, 32); } } | ECKey { @Nullable public byte[] getPrivKeyBytes() { return bigIntegerToBytes(priv, 32); } ECKey(); ECKey(SecureRandom secureRandom); ECKey(@Nullable BigInteger priv, ECPoint pub); } | ECKey { @Nullable public byte[] getPrivKeyBytes() { return bigIntegerToBytes(priv, 32); } ECKey(); ECKey(SecureRandom secureRandom); ECKey(@Nullable BigInteger priv, ECPoint pub); static ECPoint compressPoint(ECPoint uncompressed); static ECPoint decompressPoint(ECPoint compressed); static ECKey fromPrivate(BigIntege... | ECKey { @Nullable public byte[] getPrivKeyBytes() { return bigIntegerToBytes(priv, 32); } ECKey(); ECKey(SecureRandom secureRandom); ECKey(@Nullable BigInteger priv, ECPoint pub); static ECPoint compressPoint(ECPoint uncompressed); static ECPoint decompressPoint(ECPoint compressed); static ECKey fromPrivate(BigIntege... |
@Test public void buildFederation_incomplete() { PendingFederation otherPendingFederation = new PendingFederation(FederationTestUtils.getFederationMembersFromPks(100)); try { otherPendingFederation.buildFederation(Instant.ofEpochMilli(12L), 0L, NetworkParameters.fromID(NetworkParameters.ID_REGTEST)); } catch (Exception... | public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } } | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... | PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFederation(List<Fe... |
@PrepareForTest({ BridgeSerializationUtils.class }) @Test public void getHash() { PowerMockito.mockStatic(BridgeSerializationUtils.class); PowerMockito.when(BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(pendingFederation)).thenReturn(new byte[] { (byte) 0xaa }); Keccak256 expectedHash = new Keccak256(H... | public Keccak256 getHash() { byte[] encoded = BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(this); return new Keccak256(HashUtil.keccak256(encoded)); } | PendingFederation { public Keccak256 getHash() { byte[] encoded = BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(this); return new Keccak256(HashUtil.keccak256(encoded)); } } | PendingFederation { public Keccak256 getHash() { byte[] encoded = BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(this); return new Keccak256(HashUtil.keccak256(encoded)); } PendingFederation(List<FederationMember> members); } | PendingFederation { public Keccak256 getHash() { byte[] encoded = BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(this); return new Keccak256(HashUtil.keccak256(encoded)); } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boolean ... | PendingFederation { public Keccak256 getHash() { byte[] encoded = BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(this); return new Keccak256(HashUtil.keccak256(encoded)); } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boolean ... |
@Test public void activations_is_set() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP124)).thenReturn(true); BridgeSupport bridgeSupport = getBridgeSupport( mock(BridgeConstants.class), mock(BridgeStorageProvider.class), mock(Repository.cla... | @VisibleForTesting ActivationConfig.ForBlock getActivations() { return this.activations; } | BridgeSupport { @VisibleForTesting ActivationConfig.ForBlock getActivations() { return this.activations; } } | BridgeSupport { @VisibleForTesting ActivationConfig.ForBlock getActivations() { return this.activations; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eventLogger,
BtcLockSenderProvider btcLockSenderProvider,
... | BridgeSupport { @VisibleForTesting ActivationConfig.ForBlock getActivations() { return this.activations; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eventLogger,
BtcLockSenderProvider btcLockSenderProvider,
... | BridgeSupport { @VisibleForTesting ActivationConfig.ForBlock getActivations() { return this.activations; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eventLogger,
BtcLockSenderProvider btcLockSenderProvider,
... |
@Test(expected = NullPointerException.class) public void voteFeePerKbChange_nullFeeThrows() { BridgeStorageProvider provider = mock(BridgeStorageProvider.class); Transaction tx = mock(Transaction.class); BridgeConstants constants = mock(BridgeConstants.class); AddressBasedAuthorizer authorizer = mock(AddressBasedAuthor... | public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePerKb.isGreaterThan... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... |
@Test public void voteFeePerKbChange_unsuccessfulVote_unauthorized() { BridgeStorageProvider provider = mock(BridgeStorageProvider.class); Transaction tx = mock(Transaction.class); BridgeConstants constants = mock(BridgeConstants.class); AddressBasedAuthorizer authorizer = mock(AddressBasedAuthorizer.class); byte[] sen... | public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePerKb.isGreaterThan... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... |
@Test public void voteFeePerKbChange_unsuccessfulVote_negativeFeePerKb() { BridgeStorageProvider provider = mock(BridgeStorageProvider.class); Transaction tx = mock(Transaction.class); BridgeConstants constants = mock(BridgeConstants.class); AddressBasedAuthorizer authorizer = mock(AddressBasedAuthorizer.class); byte[]... | public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePerKb.isGreaterThan... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... |
@Test public void voteFeePerKbChange_unsuccessfulVote_excessiveFeePerKb() { final long MAX_FEE_PER_KB = 5_000_000L; BridgeStorageProvider provider = mock(BridgeStorageProvider.class); Transaction tx = mock(Transaction.class); BridgeConstants constants = mock(BridgeConstants.class); AddressBasedAuthorizer authorizer = m... | public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePerKb.isGreaterThan... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... |
@Test public void voteFeePerKbChange_successfulVote() { final long MAX_FEE_PER_KB = 5_000_000L; BridgeStorageProvider provider = mock(BridgeStorageProvider.class); Transaction tx = mock(Transaction.class); BridgeConstants constants = mock(BridgeConstants.class); AddressBasedAuthorizer authorizer = mock(AddressBasedAuth... | public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePerKb.isGreaterThan... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... |
@Test public void voteFeePerKbChange_successfulVoteWithFeeChange() { final long MAX_FEE_PER_KB = 5_000_000L; BridgeStorageProvider provider = mock(BridgeStorageProvider.class); Transaction tx = mock(Transaction.class); BridgeConstants constants = mock(BridgeConstants.class); AddressBasedAuthorizer authorizer = mock(Add... | public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePerKb.isGreaterThan... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... | BridgeSupport { public Integer voteFeePerKbChange(Transaction tx, Coin feePerKb) { AddressBasedAuthorizer authorizer = bridgeConstants.getFeePerKbChangeAuthorizer(); if (!authorizer.isAuthorized(tx)) { return FEE_PER_KB_GENERIC_ERROR_CODE; } if(!feePerKb.isPositive()){ return NEGATIVE_FEE_PER_KB_ERROR_CODE; } if(feePer... |
@Test public void getLockingCap() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP134)).thenReturn(true); BridgeConstants constants = mock(BridgeConstants.class); when(constants.getInitialLockingCap()).thenReturn(Coin.SATOSHI); BridgeStorageP... | public Coin getLockingCap() { if (activations.isActive(ConsensusRule.RSKIP134) && this.provider.getLockingCap() == null) { logger.debug("Setting initial locking cap value"); this.provider.setLockingCap(bridgeConstants.getInitialLockingCap()); } return this.provider.getLockingCap(); } | BridgeSupport { public Coin getLockingCap() { if (activations.isActive(ConsensusRule.RSKIP134) && this.provider.getLockingCap() == null) { logger.debug("Setting initial locking cap value"); this.provider.setLockingCap(bridgeConstants.getInitialLockingCap()); } return this.provider.getLockingCap(); } } | BridgeSupport { public Coin getLockingCap() { if (activations.isActive(ConsensusRule.RSKIP134) && this.provider.getLockingCap() == null) { logger.debug("Setting initial locking cap value"); this.provider.setLockingCap(bridgeConstants.getInitialLockingCap()); } return this.provider.getLockingCap(); } BridgeSupport(
... | BridgeSupport { public Coin getLockingCap() { if (activations.isActive(ConsensusRule.RSKIP134) && this.provider.getLockingCap() == null) { logger.debug("Setting initial locking cap value"); this.provider.setLockingCap(bridgeConstants.getInitialLockingCap()); } return this.provider.getLockingCap(); } BridgeSupport(
... | BridgeSupport { public Coin getLockingCap() { if (activations.isActive(ConsensusRule.RSKIP134) && this.provider.getLockingCap() == null) { logger.debug("Setting initial locking cap value"); this.provider.setLockingCap(bridgeConstants.getInitialLockingCap()); } return this.provider.getLockingCap(); } BridgeSupport(
... |
@Test public void testIsIn20PercentRange() { assertTrue(isIn20PercentRange(BigInteger.valueOf(20000), BigInteger.valueOf(24000))); assertTrue(isIn20PercentRange(BigInteger.valueOf(24000), BigInteger.valueOf(20000))); assertFalse(isIn20PercentRange(BigInteger.valueOf(20000), BigInteger.valueOf(25000))); assertTrue(isIn2... | public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } } | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } } | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } static boolean isZero(BigInteger value); static boolean isEqual(BigInteger valueA, BigInteger valueB);... | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } static boolean isZero(BigInteger value); static boolean isEqual(BigInteger valueA, BigInteger valueB);... |
@Test public void increaseLockingCap_unauthorized() { AddressBasedAuthorizer authorizer = mock(AddressBasedAuthorizer.class); when(authorizer.isAuthorized(any(Transaction.class))).thenReturn(false); BridgeConstants constants = mock(BridgeConstants.class); when(constants.getIncreaseLockingCapAuthorizer()).thenReturn(aut... | public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Coin currentLockin... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... |
@Test public void increaseLockingCap() { Coin lastValue = Coin.COIN; BridgeStorageProvider provider = mock(BridgeStorageProvider.class); when(provider.getLockingCap()).thenReturn(lastValue); AddressBasedAuthorizer authorizer = mock(AddressBasedAuthorizer.class); when(authorizer.isAuthorized(any(Transaction.class))).the... | public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Coin currentLockin... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... | BridgeSupport { public boolean increaseLockingCap(Transaction tx, Coin newCap) { AddressBasedAuthorizer authorizer = bridgeConstants.getIncreaseLockingCapAuthorizer(); if (!authorizer.isAuthorized(tx)) { logger.warn("not authorized address tried to increase locking cap. Address: {}", tx.getSender()); return false; } Co... |
@Test public void isBtcTxHashAlreadyProcessed() throws IOException { BridgeConstants bridgeConstants = BridgeRegTestConstants.getInstance(); ActivationConfig.ForBlock activations = ActivationConfigsForTest.all().forBlock(0l); Sha256Hash hash1 = Sha256Hash.ZERO_HASH; Sha256Hash hash2 = Sha256Hash.wrap("00000000000000000... | public Boolean isBtcTxHashAlreadyProcessed(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).isPresent(); } | BridgeSupport { public Boolean isBtcTxHashAlreadyProcessed(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).isPresent(); } } | BridgeSupport { public Boolean isBtcTxHashAlreadyProcessed(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).isPresent(); } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eve... | BridgeSupport { public Boolean isBtcTxHashAlreadyProcessed(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).isPresent(); } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eve... | BridgeSupport { public Boolean isBtcTxHashAlreadyProcessed(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).isPresent(); } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eve... |
@Test public void getBtcTxHashProcessedHeight() throws IOException { BridgeConstants bridgeConstants = BridgeRegTestConstants.getInstance(); ActivationConfig.ForBlock activations = ActivationConfigsForTest.all().forBlock(0l); Sha256Hash hash1 = Sha256Hash.ZERO_HASH; Sha256Hash hash2 = Sha256Hash.wrap("00000000000000000... | public Long getBtcTxHashProcessedHeight(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).orElse(-1L); } | BridgeSupport { public Long getBtcTxHashProcessedHeight(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).orElse(-1L); } } | BridgeSupport { public Long getBtcTxHashProcessedHeight(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).orElse(-1L); } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eventL... | BridgeSupport { public Long getBtcTxHashProcessedHeight(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).orElse(-1L); } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eventL... | BridgeSupport { public Long getBtcTxHashProcessedHeight(Sha256Hash btcTxHash) throws IOException { return provider.getHeightIfBtcTxhashIsAlreadyProcessed(btcTxHash).orElse(-1L); } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provider,
BridgeEventLogger eventL... |
@Test public void eventLoggerLogLockBtc_before_rskip_146_activation() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP146)).thenReturn(false); BridgeEventLogger mockedEventLogger = mock(BridgeEventLogger.class); BridgeStorage... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void eventLoggerLogLockBtc_after_rskip_146_activation() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP146)).thenReturn(true); BridgeEventLogger mockedEventLogger = mock(BridgeEventLogger.class); BridgeStoragePr... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void rskTxWaitingForSignature_uses_updateCollection_rskTxHash_before_rskip_146_activation() throws IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP146)).thenReturn(false); BridgeConstants spiedBridgeConstants = spy(Br... | public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } } | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... |
@Test public void rskTxWaitingForSignature_uses_updateCollection_rskTxHash_after_rskip_146_activation_if_release_transaction_doesnt_have_rstTxHash() throws IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP146)).thenReturn(true); Br... | public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } } | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... |
@Test public void rskTxWaitingForSignature_uses_release_transaction_rstTxHash_after_rskip_146_activation() throws IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP146)).thenReturn(true); BridgeConstants spiedBridgeConstants = spy(B... | public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } } | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public void updateCollections(Transaction rskTx) throws IOException { Context.propagate(btcContext); eventLogger.logUpdateCollections(rskTx); processFundsMigration(rskTx); processReleaseRequests(); processReleaseTransactions(rskTx); } BridgeSupport(
BridgeConstants bridgeConstants,
... |
@Test public void when_registerBtcTransaction_sender_not_recognized_no_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arrays.asList( BtcECKey.from... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void test1() { assertFalse(isIn20PercentRange(BigInteger.ONE, BigInteger.valueOf(5))); assertTrue(isIn20PercentRange(BigInteger.valueOf(5), BigInteger.ONE)); assertTrue(isIn20PercentRange(BigInteger.valueOf(5), BigInteger.valueOf(6))); assertFalse(isIn20PercentRange(BigInteger.valueOf(5), BigInteger.valueO... | public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } } | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } } | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } static boolean isZero(BigInteger value); static boolean isEqual(BigInteger valueA, BigInteger valueB);... | BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } static boolean isZero(BigInteger value); static boolean isEqual(BigInteger valueA, BigInteger valueB);... |
@Test public void when_registerBtcTransaction_usesLegacyType_beforeFork_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); List<BtcECKey> federation1Keys = Arrays.asList( BtcECKey.fr... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesLegacyType_afterFork_notWhitelisted_no_lock_and_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arrays.asList... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesLegacyType_afterFork_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arrays.asList( BtcECKey.from... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesSegCompatibilityType_beforeFork_no_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); List<BtcECKey> federation1Keys = Arrays.asList... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesSegCompatibilityType_afterFork_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arrays.asList( Btc... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesSegCompatibilityType_afterFork_notWhitelisted_no_lock_and_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arr... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesMultisigType_beforeFork_no_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); List<BtcECKey> federation1Keys = Arrays.asList( BtcECK... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesMultisigType_afterFork_no_lock_and_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arrays.asList( BtcECKey.fr... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesMultisigWithWitnessType_beforeFork_no_lock_and_no_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); List<BtcECKey> federation1Keys = Arrays.asL... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void when_registerBtcTransaction_usesMultisigWithWitnessType_afterFork_no_lock_and_refund() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys = Arrays.asList( ... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void toString_Empty() { Value val = new Value(null); String str = val.toString(); assertEquals("", str); } | public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteUtil.nibb... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... |
@Test(expected = VerificationException.EmptyInputsOrOutputs.class) public void registerBtcTransaction_rejects_tx_with_witness_before_rskip_143_activation() throws BlockStoreException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSK... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void registerBtcTransaction_accepts_lock_tx_with_witness_after_rskip_143_activation() throws BlockStoreException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Keys ... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void registerBtcTransaction_rejects_tx_with_witness_and_unregistered_coinbase_after_rskip_143_activation() throws BlockStoreException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void registerBtcTransaction_rejects_tx_with_witness_and_unqual_witness_root_after_rskip_143_activation() throws BlockStoreException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository r... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void registerBtcTransaction_rejects_tx_without_witness_unequal_roots_after_rskip_143() throws BlockStoreException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = create... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void registerBtcTransaction_accepts_lock_tx_without_witness_after_rskip_143_activation() throws BlockStoreException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); List<BtcECKey> federation1Ke... | public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProcessed(btcTxHash))... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... | BridgeSupport { public void registerBtcTransaction(Transaction rskTx, byte[] btcTxSerialized, int height, byte[] pmtSerialized) throws IOException, BlockStoreException { Context.propagate(btcContext); Sha256Hash btcTxHash = BtcTransactionFormatUtils.calculateBtcTxHash(btcTxSerialized); try { if (isAlreadyBtcTxHashProce... |
@Test public void isBlockMerkleRootValid_equal_merkle_roots() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); BridgeSupport bridgeSupport = getBridgeSupport( bridgeConstants, mock(BridgeStorageProvider.class), mock(Re... | @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143)) { CoinbaseInfor... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... |
@Test public void isBlockMerkleRootValid_unequal_merkle_roots_before_rskip_143() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); BridgeSupport bridgeSupport = getBridgeSupport( bridgeConstants, mock(BridgeStorageProvi... | @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143)) { CoinbaseInfor... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... |
@Test public void isBlockMerkleRootValid_coinbase_information_null_after_rskip_143() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); BridgeStorageProvider provider = mock(BridgeStorageProvider.class); when(provider.get... | @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143)) { CoinbaseInfor... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... |
@Test public void isBlockMerkleRootValid_coinbase_information_not_null_and_unequal_mroots_after_rskip_143() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); CoinbaseInformation coinbaseInformation = new CoinbaseInformat... | @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143)) { CoinbaseInfor... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... |
@Test public void toString_SameString() { Value val = new Value("hello"); String str = val.toString(); assertEquals("hello", str); } | public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteUtil.nibb... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... |
@Test public void isBlockMerkleRootValid_coinbase_information_not_null_and_equal_mroots_after_rskip_143() { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Sha256Hash merkleRoot = PegTestUtils.createHash(1); CoinbaseInfo... | @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143)) { CoinbaseInfor... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... | BridgeSupport { @VisibleForTesting protected boolean isBlockMerkleRootValid(Sha256Hash merkleRoot, BtcBlock blockHeader) { boolean isValid = false; if (blockHeader.getMerkleRoot().equals(merkleRoot)) { logger.trace("block merkle root is valid"); isValid = true; } else { if (activations.isActive(ConsensusRule.RSKIP143))... |
@Test public void getBtcTransactionConfirmations_rejects_tx_with_witness_before_rskip_143() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); BtcTransaction tx1 = new BtcTransaction(btcParams); tx1.addO... | public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { return BTC_TRANS... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... |
@Test public void getBtcTransactionConfirmations_accepts_tx_with_witness_after_rskip_143() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); BtcTransaction tx1... | public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { return BTC_TRANS... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... |
@Test public void getBtcTransactionConfirmations_unregistered_coinbase_after_rskip_143() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); BtcTransaction tx1 =... | public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { return BTC_TRANS... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... |
@Test public void getBtcTransactionConfirmations_registered_coinbase_unequal_witnessroot_after_rskip_143() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); Bt... | public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { return BTC_TRANS... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... |
@Test public void getBtcTransactionConfirmations_tx_without_witness_unequal_roots_after_rskip_143() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); BtcTransa... | public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { return BTC_TRANS... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... |
@Test public void getBtcTransactionConfirmations_accepts_tx_without_witness_after_rskip_143() throws Exception { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); BtcTransaction ... | public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { return BTC_TRANS... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... | BridgeSupport { public Integer getBtcTransactionConfirmations(Sha256Hash btcTxHash, Sha256Hash btcBlockHash, MerkleBranch merkleBranch) throws BlockStoreException, IOException { Context.propagate(btcContext); this.ensureBtcBlockChain(); StoredBlock block = btcBlockStore.getFromCache(btcBlockHash); if (block == null) { ... |
@Test(expected = BridgeIllegalArgumentException.class) public void when_RegisterBtcCoinbaseTransaction_wrong_witnessReservedValue_noSent() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusR... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test(expected = BridgeIllegalArgumentException.class) public void when_RegisterBtcCoinbaseTransaction_MerkleTreeWrongFormat_noSent() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.R... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test public void when_RegisterBtcCoinbaseTransaction_HashNotInPmt_noSent() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = create... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test public void toString_Array() { Value val = new Value(new String[] {"hello", "world", "!"}); String str = val.toString(); assertEquals(" ['hello', 'world', '!'] ", str); } | public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteUtil.nibb... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... |
@Test(expected = VerificationException.class) public void when_RegisterBtcCoinbaseTransaction_notVerify_noSent() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test public void when_RegisterBtcCoinbaseTransaction_not_equal_merkle_root_noSent() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test(expected = BridgeIllegalArgumentException.class) public void when_RegisterBtcCoinbaseTransaction_null_stored_block_noSent() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test public void registerBtcCoinbaseTransaction() throws BlockStoreException, AddressFormatException, IOException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); byte[] rawT... | public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransactionFormatUtils.... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... | BridgeSupport { public void registerBtcCoinbaseTransaction(byte[] btcTxSerialized, Sha256Hash blockHash, byte[] pmtSerialized, Sha256Hash witnessMerkleRoot, byte[] witnessReservedValue) throws IOException, BlockStoreException { Context.propagate(btcContext); this.ensureBtcBlockStore(); Sha256Hash btcTxHash = BtcTransac... |
@Test public void hasBtcCoinbaseTransaction_before_rskip_143_activation() throws AddressFormatException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); Repository repository = createRepository(); BridgeStorageProvider... | public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } } | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... |
@Test public void hasBtcCoinbaseTransaction_after_rskip_143_activation() throws AddressFormatException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = createRepository(); BridgeStorageProvider p... | public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } } | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... |
@Test public void hasBtcCoinbaseTransaction_fails_with_null_coinbase_information_after_rskip_143_activation() throws AddressFormatException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); Repository repository = create... | public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } } | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... | BridgeSupport { public boolean hasBtcBlockCoinbaseTransactionInformation(Sha256Hash blockHash) { CoinbaseInformation coinbaseInformation = provider.getCoinbaseInformation(blockHash); return coinbaseInformation != null; } BridgeSupport(
BridgeConstants bridgeConstants,
BridgeStorageProvider provi... |
@Test public void isAlreadyBtcTxHashProcessedHeight_true() throws IOException { Repository repository = createRepository(); BtcTransaction btcTransaction = new BtcTransaction(btcParams); BridgeStorageProvider provider = new BridgeStorageProvider(repository, PrecompiledContracts.BRIDGE_ADDR, bridgeConstants, activations... | public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } } | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } BridgeSupport(
BridgeConstants bridgeConstants,
... |
@Test public void isAlreadyBtcTxHashProcessedHeight_false() throws IOException { BtcTransaction btcTransaction = new BtcTransaction(btcParams); BridgeSupport bridgeSupport = getBridgeSupport(bridgeConstants, mock(BridgeStorageProvider.class)); Assert.assertFalse(bridgeSupport.isAlreadyBtcTxHashProcessed(btcTransaction.... | public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } } | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } BridgeSupport(
BridgeConstants bridgeConstants,
... | BridgeSupport { public boolean isAlreadyBtcTxHashProcessed(Sha256Hash btcTxHash) throws IOException { if (getBtcTxHashProcessedHeight(btcTxHash) > -1L) { logger.warn("Supplied Btc Tx {} was already processed", btcTxHash); return true; } return false; } BridgeSupport(
BridgeConstants bridgeConstants,
... |
@Test public void validationsForRegisterBtcTransaction_negative_height() throws BlockStoreException { BtcTransaction tx = new BtcTransaction(btcParams); Repository repository = createRepository(); BridgeStorageProvider provider = new BridgeStorageProvider(repository, PrecompiledContracts.BRIDGE_ADDR, bridgeConstants, a... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test public void toString_UnsupportedType() { Value val = new Value('a'); String str = val.toString(); assertEquals("Unexpected type", str); } | public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteUtil.nibb... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... | Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String keyString = ByteU... |
@Test public void validationsForRegisterBtcTransaction_insufficient_confirmations() throws IOException, BlockStoreException { BtcTransaction tx = new BtcTransaction(btcParams); BtcBlockStoreWithCache.Factory btcBlockStoreFactory = new RepositoryBtcBlockStoreWithCache.Factory(bridgeConstants.getBtcParams()); Repository ... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test(expected = BridgeIllegalArgumentException.class) public void validationsForRegisterBtcTransaction_invalid_pmt() throws IOException, BlockStoreException { BtcTransaction btcTx = new BtcTransaction(btcParams); BridgeConstants bridgeConstants = mock(BridgeConstants.class); String pmtSerializedEncoded = "030000000279... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test public void validationsForRegisterBtcTransaction_hash_not_in_pmt() throws BlockStoreException, AddressFormatException, IOException { BtcTransaction btcTx = new BtcTransaction(btcParams); BridgeConstants bridgeConstants = mock(BridgeConstants.class); byte[] bits = new byte[1]; bits[0] = 0x01; List<Sha256Hash> hash... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test(expected = VerificationException.class) public void validationsForRegisterBtcTransaction_tx_without_inputs_before_rskip_143() throws BlockStoreException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(false); BtcTransac... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test(expected = VerificationException.class) public void validationsForRegisterBtcTransaction_tx_without_inputs_after_rskip_143() throws BlockStoreException { ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class); when(activations.isActive(ConsensusRule.RSKIP143)).thenReturn(true); BtcTransacti... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test public void validationsForRegisterBtcTransaction_invalid_block_merkle_root() throws IOException, BlockStoreException { BridgeStorageProvider mockBridgeStorageProvider = mock(BridgeStorageProvider.class); when(mockBridgeStorageProvider.getHeightIfBtcTxhashIsAlreadyProcessed(any(Sha256Hash.class))).thenReturn(Optio... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test public void validationsForRegisterBtcTransaction_successful() throws IOException, BlockStoreException { BridgeStorageProvider mockBridgeStorageProvider = mock(BridgeStorageProvider.class); when(mockBridgeStorageProvider.getHeightIfBtcTxhashIsAlreadyProcessed(any(Sha256Hash.class))).thenReturn(Optional.empty()); w... | @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bridgeConstants.get... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... | BridgeSupport { @VisibleForTesting protected boolean validationsForRegisterBtcTransaction(Sha256Hash btcTxHash, int height, byte[] pmtSerialized, byte[] btcTxSerialized) throws BlockStoreException, VerificationException.EmptyInputsOrOutputs, BridgeIllegalArgumentException { try { int acceptableConfirmationsAmount = bri... |
@Test public void addSignature_fedPubKey_no_belong_to_active_federation_no_existing_retiring_fed() throws Exception { BridgeStorageProvider provider = mock(BridgeStorageProvider.class); BridgeSupport bridgeSupport = getBridgeSupport( bridgeConstants, provider, mock(Repository.class), mock(BridgeEventLogger.class), mock... | public void addSignature(BtcECKey federatorPublicKey, List<byte[]> signatures, byte[] rskTxHash) throws Exception { Context.propagate(btcContext); Federation retiringFederation = getRetiringFederation(); Federation activeFederation = getActiveFederation(); Federation federation = activeFederation.hasBtcPublicKey(federa... | BridgeSupport { public void addSignature(BtcECKey federatorPublicKey, List<byte[]> signatures, byte[] rskTxHash) throws Exception { Context.propagate(btcContext); Federation retiringFederation = getRetiringFederation(); Federation activeFederation = getActiveFederation(); Federation federation = activeFederation.hasBtc... | BridgeSupport { public void addSignature(BtcECKey federatorPublicKey, List<byte[]> signatures, byte[] rskTxHash) throws Exception { Context.propagate(btcContext); Federation retiringFederation = getRetiringFederation(); Federation activeFederation = getActiveFederation(); Federation federation = activeFederation.hasBtc... | BridgeSupport { public void addSignature(BtcECKey federatorPublicKey, List<byte[]> signatures, byte[] rskTxHash) throws Exception { Context.propagate(btcContext); Federation retiringFederation = getRetiringFederation(); Federation activeFederation = getActiveFederation(); Federation federation = activeFederation.hasBtc... | BridgeSupport { public void addSignature(BtcECKey federatorPublicKey, List<byte[]> signatures, byte[] rskTxHash) throws Exception { Context.propagate(btcContext); Federation retiringFederation = getRetiringFederation(); Federation activeFederation = getActiveFederation(); Federation federation = activeFederation.hasBtc... |
@Test public void getTransactionType_lock_tx() { BridgeSupport bridgeSupport = getBridgeSupport(bridgeConstants, mock(BridgeStorageProvider.class)); BtcTransaction btcTx = new BtcTransaction(btcParams); btcTx.addOutput(Coin.COIN.multiply(10), bridgeConstants.getGenesisFederation().getAddress()); btcTx.addInput(PegTestU... | protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGRATION; } if (Bri... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... |
@Test public void getTransactionType_release_tx() { BridgeSupport bridgeSupport = getBridgeSupport(bridgeConstants, mock(BridgeStorageProvider.class)); Federation federation = bridgeConstants.getGenesisFederation(); List<BtcECKey> federationPrivateKeys = BridgeRegTestConstants.REGTEST_FEDERATION_PRIVATE_KEYS; co.rsk.bi... | protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGRATION; } if (Bri... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... |
@Test public void isEmpty_Null() { Value val = new Value(null); assertTrue(val.isEmpty()); } | public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } } | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); } | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); static Value fromRlpEncoded(byte[] data);... | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); static Value fromRlpEncoded(byte[] data);... |
@Test public void getTransactionType_unknown_tx() { BridgeSupport bridgeSupport = getBridgeSupport(bridgeConstants, mock(BridgeStorageProvider.class)); BtcTransaction btcTx = new BtcTransaction(btcParams); Assert.assertEquals(BridgeSupport.TxType.UNKNOWN, bridgeSupport.getTransactionType(btcTx)); } | protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGRATION; } if (Bri... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... | BridgeSupport { protected TxType getTransactionType(BtcTransaction btcTx) { if (BridgeUtils.isLockTx(btcTx, getLiveFederations(), btcContext, bridgeConstants)) { return TxType.PEGIN; } if (BridgeUtils.isMigrationTx(btcTx, getActiveFederation(), getRetiringFederation(), btcContext, bridgeConstants)) { return TxType.MIGR... |
@Test public void isAuthorized() { AddressBasedAuthorizer auth = new AddressBasedAuthorizer(Arrays.asList( ECKey.fromPrivate(BigInteger.valueOf(100L)), ECKey.fromPrivate(BigInteger.valueOf(101L)), ECKey.fromPrivate(BigInteger.valueOf(102L)) ), AddressBasedAuthorizer.MinimumRequiredCalculation.MAJORITY); for (long n = 1... | public boolean isAuthorized(RskAddress sender) { return authorizedAddresses.stream() .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } | AddressBasedAuthorizer { public boolean isAuthorized(RskAddress sender) { return authorizedAddresses.stream() .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } } | AddressBasedAuthorizer { public boolean isAuthorized(RskAddress sender) { return authorizedAddresses.stream() .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } AddressBasedAuthorizer(List<ECKey> authorizedKeys, MinimumRequiredCalculation requiredCalculation); } | AddressBasedAuthorizer { public boolean isAuthorized(RskAddress sender) { return authorizedAddresses.stream() .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } AddressBasedAuthorizer(List<ECKey> authorizedKeys, MinimumRequiredCalculation requiredCalculation); boolean isAuthorized(RskAddress sender); bo... | AddressBasedAuthorizer { public boolean isAuthorized(RskAddress sender) { return authorizedAddresses.stream() .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } AddressBasedAuthorizer(List<ECKey> authorizedKeys, MinimumRequiredCalculation requiredCalculation); boolean isAuthorized(RskAddress sender); bo... |
@Test public void serializeMapOfHashesToLong() throws Exception { Map<Sha256Hash, Long> sample = new HashMap<>(); sample.put(Sha256Hash.wrap(charNTimes('b', 64)), 1L); sample.put(Sha256Hash.wrap(charNTimes('d', 64)), 2L); sample.put(Sha256Hash.wrap(charNTimes('a', 64)), 3L); sample.put(Sha256Hash.wrap(charNTimes('c', 6... | public static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map) { byte[][] bytes = new byte[map.size() * 2][]; int n = 0; List<Sha256Hash> sortedHashes = new ArrayList<>(map.keySet()); Collections.sort(sortedHashes); for (Sha256Hash hash : sortedHashes) { Long value = map.get(hash); bytes[n++] = RLP.encodeEl... | BridgeSerializationUtils { public static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map) { byte[][] bytes = new byte[map.size() * 2][]; int n = 0; List<Sha256Hash> sortedHashes = new ArrayList<>(map.keySet()); Collections.sort(sortedHashes); for (Sha256Hash hash : sortedHashes) { Long value = map.get(hash)... | BridgeSerializationUtils { public static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map) { byte[][] bytes = new byte[map.size() * 2][]; int n = 0; List<Sha256Hash> sortedHashes = new ArrayList<>(map.keySet()); Collections.sort(sortedHashes); for (Sha256Hash hash : sortedHashes) { Long value = map.get(hash)... | BridgeSerializationUtils { public static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map) { byte[][] bytes = new byte[map.size() * 2][]; int n = 0; List<Sha256Hash> sortedHashes = new ArrayList<>(map.keySet()); Collections.sort(sortedHashes); for (Sha256Hash hash : sortedHashes) { Long value = map.get(hash)... | BridgeSerializationUtils { public static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map) { byte[][] bytes = new byte[map.size() * 2][]; int n = 0; List<Sha256Hash> sortedHashes = new ArrayList<>(map.keySet()); Collections.sort(sortedHashes); for (Sha256Hash hash : sortedHashes) { Long value = map.get(hash)... |
@Test public void deserializeMapOfHashesToLong_emptyOrNull() throws Exception { assertEquals(BridgeSerializationUtils.deserializeMapOfHashesToLong(null), new HashMap<>()); assertEquals(BridgeSerializationUtils.deserializeMapOfHashesToLong(new byte[]{}), new HashMap<>()); } | public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("deserializeMapOfHashesToLong... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... |
@Test public void deserializeMapOfHashesToLong_nonEmpty() throws Exception { byte[] rlpFirstKey = RLP.encodeElement(Hex.decode(charNTimes('b', 64))); byte[] rlpSecondKey = RLP.encodeElement(Hex.decode(charNTimes('d', 64))); byte[] rlpThirdKey = RLP.encodeElement(Hex.decode(charNTimes('a', 64))); byte[] rlpFirstValue = ... | public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("deserializeMapOfHashesToLong... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... |
@Test public void deserializeMapOfHashesToLong_nonEmptyOddSize() throws Exception { byte[] rlpFirstKey = RLP.encodeElement(Hex.decode(charNTimes('b', 64))); byte[] rlpSecondKey = RLP.encodeElement(Hex.decode(charNTimes('d', 64))); byte[] rlpThirdKey = RLP.encodeElement(Hex.decode(charNTimes('a', 64))); byte[] rlpFourth... | public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("deserializeMapOfHashesToLong... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... | BridgeSerializationUtils { public static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data) { Map<Sha256Hash, Long> map = new HashMap<>(); if (data == null || data.length == 0) { return map; } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("d... |
@Test public void serializeFederationOnlyBtcKeys() throws Exception { byte[][] publicKeyBytes = new byte[][]{ BtcECKey.fromPrivate(BigInteger.valueOf(100)).getPubKey(), BtcECKey.fromPrivate(BigInteger.valueOf(200)).getPubKey(), BtcECKey.fromPrivate(BigInteger.valueOf(300)).getPubKey(), BtcECKey.fromPrivate(BigInteger.v... | public static byte[] serializeFederationOnlyBtcKeys(Federation federation) { return serializeFederationWithSerializer(federation, federationMember -> federationMember.getBtcPublicKey().getPubKeyPoint().getEncoded(true)); } | BridgeSerializationUtils { public static byte[] serializeFederationOnlyBtcKeys(Federation federation) { return serializeFederationWithSerializer(federation, federationMember -> federationMember.getBtcPublicKey().getPubKeyPoint().getEncoded(true)); } } | BridgeSerializationUtils { public static byte[] serializeFederationOnlyBtcKeys(Federation federation) { return serializeFederationWithSerializer(federation, federationMember -> federationMember.getBtcPublicKey().getPubKeyPoint().getEncoded(true)); } private BridgeSerializationUtils(); } | BridgeSerializationUtils { public static byte[] serializeFederationOnlyBtcKeys(Federation federation) { return serializeFederationWithSerializer(federation, federationMember -> federationMember.getBtcPublicKey().getPubKeyPoint().getEncoded(true)); } private BridgeSerializationUtils(); static byte[] serializeMap(Sorted... | BridgeSerializationUtils { public static byte[] serializeFederationOnlyBtcKeys(Federation federation) { return serializeFederationWithSerializer(federation, federationMember -> federationMember.getBtcPublicKey().getPubKeyPoint().getEncoded(true)); } private BridgeSerializationUtils(); static byte[] serializeMap(Sorted... |
@Test public void deserializeFederationOnlyBtcKeys_ok() throws Exception { byte[][] publicKeyBytes = Arrays.asList(100, 200, 300, 400, 500, 600).stream() .map(k -> BtcECKey.fromPrivate(BigInteger.valueOf(k))) .sorted(BtcECKey.PUBKEY_COMPARATOR) .map(k -> k.getPubKey()) .toArray(byte[][]::new); byte[][] rlpKeys = new by... | public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } } | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } private ... | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } private ... | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } private ... |
@Test public void deserializeFederationOnlyBtcKeys_wrongListSize() throws Exception { byte[] rlpFirstElement = RLP.encodeElement(Hex.decode("1388")); byte[] rlpSecondElement = RLP.encodeElement(Hex.decode("03")); byte[] rlpThirdElement = RLP.encodeElement(Hex.decode("03")); byte[] rlpFourthElement = RLP.encodeElement(H... | public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } } | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } private ... | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } private ... | BridgeSerializationUtils { public static Federation deserializeFederationOnlyBtcKeys(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, (pubKeyBytes -> FederationMember.getFederationMemberFromKey(BtcECKey.fromPublicOnly(pubKeyBytes)))); } private ... |
@Test public void serializeFederation_serializedKeysAreCompressedAndThree() { final int NUM_MEMBERS = 10; final int EXPECTED_NUM_KEYS = 3; final int EXPECTED_PUBLICKEY_SIZE = 33; List<FederationMember> members = new ArrayList<>(); for (int j = 0; j < NUM_MEMBERS; j++) { members.add(new FederationMember(new BtcECKey(), ... | public static byte[] serializeFederation(Federation federation) { return serializeFederationWithSerializer(federation, BridgeSerializationUtils::serializeFederationMember); } | BridgeSerializationUtils { public static byte[] serializeFederation(Federation federation) { return serializeFederationWithSerializer(federation, BridgeSerializationUtils::serializeFederationMember); } } | BridgeSerializationUtils { public static byte[] serializeFederation(Federation federation) { return serializeFederationWithSerializer(federation, BridgeSerializationUtils::serializeFederationMember); } private BridgeSerializationUtils(); } | BridgeSerializationUtils { public static byte[] serializeFederation(Federation federation) { return serializeFederationWithSerializer(federation, BridgeSerializationUtils::serializeFederationMember); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, BtcTransaction> map); static Sort... | BridgeSerializationUtils { public static byte[] serializeFederation(Federation federation) { return serializeFederationWithSerializer(federation, BridgeSerializationUtils::serializeFederationMember); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, BtcTransaction> map); static Sort... |
@Test public void isEmpty_EmptyString() { Value val = new Value(""); assertTrue(val.isEmpty()); } | public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } } | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); } | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); static Value fromRlpEncoded(byte[] data);... | Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); static Value fromRlpEncoded(byte[] data);... |
@Test public void deserializeFederation_wrongListSize() { byte[] serialized = RLP.encodeList(RLP.encodeElement(new byte[0]), RLP.encodeElement(new byte[0])); try { BridgeSerializationUtils.deserializeFederation(serialized, NetworkParameters.fromID(NetworkParameters.ID_REGTEST)); Assert.fail(); } catch (RuntimeException... | public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } } | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } private BridgeSerializationUtils(); } | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } private BridgeSerializationUtils(); static byte[] serializeMap(S... | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } private BridgeSerializationUtils(); static byte[] serializeMap(S... |
@Test public void deserializeFederation_invalidFederationMember() { byte[] serialized = RLP.encodeList( RLP.encodeElement(BigInteger.valueOf(1).toByteArray()), RLP.encodeElement(BigInteger.valueOf(1).toByteArray()), RLP.encodeList(RLP.encodeList(RLP.encodeElement(new byte[0]), RLP.encodeElement(new byte[0]))) ); try { ... | public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } } | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } private BridgeSerializationUtils(); } | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } private BridgeSerializationUtils(); static byte[] serializeMap(S... | BridgeSerializationUtils { public static Federation deserializeFederation(byte[] data, NetworkParameters networkParameters) { return deserializeFederationWithDesserializer(data, networkParameters, BridgeSerializationUtils::deserializeFederationMember); } private BridgeSerializationUtils(); static byte[] serializeMap(S... |
@Test public void serializePendingFederation_serializedKeysAreCompressedAndThree() { final int NUM_MEMBERS = 10; final int EXPECTED_NUM_KEYS = 3; final int EXPECTED_PUBLICKEY_SIZE = 33; List<FederationMember> members = new ArrayList<>(); for (int j = 0; j < NUM_MEMBERS; j++) { members.add(new FederationMember(new BtcEC... | public static byte[] serializePendingFederation(PendingFederation pendingFederation) { List<byte[]> encodedMembers = pendingFederation.getMembers().stream() .sorted(FederationMember.BTC_RSK_MST_PUBKEYS_COMPARATOR) .map(BridgeSerializationUtils::serializeFederationMember) .collect(Collectors.toList()); return RLP.encode... | BridgeSerializationUtils { public static byte[] serializePendingFederation(PendingFederation pendingFederation) { List<byte[]> encodedMembers = pendingFederation.getMembers().stream() .sorted(FederationMember.BTC_RSK_MST_PUBKEYS_COMPARATOR) .map(BridgeSerializationUtils::serializeFederationMember) .collect(Collectors.t... | BridgeSerializationUtils { public static byte[] serializePendingFederation(PendingFederation pendingFederation) { List<byte[]> encodedMembers = pendingFederation.getMembers().stream() .sorted(FederationMember.BTC_RSK_MST_PUBKEYS_COMPARATOR) .map(BridgeSerializationUtils::serializeFederationMember) .collect(Collectors.t... | BridgeSerializationUtils { public static byte[] serializePendingFederation(PendingFederation pendingFederation) { List<byte[]> encodedMembers = pendingFederation.getMembers().stream() .sorted(FederationMember.BTC_RSK_MST_PUBKEYS_COMPARATOR) .map(BridgeSerializationUtils::serializeFederationMember) .collect(Collectors.t... | BridgeSerializationUtils { public static byte[] serializePendingFederation(PendingFederation pendingFederation) { List<byte[]> encodedMembers = pendingFederation.getMembers().stream() .sorted(FederationMember.BTC_RSK_MST_PUBKEYS_COMPARATOR) .map(BridgeSerializationUtils::serializeFederationMember) .collect(Collectors.t... |
@Test public void deserializePendingFederation_invalidFederationMember() { byte[] serialized = RLP.encodeList( RLP.encodeList(RLP.encodeElement(new byte[0]), RLP.encodeElement(new byte[0])) ); try { BridgeSerializationUtils.deserializePendingFederation(serialized); Assert.fail(); } catch (RuntimeException e) { Assert.a... | public static PendingFederation deserializePendingFederation(byte[] data) { RLPList rlpList = (RLPList)RLP.decode2(data).get(0); List<FederationMember> members = new ArrayList<>(); for (int k = 0; k < rlpList.size(); k++) { RLPElement element = rlpList.get(k); FederationMember member = deserializeFederationMember(eleme... | BridgeSerializationUtils { public static PendingFederation deserializePendingFederation(byte[] data) { RLPList rlpList = (RLPList)RLP.decode2(data).get(0); List<FederationMember> members = new ArrayList<>(); for (int k = 0; k < rlpList.size(); k++) { RLPElement element = rlpList.get(k); FederationMember member = deseri... | BridgeSerializationUtils { public static PendingFederation deserializePendingFederation(byte[] data) { RLPList rlpList = (RLPList)RLP.decode2(data).get(0); List<FederationMember> members = new ArrayList<>(); for (int k = 0; k < rlpList.size(); k++) { RLPElement element = rlpList.get(k); FederationMember member = deseri... | BridgeSerializationUtils { public static PendingFederation deserializePendingFederation(byte[] data) { RLPList rlpList = (RLPList)RLP.decode2(data).get(0); List<FederationMember> members = new ArrayList<>(); for (int k = 0; k < rlpList.size(); k++) { RLPElement element = rlpList.get(k); FederationMember member = deseri... | BridgeSerializationUtils { public static PendingFederation deserializePendingFederation(byte[] data) { RLPList rlpList = (RLPList)RLP.decode2(data).get(0); List<FederationMember> members = new ArrayList<>(); for (int k = 0; k < rlpList.size(); k++) { RLPElement element = rlpList.get(k); FederationMember member = deseri... |
@Test public void serializePendingFederationOnlyBtcKeys() throws Exception { byte[][] publicKeyBytes = new byte[][]{ BtcECKey.fromPrivate(BigInteger.valueOf(100)).getPubKey(), BtcECKey.fromPrivate(BigInteger.valueOf(200)).getPubKey(), BtcECKey.fromPrivate(BigInteger.valueOf(300)).getPubKey(), BtcECKey.fromPrivate(BigIn... | public static byte[] serializePendingFederationOnlyBtcKeys(PendingFederation pendingFederation) { return serializeBtcPublicKeys(pendingFederation.getBtcPublicKeys()); } | BridgeSerializationUtils { public static byte[] serializePendingFederationOnlyBtcKeys(PendingFederation pendingFederation) { return serializeBtcPublicKeys(pendingFederation.getBtcPublicKeys()); } } | BridgeSerializationUtils { public static byte[] serializePendingFederationOnlyBtcKeys(PendingFederation pendingFederation) { return serializeBtcPublicKeys(pendingFederation.getBtcPublicKeys()); } private BridgeSerializationUtils(); } | BridgeSerializationUtils { public static byte[] serializePendingFederationOnlyBtcKeys(PendingFederation pendingFederation) { return serializeBtcPublicKeys(pendingFederation.getBtcPublicKeys()); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, BtcTransaction> map); static SortedMap<... | BridgeSerializationUtils { public static byte[] serializePendingFederationOnlyBtcKeys(PendingFederation pendingFederation) { return serializeBtcPublicKeys(pendingFederation.getBtcPublicKeys()); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, BtcTransaction> map); static SortedMap<... |
@Test public void deserializePendingFederationOnlyBtcKeys() throws Exception { byte[][] publicKeyBytes = Arrays.asList(100, 200, 300, 400, 500, 600).stream() .map(k -> BtcECKey.fromPrivate(BigInteger.valueOf(k))) .sorted(BtcECKey.PUBKEY_COMPARATOR) .map(k -> k.getPubKey()) .toArray(byte[][]::new); byte[][] rlpBytes = n... | public static PendingFederation deserializePendingFederationOnlyBtcKeys(byte[] data) { List<FederationMember> members = deserializeBtcPublicKeys(data).stream().map(pk -> FederationMember.getFederationMemberFromKey(pk) ).collect(Collectors.toList()); return new PendingFederation(members); } | BridgeSerializationUtils { public static PendingFederation deserializePendingFederationOnlyBtcKeys(byte[] data) { List<FederationMember> members = deserializeBtcPublicKeys(data).stream().map(pk -> FederationMember.getFederationMemberFromKey(pk) ).collect(Collectors.toList()); return new PendingFederation(members); } } | BridgeSerializationUtils { public static PendingFederation deserializePendingFederationOnlyBtcKeys(byte[] data) { List<FederationMember> members = deserializeBtcPublicKeys(data).stream().map(pk -> FederationMember.getFederationMemberFromKey(pk) ).collect(Collectors.toList()); return new PendingFederation(members); } pr... | BridgeSerializationUtils { public static PendingFederation deserializePendingFederationOnlyBtcKeys(byte[] data) { List<FederationMember> members = deserializeBtcPublicKeys(data).stream().map(pk -> FederationMember.getFederationMemberFromKey(pk) ).collect(Collectors.toList()); return new PendingFederation(members); } pr... | BridgeSerializationUtils { public static PendingFederation deserializePendingFederationOnlyBtcKeys(byte[] data) { List<FederationMember> members = deserializeBtcPublicKeys(data).stream().map(pk -> FederationMember.getFederationMemberFromKey(pk) ).collect(Collectors.toList()); return new PendingFederation(members); } pr... |
@Test public void serializeElection() throws Exception { AddressBasedAuthorizer authorizer = getTestingAddressBasedAuthorizer(); Map<ABICallSpec, List<RskAddress>> sampleVotes = new HashMap<>(); sampleVotes.put( new ABICallSpec("one-function", new byte[][]{}), Arrays.asList(createAddress("8899"), createAddress("aabb"))... | public static byte[] serializeElection(ABICallElection election) { byte[][] bytes = new byte[election.getVotes().size() * 2][]; int n = 0; Map<ABICallSpec, List<RskAddress>> votes = election.getVotes(); ABICallSpec[] specs = votes.keySet().toArray(new ABICallSpec[0]); Arrays.sort(specs, ABICallSpec.byBytesComparator); ... | BridgeSerializationUtils { public static byte[] serializeElection(ABICallElection election) { byte[][] bytes = new byte[election.getVotes().size() * 2][]; int n = 0; Map<ABICallSpec, List<RskAddress>> votes = election.getVotes(); ABICallSpec[] specs = votes.keySet().toArray(new ABICallSpec[0]); Arrays.sort(specs, ABICa... | BridgeSerializationUtils { public static byte[] serializeElection(ABICallElection election) { byte[][] bytes = new byte[election.getVotes().size() * 2][]; int n = 0; Map<ABICallSpec, List<RskAddress>> votes = election.getVotes(); ABICallSpec[] specs = votes.keySet().toArray(new ABICallSpec[0]); Arrays.sort(specs, ABICa... | BridgeSerializationUtils { public static byte[] serializeElection(ABICallElection election) { byte[][] bytes = new byte[election.getVotes().size() * 2][]; int n = 0; Map<ABICallSpec, List<RskAddress>> votes = election.getVotes(); ABICallSpec[] specs = votes.keySet().toArray(new ABICallSpec[0]); Arrays.sort(specs, ABICa... | BridgeSerializationUtils { public static byte[] serializeElection(ABICallElection election) { byte[][] bytes = new byte[election.getVotes().size() * 2][]; int n = 0; Map<ABICallSpec, List<RskAddress>> votes = election.getVotes(); ABICallSpec[] specs = votes.keySet().toArray(new ABICallSpec[0]); Arrays.sort(specs, ABICa... |
@Test public void deserializeElection_emptyOrNull() throws Exception { AddressBasedAuthorizer authorizer = getTestingAddressBasedAuthorizer(); ABICallElection election; election = BridgeSerializationUtils.deserializeElection(null, authorizer); Assert.assertEquals(0, election.getVotes().size()); election = BridgeSeriali... | public static ABICallElection deserializeElection(byte[] data, AddressBasedAuthorizer authorizer) { if (data == null || data.length == 0) { return new ABICallElection(authorizer); } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException("deserializeElection: expe... | BridgeSerializationUtils { public static ABICallElection deserializeElection(byte[] data, AddressBasedAuthorizer authorizer) { if (data == null || data.length == 0) { return new ABICallElection(authorizer); } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException... | BridgeSerializationUtils { public static ABICallElection deserializeElection(byte[] data, AddressBasedAuthorizer authorizer) { if (data == null || data.length == 0) { return new ABICallElection(authorizer); } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException... | BridgeSerializationUtils { public static ABICallElection deserializeElection(byte[] data, AddressBasedAuthorizer authorizer) { if (data == null || data.length == 0) { return new ABICallElection(authorizer); } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException... | BridgeSerializationUtils { public static ABICallElection deserializeElection(byte[] data, AddressBasedAuthorizer authorizer) { if (data == null || data.length == 0) { return new ABICallElection(authorizer); } RLPList rlpList = (RLPList) RLP.decode2(data).get(0); if (rlpList.size() % 2 != 0) { throw new RuntimeException... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.