Ignore exceptions when deserializing note plaintexts
This commit is contained in:
committed by
Jonathan "Duke" Leto
parent
dbe2188d3f
commit
41baeb2bc2
@@ -173,15 +173,21 @@ boost::optional<SaplingOutgoingPlaintext> SaplingOutgoingPlaintext::decrypt(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deserialize from the plaintext
|
// Deserialize from the plaintext
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
try {
|
||||||
ss << pt.get();
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
|
ss << pt.get();
|
||||||
|
|
||||||
SaplingOutgoingPlaintext ret;
|
SaplingOutgoingPlaintext ret;
|
||||||
ss >> ret;
|
ss >> ret;
|
||||||
|
|
||||||
assert(ss.size() == 0);
|
assert(ss.size() == 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} catch (const boost::thread_interrupted&) {
|
||||||
|
throw;
|
||||||
|
} catch (...) {
|
||||||
|
return boost::none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
|
boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
|
||||||
@@ -197,13 +203,17 @@ boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deserialize from the plaintext
|
// Deserialize from the plaintext
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
|
||||||
ss << pt.get();
|
|
||||||
|
|
||||||
SaplingNotePlaintext ret;
|
SaplingNotePlaintext ret;
|
||||||
ss >> ret;
|
try {
|
||||||
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
assert(ss.size() == 0);
|
ss << pt.get();
|
||||||
|
ss >> ret;
|
||||||
|
assert(ss.size() == 0);
|
||||||
|
} catch (const boost::thread_interrupted&) {
|
||||||
|
throw;
|
||||||
|
} catch (...) {
|
||||||
|
return boost::none;
|
||||||
|
}
|
||||||
|
|
||||||
uint256 pk_d;
|
uint256 pk_d;
|
||||||
if (!librustzcash_ivk_to_pkd(ivk.begin(), ret.d.data(), pk_d.begin())) {
|
if (!librustzcash_ivk_to_pkd(ivk.begin(), ret.d.data(), pk_d.begin())) {
|
||||||
@@ -243,11 +253,17 @@ boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deserialize from the plaintext
|
// Deserialize from the plaintext
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
|
||||||
ss << pt.get();
|
|
||||||
|
|
||||||
SaplingNotePlaintext ret;
|
SaplingNotePlaintext ret;
|
||||||
ss >> ret;
|
try {
|
||||||
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
|
ss << pt.get();
|
||||||
|
ss >> ret;
|
||||||
|
assert(ss.size() == 0);
|
||||||
|
} catch (const boost::thread_interrupted&) {
|
||||||
|
throw;
|
||||||
|
} catch (...) {
|
||||||
|
return boost::none;
|
||||||
|
}
|
||||||
|
|
||||||
uint256 cmu_expected;
|
uint256 cmu_expected;
|
||||||
if (!librustzcash_sapling_compute_cm(
|
if (!librustzcash_sapling_compute_cm(
|
||||||
@@ -265,8 +281,6 @@ boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
|
|||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(ss.size() == 0);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user