Fix Monero's Extra::fee_weight and handling of data limits

This commit is contained in:
Luke Parker
2023-03-26 03:43:51 -04:00
parent c182b804bc
commit 534e1bb11d
3 changed files with 20 additions and 11 deletions

View File

@@ -30,10 +30,13 @@ test!(
add_multiple_data_less_than_max,
(
|_, mut builder: Builder, addr| async move {
let data = vec![b'\0'; MAX_ARBITRARY_DATA_SIZE - 1];
let mut data = vec![];
for b in 1 ..= 3 {
data.push(vec![b; MAX_ARBITRARY_DATA_SIZE - 1]);
}
// Add tx multiple times
for _ in 0 .. 5 {
// Add data multiple times
for data in &data {
let result = builder.add_data(data.clone());
assert!(result.is_ok());
}
@@ -41,10 +44,10 @@ test!(
builder.add_payment(addr, 5);
(builder.build().unwrap(), data)
},
|_, tx: Transaction, mut scanner: Scanner, data: Vec<u8>| async move {
|_, tx: Transaction, mut scanner: Scanner, data: Vec<Vec<u8>>| async move {
let output = scanner.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
assert_eq!(output.arbitrary_data(), vec![data; 5]);
assert_eq!(output.arbitrary_data(), data);
},
),
);