@@ -109,6 +109,8 @@ struct OngoingSwapState {
109109 // Private key handover: store maker outgoing contract private keys (indexed by maker position)
110110 // Each maker hands over their outgoing contract private key after sweeping their incoming contract
111111 pub maker_outgoing_privkeys : Vec < Option < bitcoin:: secp256k1:: SecretKey > > ,
112+ // Here storing maker contract transaction IDs for reporting (indexed by maker position)
113+ pub maker_contract_txs : Vec < Vec < bitcoin:: Txid > > ,
112114}
113115
114116impl Default for OngoingSwapState {
@@ -166,6 +168,7 @@ impl Default for OngoingSwapState {
166168 swap_id : None ,
167169 } ,
168170 maker_outgoing_privkeys : Vec :: new ( ) ,
171+ maker_contract_txs : Vec :: new ( ) ,
169172 }
170173 }
171174}
@@ -580,12 +583,54 @@ impl Taker {
580583 println ! ( " Transaction Details" ) ;
581584 println ! ( "────────────────────────────────────────────────────────────────────────────────\x1b [0m" ) ;
582585
583- // In V2 taproot, we have one outgoing contract tx
584- let outgoing_txid = swap_state. outgoing_contract . contract_tx . compute_txid ( ) ;
585- println ! (
586- "\x1b [1;37mOutgoing Contract :\x1b [0m \x1b [2m{}\x1b [0m" ,
587- outgoing_txid
588- ) ;
586+ // Outgoing contracts section
587+
588+ println ! ( "\n \x1b [1;37mOutgoing Contracts:\x1b [0m" ) ;
589+ // Taker's outgoing contract (sent to first maker)
590+ let taker_outgoing_txid = swap_state. outgoing_contract . contract_tx . compute_txid ( ) ;
591+ println ! ( " \x1b [1;33mTaker:\x1b [0m" ) ;
592+ println ! ( " ← \x1b [2m{}\x1b [0m → " , taker_outgoing_txid) ;
593+ let mut all_outgoing_txid = vec ! [ vec![ taker_outgoing_txid. to_string( ) ] ] ;
594+ // Each maker's outgoing contracts
595+ for ( maker_index, maker_txs) in swap_state. maker_contract_txs . iter ( ) . enumerate ( ) {
596+ if !maker_txs. is_empty ( ) {
597+ println ! ( " \x1b [1;33mMaker {}:\x1b [0m" , maker_index + 1 ) ;
598+ all_outgoing_txid. push (
599+ maker_txs
600+ . iter ( )
601+ . map ( |txid| txid. to_string ( ) )
602+ . collect :: < Vec < _ > > ( )
603+ . clone ( ) ,
604+ ) ;
605+ for txid in maker_txs. iter ( ) {
606+ println ! ( " ← \x1b [2m{}\x1b [0m → " , txid) ;
607+ }
608+ }
609+ }
610+
611+ // Incoming contracts section
612+
613+ println ! ( "\n \x1b [1;37mIncoming Contracts:\x1b [0m" ) ;
614+ // First maker receives taker's outgoing
615+ println ! ( " \x1b [1;33mMaker 1:\x1b [0m" ) ;
616+ println ! ( " → \x1b [2m{}\x1b [0m ← " , taker_outgoing_txid) ;
617+ if swap_state. maker_contract_txs . len ( ) > 1 {
618+ // For more than a single maker, the outgoing txn of maker at index `i` is the incoming txn of maker at index `i+1`
619+ for maker_index in 0 ..( swap_state. maker_contract_txs . len ( ) - 1 ) {
620+ if let Some ( maker_txs) = swap_state. maker_contract_txs . get ( maker_index) {
621+ if !maker_txs. is_empty ( ) {
622+ if let Some ( txid) = maker_txs. first ( ) {
623+ println ! ( " \x1b [1;33mMaker {}:\x1b [0m" , maker_index + 2 ) ;
624+ println ! ( " → \x1b [2m{}\x1b [0m ← " , txid) ;
625+ }
626+ }
627+ }
628+ }
629+ }
630+ // Taker receives last maker's outgoing
631+ let taker_incoming_txid = swap_state. incoming_contract . contract_tx . compute_txid ( ) ;
632+ println ! ( " \x1b [1;33mTaker:\x1b [0m" ) ;
633+ println ! ( " → \x1b [2m{}\x1b [0m ← " , taker_incoming_txid) ;
589634
590635 println ! ( "\n \x1b [1;36m────────────────────────────────────────────────────────────────────────────────" ) ;
591636 println ! ( " Fee Information" ) ;
@@ -661,7 +706,9 @@ impl Taker {
661706 . collect :: < Vec < _ > > ( ) ;
662707
663708 // For V2, we have a single funding tx (the outgoing contract)
664- let funding_txids_by_hop = vec ! [ vec![ outgoing_txid. to_string( ) ] ] ;
709+ let funding_txids_by_hop = all_outgoing_txid;
710+ let total_funding_txs = funding_txids_by_hop. len ( ) ;
711+ println ! ( "funding_txids_by_hop: {:?}" , funding_txids_by_hop) ;
665712
666713 let report = SwapReport {
667714 swap_id : swap_state. id . clone ( ) ,
@@ -671,7 +718,7 @@ impl Taker {
671718 total_output_amount,
672719 makers_count : swap_state. swap_params . maker_count ,
673720 maker_addresses,
674- total_funding_txs : 1 ,
721+ total_funding_txs,
675722 funding_txids_by_hop,
676723 total_fee,
677724 total_maker_fees,
@@ -829,6 +876,7 @@ impl Taker {
829876 // Initialize storage for maker private keys received during handover
830877 let chosen_makers_count = self . ongoing_swap_state . chosen_makers . len ( ) ;
831878 self . ongoing_swap_state . maker_outgoing_privkeys = vec ! [ None ; chosen_makers_count] ;
879+ self . ongoing_swap_state . maker_contract_txs = vec ! [ Vec :: new( ) ; chosen_makers_count] ;
832880
833881 Ok ( ( ) )
834882 }
@@ -1101,6 +1149,8 @@ impl Taker {
11011149
11021150 match response {
11031151 Ok ( MakerToTakerMessage :: SenderContractFromMaker ( incoming_contract) ) => {
1152+ self . ongoing_swap_state . maker_contract_txs [ 0 ] =
1153+ incoming_contract. contract_txs . clone ( ) ;
11041154 self . forward_contracts_and_coordinate_sweep ( incoming_contract) ?;
11051155 }
11061156 _ => {
@@ -1174,6 +1224,8 @@ impl Taker {
11741224
11751225 match maker_response {
11761226 Ok ( MakerToTakerMessage :: SenderContractFromMaker ( maker_contract) ) => {
1227+ self . ongoing_swap_state . maker_contract_txs [ maker_index] =
1228+ maker_contract. contract_txs . clone ( ) ;
11771229 #[ cfg( feature = "integration-test" ) ]
11781230 {
11791231 if self . behavior == TakerBehavior :: CloseAtSendersContractFromMaker {
0 commit comments