   _extendTransaction: (err, transaction, push, next) ->
     wallet = ledger.wallet.Wallet.instance
     @_getAddressCache().then (cache) =>
-      l cache
+      l "IN CACHE ", cache
       for io in transaction.inputs.concat(transaction.outputs)
         io.paths = []
         io.accounts = []


  _updateLayout: (err, transaction, push, next) ->
    # Notify to the layout that the path is used
    needsNotify = no

    for path in _(transaction.inputs.concat(transaction.outputs)).chain().map((i) -> i.paths).flatten().compact().value()
      l "Notify used ", path
      needsNotify = ledger.wallet.Wallet.instance.getAccountFromDerivationPath(path).notifyPathsAsUsed([path]) or needsNotify

    @_notifyNewPathAreAvailable() if needsNotify # Clear and fetch the cache
    push null, transaction
    do next


  _requestDerivations: ->
    d = ledger.defer()
    ledger.wallet.pathsToAddresses ledger.wallet.Wallet.instance.getAllObservedAddressesPaths(), (addresses) ->
      l "REQUEST DERIVATION ", ledger.wallet.Wallet.instance.getAllObservedAddressesPaths()
      d.resolve(_.invert(addresses))
    d.promise

  _getAddressCache: -> @_requestDerivations()

  ###
    Extends the given transaction with derivation paths and related accounts
