Use non-pruned nodes in verify-chain

This commit is contained in:
Luke Parker 2024-07-17 06:54:26 -04:00
parent e772b8a5f7
commit 149c2a4437
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View file

@ -364,6 +364,7 @@ pub trait Rpc: Sync + Clone + Debug {
.iter() .iter()
.enumerate() .enumerate()
.map(|(i, res)| { .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 buf = rpc_hex(if !res.as_hex.is_empty() { &res.as_hex } else { &res.pruned_as_hex })?;
let mut buf = buf.as_slice(); let mut buf = buf.as_slice();
let tx = Transaction::read(&mut buf).map_err(|_| match hash_hex(&res.tx_hash) { 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()))?; 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() { if res.as_hex.is_empty() {
match tx.prefix().inputs.first() { match tx.prefix().inputs.first() {
Some(Input::Gen { .. }) => (), Some(Input::Gen { .. }) => (),

View file

@ -225,9 +225,8 @@ async fn main() {
// Read further args as RPC URLs // Read further args as RPC URLs
let default_nodes = vec![ let default_nodes = vec![
// "http://xmr-node.cakewallet.com:18081".to_string(), "http://xmr-node-uk.cakewallet.com:18081".to_string(),
"http://node.tools.rino.io:18081".to_string(), "http://xmr-node-eu.cakewallet.com:18081".to_string(),
// "https://node.sethforprivacy.com".to_string(),
]; ];
let mut specified_nodes = vec![]; let mut specified_nodes = vec![];
{ {