Rename userdata to data (#3282)

* Rename userdata to data

Instead of saying "userdata", which is ambiguous and imprecise,
say "instruction data" or "account data".

Also, add `ProgramError::InvalidInstructionData`

Fixes #2761
This commit is contained in:
Greg Fitzgerald
2019-03-14 10:48:27 -06:00
committed by GitHub
parent de13082347
commit c1eec0290e
42 changed files with 245 additions and 254 deletions

View File

@@ -395,10 +395,10 @@ mod tests {
}
#[test]
fn test_system_transaction_userdata_layout() {
fn test_system_transaction_data_layout() {
use crate::packet::PACKET_DATA_SIZE;
let mut tx0 = test_tx();
tx0.instructions[0].userdata = vec![1, 2, 3];
tx0.instructions[0].data = vec![1, 2, 3];
let message0a = tx0.message();
let tx_bytes = serialize(&tx0).unwrap();
assert!(tx_bytes.len() < PACKET_DATA_SIZE);
@@ -408,9 +408,9 @@ mod tests {
);
let tx1 = deserialize(&tx_bytes).unwrap();
assert_eq!(tx0, tx1);
assert_eq!(tx1.instructions[0].userdata, vec![1, 2, 3]);
assert_eq!(tx1.instructions[0].data, vec![1, 2, 3]);
tx0.instructions[0].userdata = vec![1, 2, 4];
tx0.instructions[0].data = vec![1, 2, 4];
let message0b = tx0.message();
assert_ne!(message0a, message0b);
}