lib/bitcoin/wallet/asset_handler.rb in bitcoinrb-grpc-0.1.6 vs lib/bitcoin/wallet/asset_handler.rb in bitcoinrb-grpc-0.1.7
- old
+ new
@@ -27,11 +27,10 @@
log(::Logger::DEBUG, "tx=#{tx}, open_assets?=#{tx.open_assets?}")
case
when tx.open_assets?
outputs = Bitcoin::Grpc::OapService.outputs_with_open_asset_id(message.tx_hash)
begin
- puts outputs
if outputs
outputs.each do |output|
asset_id = output['asset_id']
next unless asset_id
@@ -45,10 +44,10 @@
asset_output = utxo_db.save_token(AssetFeature::AssetType::OPEN_ASSETS, asset_id_as_hex, asset_quantity, utxo)
next unless asset_output
item_to_delete = []
- watchings.select { |item| item.asset_id == asset_id }.each do |item|
+ watchings.select { |item| item.asset_id == asset_id && tx.tx_hash == item.tx_hash }.each do |item|
if oa_output_type == 'issuance'
publisher << Bitcoin::Grpc::EventTokenIssued.new(request_id: item.id, asset: asset_output)
else
publisher << Bitcoin::Grpc::EventTokenTransfered.new(request_id: item.id, asset: asset_output)
end