@@ -1169,16 +1169,24 @@ private void scheduleWithEarliestTxs(List<OpenOffer> openOffers, OpenOffer openO
1169
1169
Set <MoneroTxWallet > scheduledTxs = new HashSet <MoneroTxWallet >();
1170
1170
for (MoneroTxWallet tx : xmrWalletService .getTxs ()) {
1171
1171
1172
- // skip if outputs unavailable
1173
- if (tx .getIncomingTransfers () == null || tx .getIncomingTransfers ().isEmpty ()) continue ;
1172
+ // skip if no funds available
1173
+ BigInteger sentToSelfAmount = xmrWalletService .getAmountSentToSelf (tx ); // amount sent to self always shows 0, so compute from destinations manually
1174
+ if (sentToSelfAmount .equals (BigInteger .ZERO ) && (tx .getIncomingTransfers () == null || tx .getIncomingTransfers ().isEmpty ())) continue ;
1174
1175
if (!isOutputsAvailable (tx )) continue ;
1175
1176
if (isTxScheduledByOtherOffer (openOffers , openOffer , tx .getHash ())) continue ;
1176
1177
1177
- // add scheduled tx
1178
- for (MoneroIncomingTransfer transfer : tx .getIncomingTransfers ()) {
1179
- if (transfer .getAccountIndex () == 0 ) {
1180
- scheduledAmount = scheduledAmount .add (transfer .getAmount ());
1181
- scheduledTxs .add (tx );
1178
+ // schedule transaction if funds sent to self, because they are not included in incoming transfers // TODO: fix in libraries?
1179
+ if (sentToSelfAmount .compareTo (BigInteger .ZERO ) > 0 ) {
1180
+ scheduledAmount = scheduledAmount .add (sentToSelfAmount );
1181
+ scheduledTxs .add (tx );
1182
+ } else if (tx .getIncomingTransfers () != null ) {
1183
+
1184
+ // schedule transaction if incoming tranfers to account 0
1185
+ for (MoneroIncomingTransfer transfer : tx .getIncomingTransfers ()) {
1186
+ if (transfer .getAccountIndex () == 0 ) {
1187
+ scheduledAmount = scheduledAmount .add (transfer .getAmount ());
1188
+ scheduledTxs .add (tx );
1189
+ }
1182
1190
}
1183
1191
}
1184
1192
0 commit comments