Skip to content

Commit

Permalink
Merge pull request #2105 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
rabbitz authored Jul 31, 2024
2 parents 2c5ca1e + 22a61ce commit 13f67e6
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions app/controllers/api/v2/bitcoin_vouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ def verify
bitcoin_vouts = BitcoinVout.includes(:bitcoin_transaction).
where(bitcoin_transactions: { txid: previous_vout["txid"] },
bitcoin_vouts: { index: previous_vout["index"], op_return: false })
bitcoin_vouts.each do |vout|
next if vout.unbound? || vout.normal?
next unless vout.cell_output

status =
if vout.cell_output.dead?
"normal"
elsif vout.cell_output == cell_output
"binding"
else
"unbound"
end
vout.update(consumed_by:, status:)
related_cell_outputs = bitcoin_vouts.map(&:cell_output).compact
if related_cell_outputs.all?(&:live?)
bitcoin_vouts.update_all(status: "binding")
else
bitcoin_vouts.each do |vout|
next unless vout.cell_output
next if vout.normal? || vout.unbound?

status = vout.cell_output.dead? ? "normal" : "unbound"
vout.update(consumed_by:, status:)
end
end

head :no_content
Expand Down

0 comments on commit 13f67e6

Please sign in to comment.