void bitc_ios_dashboard_update(void) { btc_block_header hdr; char hashStr[80]; char *ts = NULL; uint256 hash; int height; bool s; if (btc->blockStore == NULL) { return; } height = blockstore_get_height(btc->blockStore); if (height == 0) { return; } s = blockstore_get_block_at_height(btc->blockStore, height, &hash, &hdr); ASSERT(mutex_islocked(btcui->lock)); uint256_snprintf_reverse(hashStr, sizeof hashStr, &hash); ts = print_time_local(hdr.timestamp, "%c"); DashboardUpdate(height, hashStr, btcui->num_peers_active, btcui->num_peers_alive, btcui->num_addrs, ts ? ts : ""); free(ts); }
void blockstore_get_hash_from_birth(const struct blockstore *bs, uint64 birth, uint256 *hash) { struct blockentry *e; for (e = bs->best_chain; e != bs->genesis; e = e->prev) { if (e->header.timestamp < birth) { char hashStr[80]; char *s; uint64 ts = birth; hash256_calc(&e->header, sizeof e->header, hash); uint256_snprintf_reverse(hashStr, sizeof hashStr, hash); s = print_time_local(birth, "%c"); Log(LGPFX " birth %llu (%s) --> block %s.\n", ts, s, hashStr); free(s); return; } } memcpy(hash, &bs->genesis_hash, sizeof *hash); ASSERT(0); }