Manually format a bunch of vecs

In preparation for modifying some unit test data structures, manually
format the code so it is uniform.

Move elements added to a vec with `vec!` onto a new line so they all
line up and one can better see what fields go where.

Refactor only, no logic changes.
This commit is contained in:
Tobin C. Harding 2023-01-20 15:19:54 +11:00
parent 83e1c40c4d
commit 3e70c01826
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 234 additions and 208 deletions

View File

@ -908,7 +908,8 @@ mod tests {
unsigned_tx: Transaction { unsigned_tx: Transaction {
version: 2, version: 2,
lock_time: absolute::LockTime::from_consensus(1257139), lock_time: absolute::LockTime::from_consensus(1257139),
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126", "f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126",
@ -918,7 +919,8 @@ mod tests {
script_sig: ScriptBuf::new(), script_sig: ScriptBuf::new(),
sequence: Sequence::ENABLE_LOCKTIME_NO_RBF, sequence: Sequence::ENABLE_LOCKTIME_NO_RBF,
witness: Witness::default(), witness: Witness::default(),
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: 99999699, value: 99999699,
@ -980,7 +982,8 @@ mod tests {
let tx = Transaction { let tx = Transaction {
version: 1, version: 1,
lock_time: absolute::LockTime::ZERO, lock_time: absolute::LockTime::ZERO,
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex("e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389").unwrap(), txid: Txid::from_hex("e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389").unwrap(),
vout: 1, vout: 1,
@ -988,7 +991,8 @@ mod tests {
script_sig: hex_script!("160014be18d152a9b012039daf3da7de4f53349eecb985"), script_sig: hex_script!("160014be18d152a9b012039daf3da7de4f53349eecb985"),
sequence: Sequence::MAX, sequence: Sequence::MAX,
witness: Witness::from_slice(&[hex!("03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105")]), witness: Witness::from_slice(&[hex!("03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105")]),
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: 190303501938, value: 190303501938,
@ -1032,7 +1036,8 @@ mod tests {
proprietary: proprietary.clone(), proprietary: proprietary.clone(),
unknown: unknown.clone(), unknown: unknown.clone(),
inputs: vec![Input { inputs: vec![
Input {
non_witness_utxo: Some(tx), non_witness_utxo: Some(tx),
witness_utxo: Some(TxOut { witness_utxo: Some(TxOut {
value: 190303501938, value: 190303501938,
@ -1054,13 +1059,16 @@ mod tests {
proprietary: proprietary.clone(), proprietary: proprietary.clone(),
unknown: unknown.clone(), unknown: unknown.clone(),
..Default::default() ..Default::default()
}], }
outputs: vec![Output { ],
outputs: vec![
Output {
bip32_derivation: keypaths, bip32_derivation: keypaths,
proprietary, proprietary,
unknown, unknown,
..Default::default() ..Default::default()
}], }
],
}; };
let encoded = serde_json::to_string(&psbt).unwrap(); let encoded = serde_json::to_string(&psbt).unwrap();
let decoded: PartiallySignedTransaction = serde_json::from_str(&encoded).unwrap(); let decoded: PartiallySignedTransaction = serde_json::from_str(&encoded).unwrap();
@ -1166,7 +1174,8 @@ mod tests {
unsigned_tx: Transaction { unsigned_tx: Transaction {
version: 2, version: 2,
lock_time: absolute::LockTime::from_consensus(1257139), lock_time: absolute::LockTime::from_consensus(1257139),
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126", "f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126",
@ -1176,7 +1185,8 @@ mod tests {
script_sig: ScriptBuf::new(), script_sig: ScriptBuf::new(),
sequence: Sequence::ENABLE_LOCKTIME_NO_RBF, sequence: Sequence::ENABLE_LOCKTIME_NO_RBF,
witness: Witness::default(), witness: Witness::default(),
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: 99999699, value: 99999699,
@ -1193,11 +1203,13 @@ mod tests {
proprietary: BTreeMap::new(), proprietary: BTreeMap::new(),
unknown: BTreeMap::new(), unknown: BTreeMap::new(),
inputs: vec![Input { inputs: vec![
Input {
non_witness_utxo: Some(Transaction { non_witness_utxo: Some(Transaction {
version: 1, version: 1,
lock_time: absolute::LockTime::ZERO, lock_time: absolute::LockTime::ZERO,
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389", "e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389",
@ -1224,7 +1236,8 @@ mod tests {
hex!("3045022100d12b852d85dcd961d2f5f4ab660654df6eedcc794c0c33ce5cc309ffb5fce58d022067338a8e0e1725c197fb1a88af59f51e44e4255b20167c8684031c05d1f2592a01"), hex!("3045022100d12b852d85dcd961d2f5f4ab660654df6eedcc794c0c33ce5cc309ffb5fce58d022067338a8e0e1725c197fb1a88af59f51e44e4255b20167c8684031c05d1f2592a01"),
hex!("0223b72beef0965d10be0778efecd61fcac6f79a4ea169393380734464f84f2ab3"), hex!("0223b72beef0965d10be0778efecd61fcac6f79a4ea169393380734464f84f2ab3"),
]), ]),
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: 200000000, value: 200000000,
@ -1237,7 +1250,8 @@ mod tests {
], ],
}), }),
..Default::default() ..Default::default()
},], },
],
outputs: vec![ outputs: vec![
Output { Output {
..Default::default() ..Default::default()
@ -1486,7 +1500,8 @@ mod tests {
unsigned_tx: Transaction { unsigned_tx: Transaction {
version: 2, version: 2,
lock_time: absolute::LockTime::from_consensus(1257139), lock_time: absolute::LockTime::from_consensus(1257139),
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126", "f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126",
@ -1496,7 +1511,8 @@ mod tests {
script_sig: ScriptBuf::new(), script_sig: ScriptBuf::new(),
sequence: Sequence::ENABLE_LOCKTIME_NO_RBF, sequence: Sequence::ENABLE_LOCKTIME_NO_RBF,
witness: Witness::default(), witness: Witness::default(),
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: 99999699, value: 99999699,
@ -1513,11 +1529,13 @@ mod tests {
proprietary: Default::default(), proprietary: Default::default(),
unknown: BTreeMap::new(), unknown: BTreeMap::new(),
inputs: vec![Input { inputs: vec![
Input {
non_witness_utxo: Some(Transaction { non_witness_utxo: Some(Transaction {
version: 1, version: 1,
lock_time: absolute::LockTime::ZERO, lock_time: absolute::LockTime::ZERO,
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389", "e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389",
@ -1544,7 +1562,8 @@ mod tests {
hex!("3045022100d12b852d85dcd961d2f5f4ab660654df6eedcc794c0c33ce5cc309ffb5fce58d022067338a8e0e1725c197fb1a88af59f51e44e4255b20167c8684031c05d1f2592a01"), hex!("3045022100d12b852d85dcd961d2f5f4ab660654df6eedcc794c0c33ce5cc309ffb5fce58d022067338a8e0e1725c197fb1a88af59f51e44e4255b20167c8684031c05d1f2592a01"),
hex!("0223b72beef0965d10be0778efecd61fcac6f79a4ea169393380734464f84f2ab3"), hex!("0223b72beef0965d10be0778efecd61fcac6f79a4ea169393380734464f84f2ab3"),
]), ]),
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: 200000000, value: 200000000,
@ -1557,7 +1576,8 @@ mod tests {
], ],
}), }),
..Default::default() ..Default::default()
},], },
],
outputs: vec![ outputs: vec![
Output { Output {
..Default::default() ..Default::default()
@ -1656,7 +1676,8 @@ mod tests {
unsigned_tx: Transaction { unsigned_tx: Transaction {
version: 2, version: 2,
lock_time: absolute::LockTime::from_consensus(1257139), lock_time: absolute::LockTime::from_consensus(1257139),
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126", "f61b1742ca13176464adb3cb66050c00787bb3a4eead37e985f2df1e37718126",
@ -1665,7 +1686,8 @@ mod tests {
}, },
sequence: Sequence::ENABLE_LOCKTIME_NO_RBF, sequence: Sequence::ENABLE_LOCKTIME_NO_RBF,
..Default::default() ..Default::default()
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: output_0_val, value: output_0_val,
@ -1682,11 +1704,13 @@ mod tests {
proprietary: BTreeMap::new(), proprietary: BTreeMap::new(),
unknown: BTreeMap::new(), unknown: BTreeMap::new(),
inputs: vec![Input { inputs: vec![
Input {
non_witness_utxo: Some(Transaction { non_witness_utxo: Some(Transaction {
version: 1, version: 1,
lock_time: absolute::LockTime::ZERO, lock_time: absolute::LockTime::ZERO,
input: vec![TxIn { input: vec![
TxIn {
previous_output: OutPoint { previous_output: OutPoint {
txid: Txid::from_hex( txid: Txid::from_hex(
"e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389", "e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389",
@ -1705,7 +1729,8 @@ mod tests {
}, },
sequence: Sequence::MAX, sequence: Sequence::MAX,
..Default::default() ..Default::default()
}], }
],
output: vec![ output: vec![
TxOut { TxOut {
value: prev_output_val, value: prev_output_val,
@ -1718,7 +1743,8 @@ mod tests {
], ],
}), }),
..Default::default() ..Default::default()
},], },
],
outputs: vec![ outputs: vec![
Output { Output {
..Default::default() ..Default::default()