mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-22 02:34:55 +00:00
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:
parent
108504d6e2
commit
a52c86ad81
1 changed files with 15 additions and 1 deletions
|
@ -583,8 +583,22 @@ impl<R: RpcConnection> Rpc<R> {
|
|||
.iter()
|
||||
.enumerate()
|
||||
.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(
|
||||
Some([rpc_point(&out.key)?, rpc_point(&out.mask)?])
|
||||
Some([key, rpc_point(&out.mask)?])
|
||||
.filter(|_| Timelock::Block(height) >= txs[i].prefix.timelock),
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue