Get the repo to compile again

This commit is contained in:
Luke Parker
2024-06-23 10:08:51 -04:00
parent 11dba9173f
commit 0b20004ba1
40 changed files with 1452 additions and 777 deletions

View File

@@ -1,6 +1,7 @@
use monero_simple_request_rpc::SimpleRequestRpc;
use monero_wallet::{
monero::{transaction::Transaction, DEFAULT_LOCK_WINDOW},
DEFAULT_LOCK_WINDOW,
transaction::Transaction,
rpc::{OutputResponse, Rpc},
SpendableOutput,
};

View File

@@ -61,16 +61,19 @@ test!(
},
|_, mut tx: Transaction, _, eventuality: Eventuality| async move {
// 4 explicitly outputs added and one change output
assert_eq!(tx.prefix.outputs.len(), 5);
assert_eq!(tx.prefix().outputs.len(), 5);
// The eventuality's available extra should be the actual TX's
assert_eq!(tx.prefix.extra, eventuality.extra());
assert_eq!(tx.prefix().extra, eventuality.extra());
// The TX should match
assert!(eventuality.matches(&tx));
// Mutate the TX
tx.proofs.base.commitments[0] += ED25519_BASEPOINT_POINT;
let Transaction::V2 { proofs: Some(ref mut proofs), .. } = tx else {
panic!("TX wasn't RingCT")
};
proofs.base.commitments[0] += ED25519_BASEPOINT_POINT;
// Verify it no longer matches
assert!(!eventuality.matches(&tx));
},

View File

@@ -10,7 +10,7 @@ use tokio::sync::Mutex;
use monero_simple_request_rpc::SimpleRequestRpc;
use monero_wallet::{
monero::transaction::Transaction,
transaction::Transaction,
rpc::Rpc,
ViewPair, Scanner,
address::{Network, AddressType, AddressSpec, AddressMeta, MoneroAddress},
@@ -80,7 +80,8 @@ pub async fn get_miner_tx_output(rpc: &SimpleRequestRpc, view: &ViewPair) -> Spe
/// Make sure the weight and fee match the expected calculation.
pub fn check_weight_and_fee(tx: &Transaction, fee_rate: FeeRate) {
let fee = tx.proofs.base.fee;
let Transaction::V2 { proofs: Some(ref proofs), .. } = tx else { panic!("TX wasn't RingCT") };
let fee = proofs.base.fee;
let weight = tx.weight();
let expected_weight = fee_rate.calculate_weight_from_fee(fee);

View File

@@ -2,7 +2,7 @@ use rand_core::OsRng;
use monero_simple_request_rpc::SimpleRequestRpc;
use monero_wallet::{
monero::transaction::Transaction, Protocol, rpc::Rpc, extra::Extra, address::SubaddressIndex,
transaction::Transaction, Protocol, rpc::Rpc, extra::Extra, address::SubaddressIndex,
ReceivedOutput, SpendableOutput, DecoySelection, Decoys, SignableTransactionBuilder,
};
@@ -136,7 +136,7 @@ test!(
assert_eq!(sub_outputs[0].commitment().amount, 1);
// Make sure only one R was included in TX extra
assert!(Extra::read::<&[u8]>(&mut tx.prefix.extra.as_ref())
assert!(Extra::read::<&[u8]>(&mut tx.prefix().extra.as_ref())
.unwrap()
.keys()
.unwrap()
@@ -306,7 +306,8 @@ test!(
assert_eq!(outputs[1].commitment().amount, 50000);
// The remainder should get shunted to fee, which is fingerprintable
assert_eq!(tx.proofs.base.fee, 1000000000000 - 10000 - 50000);
let Transaction::V2 { proofs: Some(ref proofs), .. } = tx else { panic!("TX wasn't RingCT") };
assert_eq!(proofs.base.fee, 1000000000000 - 10000 - 50000);
},
),
);

View File

@@ -7,7 +7,7 @@ use serde_json::json;
use monero_simple_request_rpc::SimpleRequestRpc;
use monero_wallet::{
monero::transaction::Transaction,
transaction::Transaction,
rpc::Rpc,
address::{Network, AddressSpec, SubaddressIndex, MoneroAddress},
extra::{MAX_TX_EXTRA_NONCE_SIZE, Extra, PaymentId},
@@ -226,7 +226,7 @@ test!(
assert_eq!(transfer.transfer.payment_id, hex::encode([0u8; 8]));
// Make sure only one R was included in TX extra
assert!(Extra::read::<&[u8]>(&mut tx.prefix.extra.as_ref())
assert!(Extra::read::<&[u8]>(&mut tx.prefix().extra.as_ref())
.unwrap()
.keys()
.unwrap()
@@ -285,7 +285,7 @@ test!(
// Make sure 3 additional pub keys are included in TX extra
let keys =
Extra::read::<&[u8]>(&mut tx.prefix.extra.as_ref()).unwrap().keys().unwrap().1.unwrap();
Extra::read::<&[u8]>(&mut tx.prefix().extra.as_ref()).unwrap().keys().unwrap().1.unwrap();
assert_eq!(keys.len(), 3);
},