Skip to content

Commit

Permalink
fix: fix dao generation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xxuejie committed May 12, 2019
1 parent a8fb137 commit 91f40ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ckb/wallet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ def generate_withdraw_from_dao_transaction(cell_out_point)
current_block = api.get_tip_header
current_block_number = current_block.number.to_i

if deposit_block_number == current_block_number
raise "You need to at least wait for 1 block before generating DAO withdraw transaction!"
end

windowleft = DAO_LOCK_PERIOD_BLOCKS - (current_block_number - deposit_block_number) % DAO_LOCK_PERIOD_BLOCKS
windowleft = DAO_MATURITY_BLOCKS if windowleft < DAO_MATURITY_BLOCKS
since = current_block_number + windowleft + 1
Expand Down

0 comments on commit 91f40ee

Please sign in to comment.