@ -6064,11 +6064,14 @@ std::pair<std::string, std::string> simple_wallet::show_outputs_line(const std::
return std : : make_pair ( ostr . str ( ) , ring_str ) ;
return std : : make_pair ( ostr . str ( ) , ring_str ) ;
}
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
bool simple_wallet : : pr int _ring_members( const std : : vector < tools : : wallet2 : : pending_tx > & ptx_vector , std : : ostream & ostr )
bool simple_wallet : : pr ocess _ring_members( const std : : vector < tools : : wallet2 : : pending_tx > & ptx_vector , std : : ostream & ostr , bool verbose )
{
{
uint32_t version ;
uint32_t version ;
if ( ! try_connect_to_daemon ( false , & version ) )
if ( ! try_connect_to_daemon ( false , & version ) )
{
fail_msg_writer ( ) < < tr ( " failed to connect to daemon " ) ;
return false ;
return false ;
}
// available for RPC version 1.4 or higher
// available for RPC version 1.4 or higher
if ( version < MAKE_CORE_RPC_VERSION ( 1 , 4 ) )
if ( version < MAKE_CORE_RPC_VERSION ( 1 , 4 ) )
return true ;
return true ;
@ -6084,6 +6087,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
{
{
const cryptonote : : transaction & tx = ptx_vector [ n ] . tx ;
const cryptonote : : transaction & tx = ptx_vector [ n ] . tx ;
const tools : : wallet2 : : tx_construction_data & construction_data = ptx_vector [ n ] . construction_data ;
const tools : : wallet2 : : tx_construction_data & construction_data = ptx_vector [ n ] . construction_data ;
if ( verbose )
ostr < < boost : : format ( tr ( " \n Transaction %llu/%llu: txid=%s " ) ) % ( n + 1 ) % ptx_vector . size ( ) % cryptonote : : get_transaction_hash ( tx ) ;
ostr < < boost : : format ( tr ( " \n Transaction %llu/%llu: txid=%s " ) ) % ( n + 1 ) % ptx_vector . size ( ) % cryptonote : : get_transaction_hash ( tx ) ;
// for each input
// for each input
std : : vector < uint64_t > spent_key_height ( tx . vin . size ( ) ) ;
std : : vector < uint64_t > spent_key_height ( tx . vin . size ( ) ) ;
@ -6105,6 +6109,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
}
}
const cryptonote : : tx_source_entry & source = * sptr ;
const cryptonote : : tx_source_entry & source = * sptr ;
if ( verbose )
ostr < < boost : : format ( tr ( " \n Input %llu/%llu (%s): amount=%s " ) ) % ( i + 1 ) % tx . vin . size ( ) % epee : : string_tools : : pod_to_hex ( in_key . k_image ) % print_money ( source . amount ) ;
ostr < < boost : : format ( tr ( " \n Input %llu/%llu (%s): amount=%s " ) ) % ( i + 1 ) % tx . vin . size ( ) % epee : : string_tools : : pod_to_hex ( in_key . k_image ) % print_money ( source . amount ) ;
// convert relative offsets of ring member keys into absolute offsets (indices) associated with the amount
// convert relative offsets of ring member keys into absolute offsets (indices) associated with the amount
std : : vector < uint64_t > absolute_offsets = cryptonote : : relative_output_offsets_to_absolute ( in_key . key_offsets ) ;
std : : vector < uint64_t > absolute_offsets = cryptonote : : relative_output_offsets_to_absolute ( in_key . key_offsets ) ;
@ -6135,6 +6140,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
return false ;
return false ;
}
}
}
}
if ( verbose )
ostr < < tr ( " \n Originating block heights: " ) ;
ostr < < tr ( " \n Originating block heights: " ) ;
spent_key_height [ i ] = res . outs [ source . real_output ] . height ;
spent_key_height [ i ] = res . outs [ source . real_output ] . height ;
spent_key_txid [ i ] = res . outs [ source . real_output ] . txid ;
spent_key_txid [ i ] = res . outs [ source . real_output ] . txid ;
@ -6144,6 +6150,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
heights [ j ] = res . outs [ j ] . height ;
heights [ j ] = res . outs [ j ] . height ;
}
}
std : : pair < std : : string , std : : string > ring_str = show_outputs_line ( heights , blockchain_height , source . real_output ) ;
std : : pair < std : : string , std : : string > ring_str = show_outputs_line ( heights , blockchain_height , source . real_output ) ;
if ( verbose )
ostr < < ring_str . first < < tr ( " \n | " ) < < ring_str . second < < tr ( " | \n " ) ;
ostr < < ring_str . first < < tr ( " \n | " ) < < ring_str . second < < tr ( " | \n " ) ;
}
}
// warn if rings contain keys originating from the same tx or temporally very close block heights
// warn if rings contain keys originating from the same tx or temporally very close block heights
@ -6163,7 +6170,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
ostr
ostr
< < tr ( " \n Warning: Some input keys being spent are from " )
< < tr ( " \n Warning: Some input keys being spent are from " )
< < ( are_keys_from_same_tx ? tr ( " the same transaction " ) : tr ( " blocks that are temporally very close " ) )
< < ( are_keys_from_same_tx ? tr ( " the same transaction " ) : tr ( " blocks that are temporally very close " ) )
< < tr ( " , which can break the anonymity of ring signature . Make sure this is intentional!" ) ;
< < tr ( " , which can break the anonymity of ring signature s . Make sure this is intentional!" ) ;
}
}
ostr < < ENDL ;
ostr < < ENDL ;
}
}
@ -6604,11 +6611,8 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
float days = locked_blocks / 720.0f ;
float days = locked_blocks / 720.0f ;
prompt < < boost : : format ( tr ( " . \n This transaction (including %s change) will unlock on block %llu, in approximately %s days (assuming 2 minutes per block) " ) ) % cryptonote : : print_money ( change ) % ( ( unsigned long long ) unlock_block ) % days ;
prompt < < boost : : format ( tr ( " . \n This transaction (including %s change) will unlock on block %llu, in approximately %s days (assuming 2 minutes per block) " ) ) % cryptonote : : print_money ( change ) % ( ( unsigned long long ) unlock_block ) % days ;
}
}
if ( m_wallet - > print_ring_members ( ) )
if ( ! process_ring_members ( ptx_vector , prompt , m_wallet - > print_ring_members ( ) ) )
{
if ( ! print_ring_members ( ptx_vector , prompt ) )
return false ;
return false ;
}
bool default_ring_size = true ;
bool default_ring_size = true ;
for ( const auto & ptx : ptx_vector )
for ( const auto & ptx : ptx_vector )
{
{
@ -7064,7 +7068,7 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
if ( subaddr_indices . size ( ) > 1 )
if ( subaddr_indices . size ( ) > 1 )
prompt < < tr ( " WARNING: Outputs of multiple addresses are being used together, which might potentially compromise your privacy. \n " ) ;
prompt < < tr ( " WARNING: Outputs of multiple addresses are being used together, which might potentially compromise your privacy. \n " ) ;
}
}
if ( m_wallet - > print_ring_members ( ) & & ! print_ring_members ( ptx_vector , prompt ) )
if ( ! process_ring_members ( ptx_vector , prompt , m_wallet - > print_ring_members ( ) ) )
return true ;
return true ;
if ( ptx_vector . size ( ) > 1 ) {
if ( ptx_vector . size ( ) > 1 ) {
prompt < < boost : : format ( tr ( " Sweeping %s in %llu transactions for a total fee of %s. Is this okay? " ) ) %
prompt < < boost : : format ( tr ( " Sweeping %s in %llu transactions for a total fee of %s. Is this okay? " ) ) %
@ -7308,7 +7312,7 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
uint64_t total_fee = ptx_vector [ 0 ] . fee ;
uint64_t total_fee = ptx_vector [ 0 ] . fee ;
uint64_t total_sent = m_wallet - > get_transfer_details ( ptx_vector [ 0 ] . selected_transfers . front ( ) ) . amount ( ) ;
uint64_t total_sent = m_wallet - > get_transfer_details ( ptx_vector [ 0 ] . selected_transfers . front ( ) ) . amount ( ) ;
std : : ostringstream prompt ;
std : : ostringstream prompt ;
if ( ! pr int _ring_members( ptx_vector , prompt ) )
if ( ! pr ocess _ring_members( ptx_vector , prompt , m_wallet - > print_ring_members ( ) ) )
return true ;
return true ;
prompt < < boost : : format ( tr ( " Sweeping %s for a total fee of %s. Is this okay? " ) ) %
prompt < < boost : : format ( tr ( " Sweeping %s for a total fee of %s. Is this okay? " ) ) %
print_money ( total_sent ) %
print_money ( total_sent ) %