mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-25 23:39:26 -05:00
update balances on freeze/thaw, register open offer before processing
This commit is contained in:
parent
036ddef52c
commit
2966f8461c
@ -513,8 +513,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||||||
ThreadUtils.execute(() -> {
|
ThreadUtils.execute(() -> {
|
||||||
synchronized (processOffersLock) {
|
synchronized (processOffersLock) {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
addOpenOffer(openOffer);
|
||||||
processUnpostedOffer(getOpenOffers(), openOffer, (transaction) -> {
|
processUnpostedOffer(getOpenOffers(), openOffer, (transaction) -> {
|
||||||
addOpenOffer(openOffer);
|
|
||||||
requestPersistence();
|
requestPersistence();
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
resultHandler.handleResult(transaction);
|
resultHandler.handleResult(transaction);
|
||||||
@ -1660,8 +1660,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||||||
// repost offer
|
// repost offer
|
||||||
synchronized (processOffersLock) {
|
synchronized (processOffersLock) {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
addOpenOffer(updatedOpenOffer);
|
||||||
processUnpostedOffer(getOpenOffers(), updatedOpenOffer, (transaction) -> {
|
processUnpostedOffer(getOpenOffers(), updatedOpenOffer, (transaction) -> {
|
||||||
addOpenOffer(updatedOpenOffer);
|
|
||||||
requestPersistence();
|
requestPersistence();
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
if (completeHandler != null) completeHandler.run();
|
if (completeHandler != null) completeHandler.run();
|
||||||
|
@ -407,6 +407,18 @@ public class XmrWalletService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Freeze the given outputs with a lock on the wallet.
|
||||||
|
*
|
||||||
|
* @param keyImages the key images to freeze
|
||||||
|
*/
|
||||||
|
public void freezeOutputs(Collection<String> keyImages) {
|
||||||
|
synchronized (walletLock) {
|
||||||
|
for (String keyImage : keyImages) wallet.freezeOutput(keyImage);
|
||||||
|
}
|
||||||
|
updateBalanceListeners(); // TODO (monero-java): balance listeners not notified on freeze/thaw output
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thaw the given outputs with a lock on the wallet.
|
* Thaw the given outputs with a lock on the wallet.
|
||||||
*
|
*
|
||||||
@ -416,6 +428,7 @@ public class XmrWalletService {
|
|||||||
synchronized (walletLock) {
|
synchronized (walletLock) {
|
||||||
for (String keyImage : keyImages) wallet.thawOutput(keyImage);
|
for (String keyImage : keyImages) wallet.thawOutput(keyImage);
|
||||||
}
|
}
|
||||||
|
updateBalanceListeners(); // TODO (monero-java): balance listeners not notified on freeze/thaw output
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> getSubaddressesWithExactInput(BigInteger amount) {
|
private List<Integer> getSubaddressesWithExactInput(BigInteger amount) {
|
||||||
@ -530,7 +543,9 @@ public class XmrWalletService {
|
|||||||
.setPriority(XmrWalletService.PROTOCOL_FEE_PRIORITY)); // pay fee from security deposit
|
.setPriority(XmrWalletService.PROTOCOL_FEE_PRIORITY)); // pay fee from security deposit
|
||||||
|
|
||||||
// freeze inputs
|
// freeze inputs
|
||||||
for (MoneroOutput input : tradeTx.getInputs()) wallet.freezeOutput(input.getKeyImage().getHex());
|
List<String> keyImages = new ArrayList<String>();
|
||||||
|
for (MoneroOutput input : tradeTx.getInputs()) keyImages.add(input.getKeyImage().getHex());
|
||||||
|
freezeOutputs(keyImages);
|
||||||
saveMainWallet();
|
saveMainWallet();
|
||||||
return tradeTx;
|
return tradeTx;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user