public Binder provideStats(Integer showDays) { if(nodeStats.nodeStartTime == null) throw new IllegalStateException("node state are not initialized. wait for node initialization to finish."); Binder result = Binder.of( "uptime", Instant.now().getEpochSecond() - nodeStats.nodeStartTime.toEpochSecond(), "ledgerSize", nodeStats.ledgerSize.isEmpty() ? 0 : nodeStats.ledgerSize.values().stream().reduce((i1, i2) -> i1 + i2).get(), "smallIntervalApproved", nodeStats.smallIntervalApproved, "bigIntervalApproved", nodeStats.bigIntervalApproved, "uptimeApproved", nodeStats.uptimeApproved, "coreVersion", Core.VERSION, "nodeNumber", myInfo.getNumber() ); if(showDays != null) { result.put("payments",nodeStats.getPaymentStats(ledger,showDays)); } return result; }