Don't label Monero nodes invalid for returning invalid keys in outputs

Only recently (I believe the most recent HF) were output keys checked to be
valid. This means returned keys may be invalid points, despite being the
legitimate keys for the specified outputs.

Does still label the node as invalid if it doesn't return 32 bytes,
hex-encoded.
This commit is contained in:
Luke Parker 2023-08-21 03:07:20 -04:00
parent 108504d6e2
commit a52c86ad81
No known key found for this signature in database

View file

@ -583,8 +583,22 @@ impl<R: RpcConnection> Rpc<R> {
.iter() .iter()
.enumerate() .enumerate()
.map(|(i, out)| { .map(|(i, out)| {
// Allow keys to be invalid, though if they are, return None to trigger selection of a new
// decoy
// Only valid keys can be used in CLSAG proofs, hence the need for re-selection, yet
// invalid keys may honestly exist on the blockchain
// Only a recent hard fork checked output keys were valid points
let Some(key) = CompressedEdwardsY(
hex::decode(&out.key)
.map_err(|_| RpcError::InvalidNode)?
.try_into()
.map_err(|_| RpcError::InvalidNode)?,
)
.decompress() else {
return Ok(None);
};
Ok( Ok(
Some([rpc_point(&out.key)?, rpc_point(&out.mask)?]) Some([key, rpc_point(&out.mask)?])
.filter(|_| Timelock::Block(height) >= txs[i].prefix.timelock), .filter(|_| Timelock::Block(height) >= txs[i].prefix.timelock),
) )
}) })