Search in sources :

Example 1 with TxWaitingMappingUpdate

use of org.aion.api.server.pb.TxWaitingMappingUpdate in project aion by aionnetwork.

the class HdlrZmq method getTxWait.

void getTxWait() {
    TxWaitingMappingUpdate txWait = null;
    try {
        txWait = this.api.takeTxWait();
        if (txWait.isDummy()) {
            // shutdown process
            return;
        }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        LOGGER.error("zmq takeTxWait failed! ", e);
    }
    Map.Entry<ByteArrayWrapper, ByteArrayWrapper> entry = null;
    if (txWait != null) {
        entry = this.api.getMsgIdMapping().get(txWait.getTxHash());
    }
    if (entry != null) {
        this.api.getPendingStatus().add(new TxPendingStatus(txWait.getTxHash(), entry.getValue(), entry.getKey(), txWait.getState(), txWait.getTxResult(), txWait.getTxReceipt().getError()));
        // INCLUDED(3);
        if (txWait.getState() == 1 || txWait.getState() == 2) {
            this.api.getPendingReceipts().put(txWait.getTxHash(), txWait.getTxReceipt());
        } else {
            this.api.getPendingReceipts().remove(txWait.getTxHash());
            this.api.getMsgIdMapping().remove(txWait.getTxHash());
        }
    }
}
Also used : ByteArrayWrapper(org.aion.util.types.ByteArrayWrapper) TxWaitingMappingUpdate(org.aion.api.server.pb.TxWaitingMappingUpdate) Map(java.util.Map) TxPendingStatus(org.aion.api.server.types.TxPendingStatus)

Example 2 with TxWaitingMappingUpdate

use of org.aion.api.server.pb.TxWaitingMappingUpdate in project aion by aionnetwork.

the class HdlrZmq method shutdown.

public void shutdown() {
    this.getTxStatusQueue().add(new TxPendingStatus(null, null, null, 0, null, ""));
    this.api.getTxWait().add(new TxWaitingMappingUpdate(null, 0, null));
}
Also used : TxWaitingMappingUpdate(org.aion.api.server.pb.TxWaitingMappingUpdate) TxPendingStatus(org.aion.api.server.types.TxPendingStatus)

Aggregations

TxWaitingMappingUpdate (org.aion.api.server.pb.TxWaitingMappingUpdate)2 TxPendingStatus (org.aion.api.server.types.TxPendingStatus)2 Map (java.util.Map)1 ByteArrayWrapper (org.aion.util.types.ByteArrayWrapper)1