Skip to content

Commit ee32130

Browse files
committed
carrot+fcmp: hot/cold wallet support
1 parent a579b72 commit ee32130

26 files changed

+4310
-1456
lines changed

src/carrot_core/config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,10 @@ static constexpr const unsigned char CARROT_DOMAIN_SEP_SUBADDRESS_SCALAR[] = "Ca
6969
// Carrot misc constants
7070
static constexpr const unsigned int CARROT_MIN_TX_OUTPUTS = 2;
7171
static constexpr const unsigned int CARROT_MIN_TX_INPUTS = 1;
72+
73+
// Downstream hot/cold protocol domain separators
74+
static constexpr const unsigned char HOT_COLD_DOMAIN_SEP_NORMAL_JANUS_ANCHOR[] = "Carrot Hot-cold normal janus anchor";
75+
static constexpr const unsigned char HOT_COLD_DOMAIN_SEP_SPECIAL_EPHEM[] = "Carrot Hot-cold special ephemeral privkey";
76+
static constexpr const unsigned char HOT_COLD_DOMAIN_SEP_DUMMY_PID[] = "Carrot Hot-cold dummy encrypted payment id";
77+
static constexpr const unsigned char HOT_COLD_DOMAIN_SEP_RERANDOMIZATION[] = "Carrot Hot-cold rerandomization scalar";
7278
} //namespace carrot

src/debug_utilities/object_sizes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int main(int argc, char* argv[])
105105
SL(tools::wallet2::confirmed_transfer_details);
106106
SL(tools::wallet2::tx_construction_data);
107107
SL(tools::wallet2::pending_tx);
108-
SL(tools::wallet2::unsigned_tx_set);
108+
SL(tools::wallet::cold::UnsignedTransactionSetVariant);
109109
SL(tools::wallet2::signed_tx_set);
110110

111111
SL(Monero::WalletImpl);

src/simplewallet/simplewallet.cpp

Lines changed: 111 additions & 75 deletions
Large diffs are not rendered by default.

src/simplewallet/simplewallet.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ namespace cryptonote
265265
uint64_t get_daemon_blockchain_height(std::string& err);
266266
bool try_connect_to_daemon(bool silent = false, uint32_t* version = nullptr);
267267
bool ask_wallet_create_if_needed();
268-
bool accept_loaded_tx(const std::function<size_t()> get_num_txes, const std::function<const tools::wallet2::tx_construction_data&(size_t)> &get_tx, const std::string &extra_message = std::string());
269-
bool accept_loaded_tx(const tools::wallet2::unsigned_tx_set &txs);
268+
bool accept_loaded_tx(const std::function<size_t()> get_num_txes, const std::function<tools::wallet::tx_reconstruct_variant_t(size_t)> &get_tx, const std::string &extra_message = std::string());
269+
bool accept_loaded_tx(const tools::wallet::cold::UnsignedPreCarrotTransactionSet &txs);
270+
bool accept_loaded_tx(const tools::wallet::cold::UnsignedCarrotTransactionSetV1 &txs);
271+
bool accept_loaded_tx(const tools::wallet::cold::UnsignedTransactionSetVariant &txs);
270272
bool accept_loaded_tx(const tools::wallet2::signed_tx_set &txs);
271273
bool process_ring_members(const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr, bool verbose);
272274
std::string get_prompt() const;

src/wallet/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ set(wallet_sources
3838
node_rpc_proxy.cpp
3939
message_store.cpp
4040
message_transporter.cpp
41+
misc_wallet_utils.cpp
4142
scanning_tools.cpp
4243
tx_builder.cpp
4344
)

src/wallet/api/pending_transaction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ bool PendingTransactionImpl::commit(const std::string &filename, bool overwrite)
113113

114114
const bool tx_cold_signed = m_wallet.m_wallet->get_account().get_device().has_tx_cold_sign();
115115
if (tx_cold_signed){
116+
wallet2_basic::transfer_container transfers;
117+
m_wallet.m_wallet->get_transfers(transfers);
118+
116119
std::unordered_set<size_t> selected_transfers;
117120
for(const tools::wallet2::pending_tx & ptx : m_pending_tx){
118-
for(size_t s : ptx.selected_transfers){
121+
for(size_t s : tools::wallet::collect_selected_transfer_indices(ptx.construction_data, transfers)){
119122
selected_transfers.insert(s);
120123
}
121124
}

0 commit comments

Comments
 (0)