Skip to content

Commit

Permalink
start stubbing out tex detection
Browse files Browse the repository at this point in the history
  • Loading branch information
zancas committed Oct 17, 2024
1 parent 731d057 commit 80d3441
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions zingolib/src/wallet/transaction_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ mod decrypt_transaction {
use zcash_client_backend::address::{Address, UnifiedAddress};
use zcash_note_encryption::{try_output_recovery_with_ovk, Domain};
use zcash_primitives::{
memo::{Memo, MemoBytes},
transaction::{Transaction, TxId},
legacy::TransparentAddress, memo::{Memo, MemoBytes}, transaction::{Transaction, TxId}
};
use zingo_memo::{parse_zingo_memo, ParsedMemo};
use zingo_status::confirmation_status::ConfirmationStatus;
Expand Down Expand Up @@ -268,6 +267,12 @@ mod decrypt_transaction {
}
}
}
fn identify_rejection_address(
&self,
_vin: &zcash_primitives::transaction::components::TxIn<zcash_primitives::transaction::components::transparent::Authorized>
) -> Option<TransparentAddress>{
todo!();
}
async fn account_for_transparent_spending(
&self,
transaction: &Transaction,
Expand All @@ -284,8 +289,16 @@ mod decrypt_transaction {
.read()
.await
.transaction_records_by_id;
// We are the authors of the 320 transactions (that we care about), therefore
// we have the transaction that encumbered the (misanmed) "ephemeral" taddr
// with funds.
// We backtrack from the vins of every transaction to check for "ephemeral" addresses
// (from zingomemo), to determine if a given vin is the source of funds for a "tex"
// address. That is, we know the ephemeral taddrs, we simply need to check if they are
// the receiver in a given transaction. If the are then, their spend identifies a tex.
if let Some(t_bundle) = transaction.transparent_bundle() {
for vin in t_bundle.vin.iter() {
if let Some(rejection_address) = self.identify_rejection_address(vin) { dbg!(rejection_address);todo!("WOOOT!");}
// Find the prev txid that was spent
let prev_transaction_id = TxId::from_bytes(*vin.prevout.hash());
let prev_n = vin.prevout.n() as u64;
Expand Down Expand Up @@ -621,10 +634,10 @@ mod decrypt_transaction {
0 => address_from_pubkeyhash(&self.config, raw_taddr),
_nonzero => match raw_taddr{
zcash_primitives::legacy::TransparentAddress::PublicKeyHash(taddr_bytes) => crate::utils::interpret_taddr_as_tex_addr(taddr_bytes, &self.config.chain),
zcash_primitives::legacy::TransparentAddress::ScriptHash(taddr_bytes) =>
zcash_primitives::legacy::TransparentAddress::ScriptHash(_taddr_bytes) =>
// tex addresses are P2PKH only. If this is a script hash, then we were wrong about
// it being a tex.
address_from_pubkeyhash(&self.config, taddr),
todo!("This happens if someone mislabels in a zingomemo, or zingolib logic an address as \"ephemeral\"."),
},
}
}) {
Expand Down

0 comments on commit 80d3441

Please sign in to comment.