lib/reth/account_service.rb
##
# Return the address that should be used as coinbase for new blocks.
#
# The coinbase address is given by the config field pow.coinbase_hex. If
# this does not exist, the address of the first account is used instead.
# If there are no accounts, the coinbase is `DEFAULT_COINBASE`.
#
# @raise [ValueError] if the coinbase is invalid (no string, wrong
#   length) or there is no account for it and the config flag
#   `accounts.check_coinbase` is set (does not apply to the default
#   coinbase).
#
Return the address that should be used as coinbase for new blocks.
The coinbase address is given by the config field pow.coinbase_hex. If
this does not exist, the address of the first account is used instead.
If there are no accounts, the coinbase is `DEFAULT_COINBASE`.
Return the address that should be used as coinbase for new blocks . The coinbase address is given by the config field pow . coinbase_hex . If this does not exist the address of the first account is used instead . If there are no accounts the coinbase is ` DEFAULT_COINBASE ` .
def coinbase
      cb_hex = (app.config[:pow] || {})[:coinbase_hex]
      if cb_hex
        raise ValueError, 'coinbase must be String' unless cb_hex.is_a?(String)
        begin
          cb = Utils.decode_hex Utils.remove_0x_head(cb_hex)
        rescue TypeError
          raise ValueError, 'invalid coinbase'
        end
      else
        accts = accounts_with_address
        return DEFAULT_COINBASE if accts.empty?
        cb = accts[0].address
      end
      raise ValueError, 'wrong coinbase length' if cb.size != 20
      if config[:accounts][:must_include_coinbase]
        raise ValueError, 'no account for coinbase' if !@accounts.map(&:address).include?(cb)
      end
      cb
    end
def coinbase cb_hex = ( app . config [ :pow ] || { } ) [ :coinbase_hex ] if cb_hex raise ValueError , 'coinbase must be String' unless cb_hex . is_a? ( String ) begin cb = Utils . decode_hex Utils . remove_0x_head ( cb_hex ) rescue TypeError raise ValueError , 'invalid coinbase' end else accts = accounts_with_address return DEFAULT_COINBASE if accts . empty? cb = accts [ 0 ] . address end raise ValueError , 'wrong coinbase length' if cb . size != 20 if config [ :accounts ] [ :must_include_coinbase ] raise ValueError , 'no account for coinbase' if ! @accounts . map ( & :address ) . include? ( cb ) end cb end
Return the address that should be used as coinbase for new blocks.
Return the address that should be used as coinbase for new blocks .
[ValueError] if the coinbase is invalid (no string, wrong length) or there is no account for it and the config flag `accounts.check_coinbase` is set (does not apply to the default coinbase).
[ ValueError ] if the coinbase is invalid ( no string wrong length ) or there is no account for it and the config flag ` accounts . check_coinbase ` is set ( does not apply to the default coinbase ) .