MakerTxSanityCheckTests: Add checkFeeAmountMissingVinPreVoutValue test

This commit is contained in:
Alva Swanson 2024-01-24 15:12:55 +01:00
parent 3a7a67d7ca
commit 49725689ca
No known key found for this signature in database
GPG Key ID: 004760E77F753090

View File

@ -172,6 +172,25 @@ public class MakerTxValidatorSanityCheckTests {
assertThat(txValidator1.getStatus(), is(FeeValidationStatus.NACK_JSON_ERROR));
}
@Test
void checkFeeAmountMissingVinPreVoutValue() {
JsonObject json = MakerTxValidatorSanityCheckTests.getValidBtcMakerFeeMempoolJsonResponse();
JsonObject firstInput = json.get("vin").getAsJsonArray().get(0).getAsJsonObject();
firstInput.getAsJsonObject("prevout").remove("value");
boolean hasPreVout = json.get("vin").getAsJsonArray()
.get(0).getAsJsonObject()
.getAsJsonObject("prevout")
.has("value");
assertThat(hasPreVout, is(false));
String jsonContent = new Gson().toJson(json);
TxValidator txValidator1 = txValidator.parseJsonValidateMakerFeeTx(jsonContent,
MakerTxValidatorSanityCheckTests.FEE_RECEIVER_ADDRESSES);
assertThat(txValidator1.getStatus(), is(FeeValidationStatus.NACK_JSON_ERROR));
}
@Test
void responseHasDifferentTxId() {
String differentTxId = "abcde971ead7d03619e3a9eeaa771ed5adba14c448839e0299f857f7bb4ec07";