code: public ConnectionResult connect(Map<Sha256Hash, Transaction> transactions, ConnectMode mode) {
          Transaction tx = transactions.get(outpoint.getHash());
          if (tx == null) {
              return TransactionInput.ConnectionResult.NO_SUCH_TX;
          }
          return connect(tx, mode);
      }
docs: Connects this input to the relevant output of the referenced transaction if it's in the given map.
  Connecting means updating the internal pointers and spent flags. If the mode is to ABORT_ON_CONFLICT then
  the spent output won't be changed, but the outpoint.fromTx pointer will still be updated.
  
  @param transactions Map of txhash to transaction.
  @param mode   Whether to abort if there's a pre-existing connection or not.
  @return NO_SUCH_TX if the prevtx wasn't found, ALREADY_SPENT if there was a conflict, SUCCESS if not.