From a77bb1be8242b5de91dd56f9ea4c90e4046b677e Mon Sep 17 00:00:00 2001 From: Rabbit Date: Thu, 21 Dec 2023 11:31:21 +0800 Subject: [PATCH] fix: pending transaction income --- app/models/ckb_transaction.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/ckb_transaction.rb b/app/models/ckb_transaction.rb index a2f63c7eb..e8f6b6863 100644 --- a/app/models/ckb_transaction.rb +++ b/app/models/ckb_transaction.rb @@ -189,7 +189,11 @@ def cell_deps end def income(address) - outputs.where(address: address).sum(:capacity) - inputs.where(address: address).sum(:capacity) + if tx_pending? + cell_outputs.where(address: address).sum(:capacity) - input_cells.where(address: address).sum(:capacity) + else + outputs.where(address: address).sum(:capacity) - inputs.where(address: address).sum(:capacity) + end end def dao_transaction?