From 149c2a4437c265cda502dac5e2cc1ed8e8307a41 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 17 Jul 2024 06:54:26 -0400 Subject: [PATCH] Use non-pruned nodes in verify-chain --- coins/monero/rpc/src/lib.rs | 6 +++++- coins/monero/verify-chain/src/main.rs | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/coins/monero/rpc/src/lib.rs b/coins/monero/rpc/src/lib.rs index 841a56d4..9ecb90b2 100644 --- a/coins/monero/rpc/src/lib.rs +++ b/coins/monero/rpc/src/lib.rs @@ -364,6 +364,7 @@ pub trait Rpc: Sync + Clone + Debug { .iter() .enumerate() .map(|(i, res)| { + // https://github.com/monero-project/monero/issues/8311 let buf = rpc_hex(if !res.as_hex.is_empty() { &res.as_hex } else { &res.pruned_as_hex })?; let mut buf = buf.as_slice(); let tx = Transaction::read(&mut buf).map_err(|_| match hash_hex(&res.tx_hash) { @@ -374,7 +375,10 @@ pub trait Rpc: Sync + Clone + Debug { Err(RpcError::InvalidNode("transaction had extra bytes after it".to_string()))?; } - // https://github.com/monero-project/monero/issues/8311 + // We check this to ensure we didn't read a pruned transaction when we meant to read an + // actual transaction. That shouldn't be possible, as they have different serializations, + // yet it helps to ensure that if we applied the above exception (using the pruned data), + // it was for the right reason if res.as_hex.is_empty() { match tx.prefix().inputs.first() { Some(Input::Gen { .. }) => (), diff --git a/coins/monero/verify-chain/src/main.rs b/coins/monero/verify-chain/src/main.rs index b4853f53..2cc56c55 100644 --- a/coins/monero/verify-chain/src/main.rs +++ b/coins/monero/verify-chain/src/main.rs @@ -225,9 +225,8 @@ async fn main() { // Read further args as RPC URLs let default_nodes = vec![ - // "http://xmr-node.cakewallet.com:18081".to_string(), - "http://node.tools.rino.io:18081".to_string(), - // "https://node.sethforprivacy.com".to_string(), + "http://xmr-node-uk.cakewallet.com:18081".to_string(), + "http://xmr-node-eu.cakewallet.com:18081".to_string(), ]; let mut specified_nodes = vec![]; {