Skip to content

Commit

Permalink
fix: update best block's address balance and tx count
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Jun 28, 2019
1 parent 5a51fbd commit 04ccaf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/models/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def authenticate!
update!(status: "authentic")
SyncInfo.find_by!(name: "authentic_tip_block_number", value: number).update_attribute(:status, "synced")
ChangeCkbTransactionsStatusWorker.perform_async(id, "authentic")
self
end

def abandon!
Expand Down
8 changes: 4 additions & 4 deletions app/models/ckb_sync/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def validate(block_number)
ApplicationRecord.transaction do
return if local_block.blank?

local_block.verify!(node_block)
update_address_balance_and_ckb_transactions_count!(local_block)
best_block = local_block.verify!(node_block)
update_address_balance_and_ckb_transactions_count!(best_block)
end
end

Expand All @@ -20,8 +20,8 @@ def call(block_hash)
ApplicationRecord.transaction do
return if local_block.blank?

local_block.verify!(node_block)
update_address_balance_and_ckb_transactions_count!(local_block)
best_block = local_block.verify!(node_block)
update_address_balance_and_ckb_transactions_count!(best_block)
end
end

Expand Down

0 comments on commit 04ccaf8

Please sign in to comment.