MakerTxSanityCheckTests: Add checkFeeAmountMissingVoutValue test

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

View File

@ -191,6 +191,24 @@ public class MakerTxValidatorSanityCheckTests {
assertThat(txValidator1.getStatus(), is(FeeValidationStatus.NACK_JSON_ERROR));
}
@Test
void checkFeeAmountMissingVoutValue() {
JsonObject json = MakerTxValidatorSanityCheckTests.getValidBtcMakerFeeMempoolJsonResponse();
JsonObject firstOutput = json.getAsJsonArray("vout").get(0).getAsJsonObject();
firstOutput.remove("value");
boolean hasPreVout = json.getAsJsonArray("vout")
.get(0).getAsJsonObject()
.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";