Skip to content

Commit

Permalink
Use non-pruned nodes in verify-chain
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Jul 17, 2024
1 parent e772b8a commit 149c2a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion coins/monero/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 { .. }) => (),
Expand Down
5 changes: 2 additions & 3 deletions coins/monero/verify-chain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![];
{
Expand Down

0 comments on commit 149c2a4

Please sign in to comment.