@@ -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,48 @@ 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 ( maker_txs. iter ( ) . map ( |txid| txid. to_string ( ) ) . collect :: < Vec < _ > > ( ) . clone ( ) ) ;
599+ for txid in maker_txs. iter ( ) {
600+ println ! ( " ← \x1b [2m{}\x1b [0m → " , txid) ;
601+ }
602+ }
603+ }
604+
605+ // Incoming contracts section
606+
607+ println ! ( "\n \x1b [1;37mIncoming Contracts:\x1b [0m" ) ;
608+ // First maker receives taker's outgoing
609+ println ! ( " \x1b [1;33mMaker 1:\x1b [0m" ) ;
610+ println ! ( " → \x1b [2m{}\x1b [0m ← " , taker_outgoing_txid) ;
611+ if swap_state. maker_contract_txs . len ( ) > 1 {
612+ // For more than a single maker, the outgoing txn of maker at index `i` is the incoming txn of maker at index `i+1`
613+ for maker_index in 0 ..( swap_state. maker_contract_txs . len ( ) - 1 ) {
614+ if let Some ( maker_txs) = swap_state. maker_contract_txs . get ( maker_index) {
615+ if !maker_txs. is_empty ( ) {
616+ if let Some ( txid) = maker_txs. first ( ) {
617+ println ! ( " \x1b [1;33mMaker {}:\x1b [0m" , maker_index + 2 ) ;
618+ println ! ( " → \x1b [2m{}\x1b [0m ← " , txid) ;
619+ }
620+ }
621+ }
622+ }
623+ }
624+ // Taker receives last maker's outgoing
625+ let taker_incoming_txid = swap_state. incoming_contract . contract_tx . compute_txid ( ) ;
626+ println ! ( " \x1b [1;33mTaker:\x1b [0m" ) ;
627+ println ! ( " → \x1b [2m{}\x1b [0m ← " , taker_incoming_txid) ;
589628
590629 println ! ( "\n \x1b [1;36m────────────────────────────────────────────────────────────────────────────────" ) ;
591630 println ! ( " Fee Information" ) ;
@@ -661,7 +700,9 @@ impl Taker {
661700 . collect :: < Vec < _ > > ( ) ;
662701
663702 // For V2, we have a single funding tx (the outgoing contract)
664- let funding_txids_by_hop = vec ! [ vec![ outgoing_txid. to_string( ) ] ] ;
703+ let funding_txids_by_hop = all_outgoing_txid;
704+ let total_funding_txs = funding_txids_by_hop. len ( ) ;
705+ println ! ( "funding_txids_by_hop: {:?}" , funding_txids_by_hop) ;
665706
666707 let report = SwapReport {
667708 swap_id : swap_state. id . clone ( ) ,
@@ -671,7 +712,7 @@ impl Taker {
671712 total_output_amount,
672713 makers_count : swap_state. swap_params . maker_count ,
673714 maker_addresses,
674- total_funding_txs : 1 ,
715+ total_funding_txs,
675716 funding_txids_by_hop,
676717 total_fee,
677718 total_maker_fees,
@@ -829,6 +870,7 @@ impl Taker {
829870 // Initialize storage for maker private keys received during handover
830871 let chosen_makers_count = self . ongoing_swap_state . chosen_makers . len ( ) ;
831872 self . ongoing_swap_state . maker_outgoing_privkeys = vec ! [ None ; chosen_makers_count] ;
873+ self . ongoing_swap_state . maker_contract_txs = vec ! [ Vec :: new( ) ; chosen_makers_count] ;
832874
833875 Ok ( ( ) )
834876 }
@@ -1101,6 +1143,8 @@ impl Taker {
11011143
11021144 match response {
11031145 Ok ( MakerToTakerMessage :: SenderContractFromMaker ( incoming_contract) ) => {
1146+ self . ongoing_swap_state . maker_contract_txs [ 0 ] =
1147+ incoming_contract. contract_txs . clone ( ) ;
11041148 self . forward_contracts_and_coordinate_sweep ( incoming_contract) ?;
11051149 }
11061150 _ => {
@@ -1174,6 +1218,8 @@ impl Taker {
11741218
11751219 match maker_response {
11761220 Ok ( MakerToTakerMessage :: SenderContractFromMaker ( maker_contract) ) => {
1221+ self . ongoing_swap_state . maker_contract_txs [ maker_index] =
1222+ maker_contract. contract_txs . clone ( ) ;
11771223 #[ cfg( feature = "integration-test" ) ]
11781224 {
11791225 if self . behavior == TakerBehavior :: CloseAtSendersContractFromMaker {
0 commit comments