コード例 #1
0
    @Test
    public void addressConstantIsConsistentWithNemesisBlock() {
      // Arrange:
      final Block block = this.loadNemesisBlock();
      final Address blockAddress = block.getSigner().getAddress();

      // Assert:
      Assert.assertThat(blockAddress, IsEqual.equalTo(NEMESIS_BLOCK_INFO.getAddress()));
      Assert.assertThat(
          blockAddress.getPublicKey(),
          IsEqual.equalTo(NEMESIS_BLOCK_INFO.getAddress().getPublicKey()));
      Assert.assertThat(blockAddress.getPublicKey(), IsNull.notNullValue());
    }
コード例 #2
0
    @Test
    public void nemesisBlockCanBeCreated() {
      // Act:
      final Block block = this.loadNemesisBlock();

      // Assert:
      Assert.assertThat(
          block.getSigner().getAddress(), IsEqual.equalTo(NEMESIS_BLOCK_INFO.getAddress()));
      Assert.assertThat(block.getType(), IsEqual.equalTo(-1));
      Assert.assertThat(block.getVersion(), IsEqual.equalTo(EXPECTED_VERSION));
      Assert.assertThat(block.getTimeStamp(), IsEqual.equalTo(TimeInstant.ZERO));

      // 2 multisig aggregate transactions
      Assert.assertThat(
          block.getTotalFee(), IsEqual.equalTo(EXPECTED_MULTISIG_AGGREGATE_FEE.multiply(2)));
      Assert.assertThat(block.getPreviousBlockHash(), IsEqual.equalTo(Hash.ZERO));
      Assert.assertThat(block.getHeight(), IsEqual.equalTo(BlockHeight.ONE));
      Assert.assertThat(block.getTransactions().size(), IsEqual.equalTo(NUM_NEMESIS_TRANSACTIONS));

      Assert.assertThat(block.getDifficulty(), IsEqual.equalTo(BlockDifficulty.INITIAL_DIFFICULTY));
      Assert.assertThat(block.getGenerationHash(), IsNull.notNullValue());
    }