XMR autoconf should get amount from trade not offer

Get the amount from the trade rather than the offer.

Log the expected amount when not matching the explorer result.
It would have made debugging this issue much more straightforward.

Fixes #4557
This commit is contained in:
jmacxx 2020-09-24 10:57:33 -05:00
parent de71811827
commit b842a0789c
No known key found for this signature in database
GPG key ID: 155297BABFE94A1B
2 changed files with 3 additions and 2 deletions

View file

@ -60,8 +60,7 @@ public class XmrTxProofModel implements AssetTxProofModel {
this.serviceAddress = serviceAddress; this.serviceAddress = serviceAddress;
this.autoConfirmSettings = autoConfirmSettings; this.autoConfirmSettings = autoConfirmSettings;
Coin tradeAmount = trade.getTradeAmount(); Volume volume = trade.getTradeVolume();
Volume volume = checkNotNull(trade.getOffer()).getVolumeByAmount(tradeAmount);
amount = DevEnv.isDevMode() ? amount = DevEnv.isDevMode() ?
XmrTxProofModel.DEV_AMOUNT : // For dev testing we need to add the matching address to the dev tx key and dev view key XmrTxProofModel.DEV_AMOUNT : // For dev testing we need to add the matching address to the dev tx key and dev view key
volume != null ? volume.getValue() * 10000L : 0L; // XMR satoshis have 12 decimal places vs. bitcoin's 8 volume != null ? volume.getValue() * 10000L : 0L; // XMR satoshis have 12 decimal places vs. bitcoin's 8

View file

@ -144,6 +144,8 @@ public class XmrTxProofParser implements AssetTxProofParser<XmrTxProofRequest.Re
amountMatches = jsonAmount == model.getAmount(); amountMatches = jsonAmount == model.getAmount();
if (amountMatches) { if (amountMatches) {
break; break;
} else {
log.warn("amount {}, expected: {}", jsonAmount, model.getAmount());
} }
} }
} }