@@ -944,6 +944,7 @@ mod tests {
944
944
}
945
945
946
946
struct TestSession {
947
+ description : String ,
947
948
inputs_a : Vec < ( TxIn , TransactionU16LenLimited ) > ,
948
949
outputs_a : Vec < TxOut > ,
949
950
inputs_b : Vec < ( TxIn , TransactionU16LenLimited ) > ,
@@ -1035,7 +1036,12 @@ mod tests {
1035
1036
} ,
1036
1037
_ => ErrorCulprit :: NodeA ,
1037
1038
} ;
1038
- assert_eq ! ( Some ( ( abort_reason, error_culprit) ) , session. expect_error) ;
1039
+ assert_eq ! (
1040
+ Some ( ( abort_reason, error_culprit) ) ,
1041
+ session. expect_error,
1042
+ "Test: {}" ,
1043
+ session. description
1044
+ ) ;
1039
1045
assert ! ( message_send_b. is_none( ) ) ;
1040
1046
return ;
1041
1047
} ,
@@ -1054,7 +1060,12 @@ mod tests {
1054
1060
} ,
1055
1061
_ => ErrorCulprit :: NodeB ,
1056
1062
} ;
1057
- assert_eq ! ( Some ( ( abort_reason, error_culprit) ) , session. expect_error) ;
1063
+ assert_eq ! (
1064
+ Some ( ( abort_reason, error_culprit) ) ,
1065
+ session. expect_error,
1066
+ "Test: {}" ,
1067
+ session. description
1068
+ ) ;
1058
1069
assert ! ( message_send_a. is_none( ) ) ;
1059
1070
return ;
1060
1071
} ,
@@ -1175,6 +1186,7 @@ mod tests {
1175
1186
fn test_interactive_tx_constructor ( ) {
1176
1187
// No contributions.
1177
1188
do_test_interactive_tx_constructor ( TestSession {
1189
+ description : "No contributions" . to_string ( ) ,
1178
1190
inputs_a : vec ! [ ] ,
1179
1191
outputs_a : vec ! [ ] ,
1180
1192
inputs_b : vec ! [ ] ,
@@ -1183,6 +1195,7 @@ mod tests {
1183
1195
} ) ;
1184
1196
// Single contribution, no initiator inputs.
1185
1197
do_test_interactive_tx_constructor ( TestSession {
1198
+ description : "Single contribution, no initiator inputs" . to_string ( ) ,
1186
1199
inputs_a : vec ! [ ] ,
1187
1200
outputs_a : generate_outputs ( & [ 1_000_000 ] ) ,
1188
1201
inputs_b : vec ! [ ] ,
@@ -1191,6 +1204,7 @@ mod tests {
1191
1204
} ) ;
1192
1205
// Single contribution, no initiator outputs.
1193
1206
do_test_interactive_tx_constructor ( TestSession {
1207
+ description : "Single contribution, no initiator outputs" . to_string ( ) ,
1194
1208
inputs_a : generate_inputs ( & [ 1_000_000 ] ) ,
1195
1209
outputs_a : vec ! [ ] ,
1196
1210
inputs_b : vec ! [ ] ,
@@ -1199,6 +1213,7 @@ mod tests {
1199
1213
} ) ;
1200
1214
// Single contribution, insufficient fees.
1201
1215
do_test_interactive_tx_constructor ( TestSession {
1216
+ description : "Single contribution, insufficient fees" . to_string ( ) ,
1202
1217
inputs_a : generate_inputs ( & [ 1_000_000 ] ) ,
1203
1218
outputs_a : generate_outputs ( & [ 1_000_000 ] ) ,
1204
1219
inputs_b : vec ! [ ] ,
@@ -1207,6 +1222,8 @@ mod tests {
1207
1222
} ) ;
1208
1223
// Initiator contributes sufficient fees, but non-initiator does not.
1209
1224
do_test_interactive_tx_constructor ( TestSession {
1225
+ description : "Initiator contributes sufficient fees, but non-initiator does not"
1226
+ . to_string ( ) ,
1210
1227
inputs_a : generate_inputs ( & [ 1_000_000 ] ) ,
1211
1228
outputs_a : vec ! [ ] ,
1212
1229
inputs_b : generate_inputs ( & [ 100_000 ] ) ,
@@ -1215,6 +1232,7 @@ mod tests {
1215
1232
} ) ;
1216
1233
// Multi-input-output contributions from both sides.
1217
1234
do_test_interactive_tx_constructor ( TestSession {
1235
+ description : "Multi-input-output contributions from both sides" . to_string ( ) ,
1218
1236
inputs_a : generate_inputs ( & [ 1_000_000 , 1_000_000 ] ) ,
1219
1237
outputs_a : generate_outputs ( & [ 1_000_000 , 200_000 ] ) ,
1220
1238
inputs_b : generate_inputs ( & [ 1_000_000 , 500_000 ] ) ,
@@ -1244,6 +1262,7 @@ mod tests {
1244
1262
..Default :: default ( )
1245
1263
} ;
1246
1264
do_test_interactive_tx_constructor ( TestSession {
1265
+ description : "Prevout from initiator is not a witness program" . to_string ( ) ,
1247
1266
inputs_a : vec ! [ ( non_segwit_input, non_segwit_output_tx) ] ,
1248
1267
outputs_a : vec ! [ ] ,
1249
1268
inputs_b : vec ! [ ] ,
@@ -1258,6 +1277,7 @@ mod tests {
1258
1277
..Default :: default ( )
1259
1278
} ;
1260
1279
do_test_interactive_tx_constructor ( TestSession {
1280
+ description : "Invalid input sequence from initiator" . to_string ( ) ,
1261
1281
inputs_a : vec ! [ ( invalid_sequence_input, tx. clone( ) ) ] ,
1262
1282
outputs_a : generate_outputs ( & [ 1_000_000 ] ) ,
1263
1283
inputs_b : vec ! [ ] ,
@@ -1271,6 +1291,7 @@ mod tests {
1271
1291
..Default :: default ( )
1272
1292
} ;
1273
1293
do_test_interactive_tx_constructor ( TestSession {
1294
+ description : "Duplicate prevout from initiator" . to_string ( ) ,
1274
1295
inputs_a : vec ! [ ( duplicate_input. clone( ) , tx. clone( ) ) , ( duplicate_input, tx. clone( ) ) ] ,
1275
1296
outputs_a : generate_outputs ( & [ 1_000_000 ] ) ,
1276
1297
inputs_b : vec ! [ ] ,
@@ -1284,6 +1305,7 @@ mod tests {
1284
1305
..Default :: default ( )
1285
1306
} ;
1286
1307
do_test_interactive_tx_constructor ( TestSession {
1308
+ description : "Non-initiator uses same prevout as initiator" . to_string ( ) ,
1287
1309
inputs_a : vec ! [ ( duplicate_input. clone( ) , tx. clone( ) ) ] ,
1288
1310
outputs_a : generate_outputs ( & [ 1_000_000 ] ) ,
1289
1311
inputs_b : vec ! [ ( duplicate_input. clone( ) , tx. clone( ) ) ] ,
@@ -1292,6 +1314,7 @@ mod tests {
1292
1314
} ) ;
1293
1315
// Initiator sends too many TxAddInputs
1294
1316
do_test_interactive_tx_constructor ( TestSession {
1317
+ description : "Initiator sends too many TxAddInputs" . to_string ( ) ,
1295
1318
inputs_a : generate_fixed_number_of_inputs ( MAX_RECEIVED_TX_ADD_INPUT_COUNT + 1 ) ,
1296
1319
outputs_a : vec ! [ ] ,
1297
1320
inputs_b : vec ! [ ] ,
@@ -1302,6 +1325,7 @@ mod tests {
1302
1325
// entropy source, `DuplicateEntropySource` to simulate this.
1303
1326
do_test_interactive_tx_constructor_with_entropy_source (
1304
1327
TestSession {
1328
+ description : "Attempt to queue up two inputs with duplicate serial ids" . to_string ( ) ,
1305
1329
inputs_a : generate_fixed_number_of_inputs ( 2 ) ,
1306
1330
outputs_a : vec ! [ ] ,
1307
1331
inputs_b : vec ! [ ] ,
@@ -1312,6 +1336,7 @@ mod tests {
1312
1336
) ;
1313
1337
// Initiator sends too many TxAddOutputs.
1314
1338
do_test_interactive_tx_constructor ( TestSession {
1339
+ description : "Initiator sends too many TxAddOutputs" . to_string ( ) ,
1315
1340
inputs_a : vec ! [ ] ,
1316
1341
outputs_a : generate_fixed_number_of_outputs ( MAX_RECEIVED_TX_ADD_OUTPUT_COUNT + 1 ) ,
1317
1342
inputs_b : vec ! [ ] ,
@@ -1320,6 +1345,7 @@ mod tests {
1320
1345
} ) ;
1321
1346
// Initiator sends an output below dust value.
1322
1347
do_test_interactive_tx_constructor ( TestSession {
1348
+ description : "Initiator sends an output below dust value" . to_string ( ) ,
1323
1349
inputs_a : vec ! [ ] ,
1324
1350
outputs_a : generate_outputs ( & [ 1 ] ) ,
1325
1351
inputs_b : vec ! [ ] ,
@@ -1328,6 +1354,7 @@ mod tests {
1328
1354
} ) ;
1329
1355
// Initiator sends an output above maximum sats allowed.
1330
1356
do_test_interactive_tx_constructor ( TestSession {
1357
+ description : "Initiator sends an output above maximum sats allowed" . to_string ( ) ,
1331
1358
inputs_a : vec ! [ ] ,
1332
1359
outputs_a : generate_outputs ( & [ TOTAL_BITCOIN_SUPPLY_SATOSHIS + 1 ] ) ,
1333
1360
inputs_b : vec ! [ ] ,
@@ -1336,6 +1363,7 @@ mod tests {
1336
1363
} ) ;
1337
1364
// Initiator sends an output without a witness program.
1338
1365
do_test_interactive_tx_constructor ( TestSession {
1366
+ description : "Initiator sends an output without a witness program" . to_string ( ) ,
1339
1367
inputs_a : vec ! [ ] ,
1340
1368
outputs_a : vec ! [ generate_non_witness_output( 1_000_000 ) ] ,
1341
1369
inputs_b : vec ! [ ] ,
@@ -1346,6 +1374,8 @@ mod tests {
1346
1374
// entropy source, `DuplicateEntropySource` to simulate this.
1347
1375
do_test_interactive_tx_constructor_with_entropy_source (
1348
1376
TestSession {
1377
+ description : "Attempt to queue up two outputs with duplicate serial ids"
1378
+ . to_string ( ) ,
1349
1379
inputs_a : vec ! [ ] ,
1350
1380
outputs_a : generate_fixed_number_of_outputs ( 2 ) ,
1351
1381
inputs_b : vec ! [ ] ,
@@ -1357,6 +1387,7 @@ mod tests {
1357
1387
1358
1388
// Peer contributed more output value than inputs
1359
1389
do_test_interactive_tx_constructor ( TestSession {
1390
+ description : "Peer contributed more output value than inputs" . to_string ( ) ,
1360
1391
inputs_a : generate_inputs ( & [ 100_000 ] ) ,
1361
1392
outputs_a : generate_outputs ( & [ 1_000_000 ] ) ,
1362
1393
inputs_b : vec ! [ ] ,
@@ -1366,6 +1397,7 @@ mod tests {
1366
1397
1367
1398
// Peer contributed more than allowed number of inputs.
1368
1399
do_test_interactive_tx_constructor ( TestSession {
1400
+ description : "Peer contributed more than allowed number of inputs" . to_string ( ) ,
1369
1401
inputs_a : generate_fixed_number_of_inputs ( MAX_INPUTS_OUTPUTS_COUNT as u16 + 1 ) ,
1370
1402
outputs_a : vec ! [ ] ,
1371
1403
inputs_b : vec ! [ ] ,
@@ -1377,6 +1409,7 @@ mod tests {
1377
1409
} ) ;
1378
1410
// Peer contributed more than allowed number of outputs.
1379
1411
do_test_interactive_tx_constructor ( TestSession {
1412
+ description : "Peer contributed more than allowed number of outputs" . to_string ( ) ,
1380
1413
inputs_a : generate_inputs ( & [ TOTAL_BITCOIN_SUPPLY_SATOSHIS ] ) ,
1381
1414
outputs_a : generate_fixed_number_of_outputs ( MAX_INPUTS_OUTPUTS_COUNT as u16 + 1 ) ,
1382
1415
inputs_b : vec ! [ ] ,
0 commit comments