Skip to content

Commit

Permalink
feat: create short payload blake160 address when use correct matches
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Sep 19, 2019
1 parent b67057a commit c9bba68
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/utils/ckb_utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CkbUtilsTest < ActiveSupport::TestCase
)
end

test "#generate_address should return type1 address when use default lock script" do
test "#generate_address should return short payload blake160 address when use correct code match" do
type1_address = "ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83"
lock_script = CKB::Types::Script.generate_lock(
"0x36c329ed630d6ce750712a477543672adab57f4c",
Expand All @@ -22,6 +22,17 @@ class CkbUtilsTest < ActiveSupport::TestCase
assert_equal type1_address, CkbUtils.generate_address(lock_script)
end

test "#generate_address should return short payload blake160 address when use correct type match" do
type1_address = "ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83"
lock_script = CKB::Types::Script.generate_lock(
"0x36c329ed630d6ce750712a477543672adab57f4c",
ENV["SECP_CELL_TYPE_HASH"],
hash_type: "type"
)

assert_equal type1_address, CkbUtils.generate_address(lock_script)
end

test "#base_reward should return cellbase's first output's capacity for genesis block" do
VCR.use_cassette("genesis_block", record: :new_episodes) do
node_block = CkbSync::Api.instance.get_block_by_number(0)
Expand Down

0 comments on commit c9bba68

Please sign in to comment.