diff --git a/src/app/fddev/configure/genesis.c b/src/app/fddev/configure/genesis.c index 62a2ae1600..4f8dd2e2fe 100644 --- a/src/app/fddev/configure/genesis.c +++ b/src/app/fddev/configure/genesis.c @@ -114,6 +114,17 @@ estimate_hashes_per_tick( ulong tick_mhz, return (ulong)hashes_per_tick; } +/* Derive the shred version from a genesis hash */ + +static ushort +shred_version_from_genesis_hash( uchar const * genesis_hash ) { + uint version = 0; + for( ulong j=0; j<32; j+=2 ) { + version ^= ( genesis_hash[j ] << 8 ); + version ^= ( genesis_hash[j+1] ); + } + return (ushort)fd_uint_min( version+1, USHORT_MAX ); +} /* Create a new genesis.bin file contents into the provided blob buffer and return the size of the buffer. Will abort on error if the @@ -204,7 +215,14 @@ create_genesis( config_t * const config, ulong blob_len = fd_genesis_create( blob, blob_sz, options ); if( FD_UNLIKELY( !blob_sz ) ) FD_LOG_ERR(( "Failed to create genesis blob" )); - FD_LOG_DEBUG(( "Created genesis blob (sz=%lu)", blob_len )); + uchar genesis_hash[ 32 ]; + fd_sha256_hash( blob, blob_len, genesis_hash ); + + char genesis_hash_cstr[ FD_BASE58_ENCODED_32_SZ ]; + FD_LOG_INFO(( "Created genesis.bin: genesis_hash=%s sz=%lu", + fd_acct_addr_cstr( genesis_hash_cstr, genesis_hash ), + blob_len )); + FD_LOG_INFO(( "Shred version: %u", shred_version_from_genesis_hash( genesis_hash ) )); fd_scratch_detach( NULL );