mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-19 19:01:22 +00:00
added logging and added positive boolean to the fee waiting and unsigned fee events
This commit is contained in:
parent
1f6ee72fc5
commit
17b2bf3848
@ -432,7 +432,11 @@ public class CrossChainResource {
|
||||
@ApiErrors({ApiError.INVALID_CRITERIA, ApiError.REPOSITORY_ISSUE})
|
||||
public List<ForeignFeeEncodedData> getUnsignedFees(@PathParam("address") String address) {
|
||||
|
||||
return ForeignFeesManager.getInstance().getUnsignedFeesForAddress(address);
|
||||
List<ForeignFeeEncodedData> unsignedFeesForAddress = ForeignFeesManager.getInstance().getUnsignedFeesForAddress(address);
|
||||
|
||||
LOGGER.info("address = " + address);
|
||||
LOGGER.info("returning unsigned = " + unsignedFeesForAddress);
|
||||
return unsignedFeesForAddress;
|
||||
}
|
||||
|
||||
@GET
|
||||
|
@ -39,8 +39,10 @@ public class UnsignedFeesSocket extends ApiWebSocket implements Listener {
|
||||
if (!(event instanceof FeeWaitingEvent))
|
||||
return;
|
||||
|
||||
for (Session session : getSessions())
|
||||
sendUnsignedFeeEvent(session, new UnsignedFeeEvent());
|
||||
for (Session session : getSessions()) {
|
||||
boolean positive = ((FeeWaitingEvent) event).isPositive();
|
||||
sendUnsignedFeeEvent(session, new UnsignedFeeEvent(positive));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -258,7 +258,7 @@ public class ForeignFeesManager implements Listener {
|
||||
this.needToBackupRequiredForeignFees.compareAndSet(false, true);
|
||||
|
||||
if( processLocalForeignFeesForCoin(((RequiredFeeUpdateEvent) event).getBitcoiny()) ) {
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent());
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent(true));
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -283,7 +283,7 @@ public class ForeignFeesManager implements Listener {
|
||||
this.offersByAddress.computeIfAbsent( offer.qortalCreator, x -> new ArrayList<>()).add(offer);
|
||||
|
||||
if( processTradeOfferInWaiting(now, data) ) {
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent());
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent(true));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -451,6 +451,10 @@ public class ForeignFeesManager implements Listener {
|
||||
// now that this fee has been processed, remove it from the process queue
|
||||
foreignFeesToRemove.add(foreignFeeToImport);
|
||||
}
|
||||
|
||||
if( this.unsignedByAT.isEmpty() ) {
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent(false));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Repository issue while verifying foreign fees", e);
|
||||
} finally {
|
||||
@ -698,7 +702,7 @@ public class ForeignFeesManager implements Listener {
|
||||
}
|
||||
|
||||
if( feeSignaturesNeeded ) {
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent());
|
||||
EventBus.INSTANCE.notify(new FeeWaitingEvent(true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,7 +864,9 @@ public class ForeignFeesManager implements Listener {
|
||||
fee
|
||||
);
|
||||
|
||||
LOGGER.info("updating unsigned");
|
||||
this.unsignedByAT.put(atAddress, feeData);
|
||||
LOGGER.info("updated unsigned = " + this.unsignedByAT);
|
||||
}
|
||||
|
||||
// Network handlers
|
||||
|
@ -5,4 +5,17 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class UnsignedFeeEvent {
|
||||
|
||||
private boolean positive;
|
||||
|
||||
public UnsignedFeeEvent() {
|
||||
}
|
||||
|
||||
public UnsignedFeeEvent(boolean positive) {
|
||||
this.positive = positive;
|
||||
}
|
||||
|
||||
public boolean isPositive() {
|
||||
return positive;
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,19 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class FeeWaitingEvent implements Event{
|
||||
private long timestamp;
|
||||
private String address;
|
||||
|
||||
private boolean positive;
|
||||
|
||||
public FeeWaitingEvent() {
|
||||
}
|
||||
|
||||
public FeeWaitingEvent(long timestamp, String address) {
|
||||
this.timestamp = timestamp;
|
||||
this.address = address;
|
||||
public FeeWaitingEvent(boolean positive) {
|
||||
|
||||
this.positive = positive;
|
||||
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
public boolean isPositive() {
|
||||
return positive;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user