Skip to content

Commit 873757e

Browse files
committed
MakerTxSanityCheckTests: Add checkFeeAmountMissingVoutValue test
1 parent 4972568 commit 873757e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

core/src/test/java/bisq/core/fee/MakerTxValidatorSanityCheckTests.java

+18
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ void checkFeeAmountMissingVinPreVoutValue() {
191191
assertThat(txValidator1.getStatus(), is(FeeValidationStatus.NACK_JSON_ERROR));
192192
}
193193

194+
@Test
195+
void checkFeeAmountMissingVoutValue() {
196+
JsonObject json = MakerTxValidatorSanityCheckTests.getValidBtcMakerFeeMempoolJsonResponse();
197+
JsonObject firstOutput = json.getAsJsonArray("vout").get(0).getAsJsonObject();
198+
firstOutput.remove("value");
199+
200+
boolean hasPreVout = json.getAsJsonArray("vout")
201+
.get(0).getAsJsonObject()
202+
.has("value");
203+
assertThat(hasPreVout, is(false));
204+
205+
String jsonContent = new Gson().toJson(json);
206+
TxValidator txValidator1 = txValidator.parseJsonValidateMakerFeeTx(jsonContent,
207+
MakerTxValidatorSanityCheckTests.FEE_RECEIVER_ADDRESSES);
208+
209+
assertThat(txValidator1.getStatus(), is(FeeValidationStatus.NACK_JSON_ERROR));
210+
}
211+
194212
@Test
195213
void responseHasDifferentTxId() {
196214
String differentTxId = "abcde971ead7d03619e3a9eeaa771ed5adba14c448839e0299f857f7bb4ec07";

0 commit comments

Comments
 (0)