aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-13 11:32:44 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-21 14:46:29 +0000
commitadf6d7730f3389649ea0e79d2968e04fd3700dff (patch)
tree6e1af06a30d0e6e9eda6869da3a81b2e16ca9de3 /src/wallet
parentMerge pull request #5283 (diff)
downloadmonero-adf6d7730f3389649ea0e79d2968e04fd3700dff.tar.xz
wallet: fix offline signing calling a daemon RPC
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp18
-rw-r--r--src/wallet/wallet2.h24
2 files changed, 24 insertions, 18 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 6036154ac..4d93e64bc 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -6012,12 +6012,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pendin
LOG_PRINT_L1(" " << (n+1) << ": " << sd.sources.size() << " inputs, ring size " << sd.sources[0].outputs.size());
signed_txes.ptx.push_back(pending_tx());
tools::wallet2::pending_tx &ptx = signed_txes.ptx.back();
- rct::RCTConfig rct_config = { rct::RangeProofBorromean, 0 };
- if (sd.use_bulletproofs)
- {
- rct_config.range_proof_type = rct::RangeProofPaddedBulletproof;
- rct_config.bp_version = use_fork_rules(HF_VERSION_SMALLER_BP, -10) ? 2 : 1;
- }
+ rct::RCTConfig rct_config = sd.rct_config;
crypto::secret_key tx_key;
std::vector<crypto::secret_key> additional_tx_keys;
rct::multisig_out msout;
@@ -6494,12 +6489,7 @@ bool wallet2::sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto
cryptonote::transaction tx;
rct::multisig_out msout = ptx.multisig_sigs.front().msout;
auto sources = sd.sources;
- rct::RCTConfig rct_config = { rct::RangeProofBorromean, 0 };
- if (sd.use_bulletproofs)
- {
- rct_config.range_proof_type = rct::RangeProofPaddedBulletproof;
- rct_config.bp_version = use_fork_rules(HF_VERSION_SMALLER_BP, -10) ? 2 : 1;
- }
+ rct::RCTConfig rct_config = sd.rct_config;
bool r = cryptonote::construct_tx_with_tx_key(m_account.get_keys(), m_subaddresses, sources, sd.splitted_dsts, ptx.change_dts.addr, sd.extra, tx, sd.unlock_time, ptx.tx_key, ptx.additional_tx_keys, sd.use_rct, rct_config, &msout, false);
THROW_WALLET_EXCEPTION_IF(!r, error::tx_not_constructed, sd.sources, sd.splitted_dsts, sd.unlock_time, m_nettype);
@@ -7960,7 +7950,7 @@ void wallet2::transfer_selected(const std::vector<cryptonote::tx_destination_ent
ptx.construction_data.extra = tx.extra;
ptx.construction_data.unlock_time = unlock_time;
ptx.construction_data.use_rct = false;
- ptx.construction_data.use_bulletproofs = false;
+ ptx.construction_data.rct_config = { rct::RangeProofBorromean, 0 };
ptx.construction_data.dests = dsts;
// record which subaddress indices are being used as inputs
ptx.construction_data.subaddr_account = subaddr_account;
@@ -8242,7 +8232,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
ptx.construction_data.extra = tx.extra;
ptx.construction_data.unlock_time = unlock_time;
ptx.construction_data.use_rct = true;
- ptx.construction_data.use_bulletproofs = !tx.rct_signatures.p.bulletproofs.empty();
+ ptx.construction_data.rct_config = { tx.rct_signatures.p.bulletproofs.empty() ? rct::RangeProofBorromean : rct::RangeProofPaddedBulletproof, use_fork_rules(HF_VERSION_SMALLER_BP, -10) ? 2 : 1};
ptx.construction_data.dests = dsts;
// record which subaddress indices are being used as inputs
ptx.construction_data.subaddr_account = subaddr_account;
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index c92404940..08c217e0c 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -374,7 +374,7 @@ namespace tools
std::vector<uint8_t> extra;
uint64_t unlock_time;
bool use_rct;
- bool use_bulletproofs;
+ rct::RCTConfig rct_config;
std::vector<cryptonote::tx_destination_entry> dests; // original setup, does not include change
uint32_t subaddr_account; // subaddress account of your wallet to be used in this transfer
std::set<uint32_t> subaddr_indices; // set of address indices used as inputs in this transfer
@@ -387,7 +387,7 @@ namespace tools
FIELD(extra)
FIELD(unlock_time)
FIELD(use_rct)
- FIELD(use_bulletproofs)
+ FIELD(rct_config)
FIELD(dests)
FIELD(subaddr_account)
FIELD(subaddr_indices)
@@ -1487,7 +1487,7 @@ BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 17)
BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0)
BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 0)
BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1)
-BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 3)
+BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 4)
BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 3)
BOOST_CLASS_VERSION(tools::wallet2::multisig_sig, 0)
@@ -1856,11 +1856,27 @@ namespace boost
a & x.subaddr_account;
a & x.subaddr_indices;
if (ver < 2)
+ {
+ if (!typename Archive::is_saving())
+ x.rct_config = { rct::RangeProofBorromean, 0 };
return;
+ }
a & x.selected_transfers;
if (ver < 3)
+ {
+ if (!typename Archive::is_saving())
+ x.rct_config = { rct::RangeProofBorromean, 0 };
return;
- a & x.use_bulletproofs;
+ }
+ if (ver < 4)
+ {
+ bool use_bulletproofs = x.rct_config.range_proof_type != rct::RangeProofBorromean;
+ a & use_bulletproofs;
+ if (!typename Archive::is_saving())
+ x.rct_config = { use_bulletproofs ? rct::RangeProofBulletproof : rct::RangeProofBorromean, 0 };
+ return;
+ }
+ a & x.rct_config;
}
template <class Archive>