Prefix arbitrary data with 127

Since we cannot expect/guarantee a payment ID will be included, the previous
position-based code for determining arbitrary data wasn't sufficient.
This commit is contained in:
Luke Parker
2023-03-11 05:47:25 -05:00
parent 71dbc798b5
commit e56495d624
5 changed files with 42 additions and 28 deletions

View File

@@ -217,9 +217,10 @@ test!(
1000000,
);
// Make 2 data that is full 255 bytes
// Make 2 data that is the full 255 bytes
for _ in 0 .. 2 {
let data = vec![b'a'; MAX_TX_EXTRA_NONCE_SIZE];
// Subtract 1 since we prefix data with 127
let data = vec![b'a'; MAX_TX_EXTRA_NONCE_SIZE - 1];
assert!(builder.add_data(data).is_ok());
}